[Thread Prev][Thread Next][Index]

Re: [ferret_users] Outlining grid boxes



jagadish karmacharya a écrit :
Dear Partick,

Thanks. you script works fine over the entire domain of the dataset. But it doesn't work when I try to diplay and overlay over a sub region of the entire domain.

Any idea?

Yes, the cause is that the use of region limits excursion of X and Y dimensions.
The initial script uses the 2D form of x- and y- vertices as described in
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/POLYGON

But you can modify it to get the x- and y- vertices set over K and L dimensions.
This is what I have done in the attached script and its demo.

Note that /modulo qualifier does not exist for polygon command so the command
is repeated twice (lon and lon+360).

Patrick

!========================================================
let ME_VAR=($01)
let ME_VAR0=TSEQUENCE(ME_VAR)

!========================================================
! build vector boundaries
let XLO = TSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+XBOXLO[GX=ME_VAR])
let XHI = TSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+XBOXHI[GX=ME_VAR])
let YHI = TSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0+YBOXHI[GY=ME_VAR])
let YLO = TSEQUENCE(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 = TSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0)+K[K=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 = TSEQUENCE(X[GX=ME_VAR]*Y[GY=ME_VAR]*0)+K[K=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/over/fill/line/nolab/key/lev=20 BOUNDS_LON_4, BOUNDS_LAT_4, ME_VAR0

! Note that /modulo qualifier does not exist for polygon command
! so repeat polygon command with bounds_lon+360 and same levels as previous
polygon/over/fill/line/nolab/key/lev BOUNDS_LON_4+360, BOUNDS_LAT_4, ME_VAR0
!========================================================
use levitus_climatology

!========================================================
set region W
go basemap "" "" "" "" hollow
go shade_polygon.jnl temp[k=1] 
go land

!========================================================
pause

!========================================================
set region/x=330:420/y=30:60
go basemap "" "" "" "" hollow
go shade_polygon.jnl temp[k=1]
go land

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement