[Thread Prev][Thread Next][Index]
Re: Curvilinear grids and subregions...
Hi Gary,
The way to set a region with this kind of data is to use a mask.
Something like this: (using the new continuation-lines syntax
from v5.40 for readability; the sub_var definition could all be
on one line)
let sub_var = if lon[d=gridinfo.nc] ge `xmin` and \
lon[d=gridinfo.nc] le `xmax` and \
lat[d=gridinfo.nc] ge `ymin` and \
lat[d=gridinfo.nc] le `ymax` then \
var[d=1]* mp_mask
shade sub_var, x_page, y_page
Gary Strand wrote:
> I've got some data on the PCM POP grid (see http://www.cgd.ucar.edu/pcm for
> more about it) and the necessary grid information for it.
>
> In what order should I do the following calls to get a subregion (say, the Gulf
> Stream) of that grid properly plotted? I've been stumped for a couple days on
> this!
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> use pop_data.nc
> use gridinfo.nc
> !
> let xmin = -90; let xmax = 10
> let ymin = 20; let ymax = 80
> let xdel = 10; let ydel = 10
> let mid_lon = `xmin+(xmax-xmin)/2`
> let mid_lat = `ymin+(ymax-ymin)/2`
> !
> go mp_lambert_cyl `mid_lon` `mid_lat`
> set region/x=`xmin`:`xmax`/y=`ymin`:`ymax`
> let mp_lambda = lon[d=gridinfo.nc] * deg2rad
> let mp_phi = lat[d=gridinfo.nc] * deg2rad
> set grid `var[d=1],return=grid`
> shade var[d=1]*mp_mask, x_page, y_page
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> The above doesn't work - the "set region" command uses the i,j of the original
> data, which is only "indexical" space, not geographic space.
>
> I'm hoping I just need to rearrange the order of the calls to get it to work
> right!
>
> Thanks.
> --
> /\ Gary Strand (303) 497-1336 NCAR ML262A
> \_][ www.cgd.ucar.edu/ccr/strandwg 1850 Table Mesa Dr
> \___strandwg@ucar.edu Boulder, Colorado, USA 80305
--
Ansley Manke Pacific Marine Environmental Laboratory Seattle WA (206)526-6246
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement