[gradsusr] About using the IF command in GrADS
Hang
hang_hang2004 at yahoo.com.hk
Tue Jan 25 04:25:04 EST 2011
Hi,
I face problems when using the IF command in the script. I use the IF command to
check for some conditions but there is something wrong. I think it may be due to
the difference in the data type of the defined variables.
The following is the part of my script that I used and encountered the problem.
time=1
lat1=22.5
lat2=25
lon1=112.5
lon2=115
'define levmax=1000'
'set lat 'lat1
'set lev '1000
'set t 'time
'define check1=ave(spres,lon='lon1',lon='lon2')'
if (check1 > levmax)
'define levmax=925'
say '1000'
endif
The value of "check1" is about 990 and so it is smaller than 1000 as defined in
levmax. So the condition should be false, however the programme did execute the
commands under the condition "(check1 > levmax)"
Do you know what is the reason for this? What should I do to correct this? Are
there other similar situations that I need to becare of when I use defined
variables and IF / WHILE commands?
Thanks a lot for your help!!!
Best,
Henry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110125/835330f9/attachment-0003.html
More information about the gradsusr
mailing list