[gradsusr] Making a Nested While Loop

saiguranloi at yahoo.com saiguranloi at yahoo.com
Fri Dec 31 13:47:12 EST 2010


Thank you very much. It finally worked.
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 18:41:00 
To: saiguran loisulie<saiguranloi at yahoo.com>
Cc: GrADS Users<gradsusr at gradsusr.org>
Subject: Re: Making a Nested While Loop

The error lies in the following line

  'set vpage 'a1''a2''a3''a4''

which needs to be separated by spaces like so

  'set vpage 'a1' 'a2' 'a3' 'a4''

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

On Fri, 31 Dec 2010, saiguran loisulie wrote:

> Thank you.
> 
> My script is attached.
> 
> 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: "saiguranloi at yahoo.com" <saiguranloi at yahoo.com>
>       Cc: "Muhammad Rahiz" <muhammad.rahiz at ouce.ox.ac.uk>, "GrADS Users"
>       <gradsusr at gradsusr.org>
>       Date: Friday, December 31, 2010, 9:36 AM
>
>       FYI, the script has been tested and it works fine. Can you include your
>       script in an attachment and describe exactly how you run it?
>
>       Also, go easy on the exclamation mark (!) - not necessary I would think...
>
>       --
>       Muhammad Rahiz
>       Researcher & DPhil Candidate (Climate Systems & Policy)
>       School of Geography & the Environment
>       University of Oxford
>
>       On Fri, 31 Dec 2010, saiguranloi at yahoo.com wrote:
>
>       > 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'
>       >
>       >
> 
> 
> 
>




More information about the gradsusr mailing list