[Thread Prev][Thread Next][Index]

Re: [ferret_users] limit of numbers of viewports



Hi Takaya & Ansley
This problem might be better solved with regridding than with multiple
viewports. Below is a demo, for an admittedly small x-y grid, that does
the job; a GIF image of the result. is attached.
Good luck,
Mick
!-------------------
! 6-Dec-05 : drawing 20 years of monthly data (on an x-y grid) without
using multiple viewports
! NOTE: the lines in the repeat loop end in "backslash" which the
mailtool seems to alter

! preliminary step - create some fake data 240 months on a 9x7 grid
def axis/x=1:9:1 xax ; def axis/y=1:7:1 yax ; def
axis/t=15-dec-1981:15-dec-2000/npoints=240 tax
def grid/x=xax/y=yax/t=tax grd
let/title="240 months of data on 9x7 grid"
v=(1+randu(l[g=grd]))*(10-((x[g=grd]-5)^2+(y[g=grd]-4)^2)^0.5)

! ... and save it to a file
save/file=testdata.nc v

! remove the variable used to define the "data"
can var v

! ... then read back the "data" ... now the demo begins
use testdata.nc

! define a conversion from time index L to month and year
let mod12=mod(l,12) ; set var/bad=0 mod12 ; let month=missing(mod12,12)
let year=1981+(l-month)/12

! create a base plot with appropriate axes to span the entire year and
month range
plot/vs/nolab/nokey/set 1,1
ppl xaxis,1980,2001,1 ; ppl yaxis,0,13,1 ; ppl xfor,(i4) ; ppl yfor,(i2)
; ppl plot

! then, one by one, overlay the monthly gridded images
repeat/l=1:240 (def axis/x=`year-0.45`:`year+0.45`/npoints=9 xnew ;\
def axis/y=`month-0.4`:`month+0.4`/npoints=7 ynew ;\
def grid/like=v/x=xnew/y=ynew gnew ; let vnew=v[g=gnew,gx=@asn,gy=@asn] ;\
shade/o/nolab/nokey/lev=(0,20,0.5)/hlim=1980:2001/vlim=0:13 vnew ; ppl
shaset reset )

frame/file=quilt.gif

q

GIF image

 !  6-Dec-05 : drawing 20 years of monthly data (on an x-y grid) without using multiple viewports 

! preliminary step - create some fake data 240 months on a 9x7 grid
def axis/x=1:9:1 xax ; def axis/y=1:7:1 yax ; def axis/t=15-dec-1981:15-dec-2000/npoints=240 tax
def grid/x=xax/y=yax/t=tax grd
let/title="240 months of data on 9x7 grid" v=(1+randu(l[g=grd]))*(10-((x[g=grd]-5)^2+(y[g=grd]-4)^2)^0.5)

! ... and save it to a file
save/file=testdata.nc v

! remove the variable used to define the "data"
can var v

! ... then read back the "data" ... now the demo begins 
use testdata.nc

! define a conversion from time index L to month and year
let mod12=mod(l,12) ; set var/bad=0 mod12 ; let month=missing(mod12,12) ; let year=1981+(l-month)/12

! create a base plot with appropriate axes to span the entire year and month range
plot/vs/nolab/nokey/set 1,1 ; ppl xaxis,1980,2001,1 ; ppl yaxis,0,13,1 ; ppl xfor,(i4) ; ppl yfor,(i2) ; ppl plot

! then, one by one, overlay the monthly gridded images
repeat/l=1:240 (def axis/x=`year-0.45`:`year+0.45`/npoints=9 xnew ; def axis/y=`month-0.4`:`month+0.4`/npoints=7 ynew ;\
def grid/like=v/x=xnew/y=ynew gnew ; let vnew=v[g=gnew,gx=@asn,gy=@asn] ;\
shade/o/nolab/nokey/lev=(0,20,0.5)/hlim=1980:2001/vlim=0:13 vnew ; ppl shaset reset )
frame/file=quilt.gif

q

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement