[Thread Prev][Thread Next][Index]

Re: [ferret_users] looping through viewports

Dear Jennifer,

Lets adopt a simpler example to illustrate. Suppose we have a variable with four timesteps (l=4), and we want to plot each timestep in a viewport. We do

vplist = {"ul", "ur", "ll", "lr"}
repeat/range=1:4/name=m ( \
set viewport `vplist[i=m]`; \
fill variable[l=`m`]; \

If you have more than four viewports, you'll have to define those viewports before use it. In this case, you can use numbered-sequenced viewport names, such as vp1, vp2, vp3, ..., vpN. This makes your life easier if you have to use these viewports inside a repeat loop, and you should simply use something like the example below.

repeat/range=1:N/name=m ( \
set viewport vp`m`; \
<plot commands>; \

Hope it helps.

Paulo Santiago

2012/9/17 <Jennifer.Abernethy@xxxxxxxx>

i'm trying to write a ferret script that can plot varying-length timeseries in sections, i.e., for 40 years of monthly data make 4 plots, for 100 years of monthly data make 10 plots, etc. I can do most of this in a repeat/range loop, but the one part I can't figure out is how to loop through viewports. I just want to loop through an array, arr[1], arr[2], arr[3] arr[4], arr[1], arr[2], etc etc - at least, that's how I'd do it in other languages. I was wanting 4 plots/page, ul (upper left) ur, ll, lr.

something like this:
let f = {"ul","ur","ll","lr"}   !how do I address the elements of this list?
let c =1    !montlhly data counter
repeat/range=`startyear`:`endyear-10`:10:name=m (let g = `c+120`; !120 months = 10yrs ; set viewport ???? ; plot data[`c`:`g`] ; label/nouser 0,4,-1,0,.15 Title Year `m` to `m+10`; let c=`g`)

I was also wondering if after 4+ iterations of this loop that the resulting gif file will have multiple pages, or will the last 4 plots overwrite any previous ones?
thanks for any help you can give,

Paulo Santiago
Doutorado em Meteorologia
Programa de Pós-Graduação em Meteorologia
Instituto Nacional de Pesquisas Espaciais
Tel.: (12) 3186 8637

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement