[gradsusr] Making a Nested While Loop

saiguranloi at yahoo.com saiguranloi at yahoo.com
Fri Dec 31 11:52:13 EST 2010


I followed your procedure accurately;

Everything else worked except for the vpage options!

SET error: Missing or invalid arguments for VPAGE option

All the four images are overlaid on each other on the full page!
Sent from my BlackBerry® smartphone from Zain Tanzania

-----Original Message-----
From: Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
Date: Fri, 31 Dec 2010 15:30:58 
To: saiguran loisulie<saiguranloi at yahoo.com>
Cc: GrADS Users<gradsusr at gradsusr.org>
Subject: Re: Making a Nested While Loop

Saiguran,

The following script does as you require.

'sdfopen ifile.nc'

mtot = 4
m = 1
while ( m < mtot +1 )

* labels for title
s0 = ''DJF' 'MAM' 'JJA' 'SON''
s1 = subwrd(s0,m)

* dimensions for 2x2 plot
x1 = 11/2
x2 = x1 + x1
oo = 0.00
y1 = 8.5/2
y2 = y1 + y1

p1 = ''oo' 'x1' 'oo' 'x1''
p2 = ''x1' 'x2' 'x1' 'x2''
p3 = ''y1' 'y1' 'oo' 'oo''
p4 = ''y2' 'y2' 'y1' 'y1''

a1 = subwrd(p1,m)
a2 = subwrd(p2,m)
a3 = subwrd(p3,m)
a4 = subwrd(p4,m)

'set t 'm''
'set vpage 'a1' 'a2' 'a3' 'a4''
'set lat -20 20'
'set lon 20 60'
'set grads off'
'set mpdset mres'
'set gxout shaded'
'set clevs 288 290 292 294 296 298 300 304 306 308 310'

'd tmax'
'd u10;v10'
'draw title 's1''
'run cbarn'

m = m +1
endwhile

'printim image.png white'
'quit'

-- 
Muhammad Rahiz
Researcher & DPhil Candidate (Climate Systems & Policy)
School of Geography & the Environment
University of Oxford

On Fri, 31 Dec 2010, saiguran loisulie wrote:

> Hi,
> 
> Yes, I want to produce 2x2 images in a plot!
> 
> My problem is how to include the vpage settings in a loop!
> 
> Saiguran Loisulie
> Climate Systems Analysis Group
> Environmental and Geographical Science Department
> University of Cape Town
> Private Bag X3
> Rondebosch
> 7701
> SOUTH AFRICA
> 
> CELL 0748 068 230
> 
> --- On Fri, 12/31/10, Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
> wrote:
>
>       From: Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
>       Subject: Re: Making a Nested While Loop
>       To: "saiguran loisulie" <saiguranloi at yahoo.com>
>       Cc: "GrADS Users" <gradsusr at gradsusr.org>
>       Date: Friday, December 31, 2010, 3:47 AM
>
>       Firstly, I don't know what exactly you want to do i.e.
>       how many images (e.g. 2x2?) in a plot you want to make.
>       Secondly, the illustration is an example of how to do a
>       loop.
> 
>
>       Muhammad Rahiz
>       Researcher & DPhil Candidate (Climate Systems & Policy)
>       School of Geography & the Environment
>       University of Oxford
>
>       On Fri, 31 Dec 2010, saiguran loisulie wrote:
>
>       > Hi
>       >
>       > Thank you!
>       >
>       > But you have omitted the following two statements in
>       your loop
>       > 'set vpage ...'
>       > 'draw title ...'
>       >
>       > Saiguran Loisulie
>       > Climate Systems Analysis Group
>       > Environmental and Geographical Science Department
>       > University of Cape Town
>       > Private Bag X3
>       > Rondebosch
>       > 7701
>       > SOUTH AFRICA
>       >
>       > CELL 0748 068 230
>       >
>       >
> 
> 
> 
>




More information about the gradsusr mailing list