[gradsusr] How to use while loop in Grads

Muhammad Rahiz muhammad.rahiz at ouce.ox.ac.uk
Tue Mar 1 03:47:34 EST 2011


This is an example of a loop done 10 times

t1 = 10
t2 = 1
while( t2 <= t1 )

... some process ...

t2 = t2 + 1
endwhile

With respect to multiple ctl files, I believe you can combine them
into one control file. You need to add chsub, and change dset and tdef in 
that one ctl file, or master ctl file as i would call it.

Below is a sample of how I did it (it has been 2 years since I worked with ctl 
files)

dset ^SRF.%ch 
chsub   1       248     2040010100
chsub   249     480     2040020100
chsub   481     728     2040030100

tdef  87664 linear  6z01jan2040  3hr

where 1-248, 249-480 ... are monthly timestamps.

Compare the above to my individual ctl file which has the following 
elements;

dset ^SRF.2069120100
tdef  248 linear  3z01dec2069  3hr


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

On Tue, 1 Mar 2011, Ali Imran wrote:

> I Have download snow data from JRA for years 1979-20210.Data of each month
> has a different cotrol file.So while loop is needed to draw that data
> through  Grads.
>  How I can use while loop for this data & what should be the structure of
> that loop.
>  
>                                                                           
?? ?                                      Ali
>                           
> 
> 
>


More information about the gradsusr mailing list