From: Brockmann Patrick <Patrick.Brockmann@xxxxxx>
Subject: Re: [ferret_users] Outlining grid boxes
To:
Cc: ferret_users@xxxxxxxx
Date: Friday, October 30, 2009, 6:14 AM
jagadish karmacharya a écrit :
> Dear all,
>
> I wanted to outline each grid box of a grided data. For this, I used the method suggested by Jaison (
http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2004/msg00774.html)
but got the attached plot. (grid_center....) Seems like the corner of
the overlay box/rectangle lay over the grid center (rather than at the
edge as I wanted). How can I overlay the box so as to match undrlaying
grid?
>
> Also, some time ago I made plot (grid.gif) with marker at grid center but now forgot how i did that. Can any one suggest?
>
> Regards
> Jagadish
>
>
Hi,
Here is an example of what can be made using the polygon command.
Hope that will help you
Patrick
-----Inline Attachment Follows-----
!========================================================
use levitus_climatology
!========================================================
let ME_VAR=temp[k=1]
let ME_VAR0=ysequence(ME_VAR)
!========================================================
! build vector boundaries
let XLO = YSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+XBOXLO[GX=ME_VAR])
let XHI = YSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+XBOXHI[GX=ME_VAR])
let YHI = YSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+YBOXHI[GY=ME_VAR])
let YLO =
YSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+YBOXLO[GY=ME_VAR])
!========================================================
! (1) x-------x (2)
! | |
! | + |
! | |
! (4) x-------x (3)
!
! build a variable with longitude boundaries
let BOUNDS_LON_0 = YSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0)+I[I=1:4]
let BOUNDS_LON_1 = IF BOUNDS_LON_0 EQ 1 THEN XLO ELSE BOUNDS_LON_0
let BOUNDS_LON_2 = IF BOUNDS_LON_0 EQ 2 THEN XHI ELSE BOUNDS_LON_1
let BOUNDS_LON_3 = IF BOUNDS_LON_0 EQ 3 THEN XHI ELSE BOUNDS_LON_2
let BOUNDS_LON_4 = IF BOUNDS_LON_0 EQ 4 THEN XLO ELSE BOUNDS_LON_3
set variable/title="Longitude" BOUNDS_LON_4
! build a variable with latitude boundaries
let BOUNDS_LAT_0 =
YSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0)+I[I=1:4]
let BOUNDS_LAT_1 = IF BOUNDS_LAT_0 EQ 1 THEN YHI ELSE BOUNDS_LAT_0
let BOUNDS_LAT_2 = IF BOUNDS_LAT_0 EQ 2 THEN YHI ELSE BOUNDS_LAT_1
let BOUNDS_LAT_3 = IF BOUNDS_LAT_0 EQ 3 THEN YLO ELSE BOUNDS_LAT_2
let BOUNDS_LAT_4 = IF BOUNDS_LAT_0 EQ 4 THEN YLO ELSE BOUNDS_LAT_3
set variable/title="Latitude" BOUNDS_LAT_4
!========================================================
polygon/set_up/fill/line/hlim=100:300/vlim=0:60/title="maps with polygons"/lev=20 BOUNDS_LON_4, BOUNDS_LAT_4, ME_VAR0
ppl xfor (I7,''LONE'') ! set longitude axis labels
ppl yfor (I7,''LAT'') ! set latitude axis labels
ppl fillpol/line/fill
go land
! Note that /modulo qualifier does not exist for polygon command