[gradsusr] If else condition in GRADS

清风 497805453 at qq.com
Mon Sep 24 23:53:58 EDT 2012


Hi,Mubashar
 there is an example  GrADS Function Documentation,here is the link:
 http://grads.iges.org/grads/gadoc/gradfuncconst.html
  
 use const and maskout function together.
  
 Qingfeng
  

 

 ------------------ Original ------------------
  From:  "Mubashar Dogar"<mubashardogar at gmail.com>;
 Date:  Tue, Sep 25, 2012 00:05 AM
 To:  "gradsusr"<gradsusr at gradsusr.org>; 
 
 Subject:  [gradsusr] If else condition in GRADS

 

Dear GrADS users,

I have 30 years time series data in a file named "File.ctl". The name
of the variable in the file is "output" and it has different value for
each year.

I wanted to use if/else in GrADS. My condition is that if my output
value is greater than "0" then write a new variable as "alpha=0.4"
else "alpha=0".

Following are few lines that I tried but it is only saving one value
for each year
'open File.ctl'
'set gxout fwrite '
'set fwrite alpha.dat'
'set t 1 30'
if (output>0)
'define alpha=0.4'
else
'define alpha=0'
endif
'd alpha'
But it is giving only one value that is 0.4 for all years. what's wrong in this?

Thanks,

Mubashar
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120925/4b008327/attachment-0003.html 


More information about the gradsusr mailing list