Leap Year

Katherin Kullgren kullgren at CRCES.ORG
Mon Jan 8 13:52:35 EST 2007


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'



More information about the gradsusr mailing list