Leap Year

Mary Jo Nath Mary-Jo.Nath at NOAA.GOV
Mon Jan 8 14:26:53 EST 2007


Katherin,

Your syntax is off a little. There is no "then" on an "if" statement in
GrADS scripting language. Instead of:

        if (rc = 0) then

use

        if (rc = 0)


MJ



Katherin Kullgren wrote:
> Good Afternoon,
> I am having some trouble with my program. I want to write daily data from
> year files of 4 different variables, into one file.  It looks like in my
> loop, when it moves onto the next file, it still tries to read say line 366
> of the previous file instead of line 1 of the next file.  I am sure it is
> some order of commands error, but I cannot figure it out. Could someone
> please take a look?
> Thanks in advance,
> Katherin
>
> lat = 168
> lon = 173
> starttime = 1
> year = 1950
> endday = 365
> leap = 366
> pfile = 1
> rfile = 11
> wfile = 21
> tfile = 31
> num_2 = 4
>
> * write the new data into a file
> 'set gxout fwrite'
> 'set fwrite 10110204.data'
>
> *********
> while (pfile <= 10)
> num_1 = year
> rc = math_mod(num_1,num_2)
> tt=starttime
> imap = 1
> jmap = 8
> 'set x 'lat
> 'set y 'lon
>
> if (rc = 0) then
>
> while (tt<=leap)
> 'set dfile 'tfile
> 'd max(tair2,t='imap',t='jmap')-273.16'
> 'd min(tair2,t='imap',t='jmap')-273.16'
> 'set dfile 'pfile
> 'set t 'tt
> 'd prate*86400'
> 'set dfile 'rfile
> 'set t 'tt
> 'd rh/100'
> 'set dfile 'wfile
> 'set t 'tt
> 'd wind*1.3'
> imap = imap + 8
> jmap = jmap + 8
> tt = tt + 1
> endwhile
>
> else
>
> tt=starttime
> imap = 1
> jmap = 8
>
> while (tt<=endday)
> 'set dfile 'tfile
> 'd max(tair2,t='imap',t='jmap')-273.16'
> 'd min(tair2,t='imap',t='jmap')-273.16'
> 'set dfile 'pfile
> 'set t 'tt
> 'd prate*86400'
> 'set dfile 'rfile
> 'set t 'tt
> 'd rh/100'
> 'set dfile 'wfile
> 'set t 'tt
> 'd wind*1.3'
> imap = imap + 8
> jmap = jmap + 8
> tt = tt + 1
> endwhile
>
> endif
>
> year = year + 1
> pfile = pfile + 1
> rfile = rfile + 1
> wfile = wfile + 1
> tfile = tfile + 1
> endwhile
>
>
> 'disable fwrite'
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mary-Jo.Nath.vcf
Type: text/x-vcard
Size: 217 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20070108/262e5d0f/attachment.vcf 


More information about the gradsusr mailing list