<DIV>Hi,Mubashar</DIV>
<DIV>there is an example&nbsp; GrADS Function Documentation,here is the link:</DIV>
<DIV><A href="http://grads.iges.org/grads/gadoc/gradfuncconst.html">http://grads.iges.org/grads/gadoc/gradfuncconst.html</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>use const and maskout function together.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Qingfeng</DIV>
<DIV><includetail>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 12px; FONT-FAMILY: Arial Narrow; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px">------------------&nbsp;Original&nbsp;------------------</DIV>
<DIV style="FONT-SIZE: 12px; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px">
<DIV><B>From: </B>&nbsp;"Mubashar Dogar"&lt;mubashardogar@gmail.com&gt;;</DIV>
<DIV><B>Date: </B>&nbsp;Tue, Sep 25, 2012 00:05 AM</DIV>
<DIV><B>To: </B>&nbsp;"gradsusr"&lt;gradsusr@gradsusr.org&gt;; <WBR></DIV>
<DIV></DIV>
<DIV><B>Subject: </B>&nbsp;[gradsusr] If else condition in GRADS</DIV></DIV>
<DIV><BR></DIV>Dear GrADS users,<BR><BR>I have 30 years time series data in a file named "File.ctl". The name<BR>of the variable in the file is "output" and it has different value for<BR>each year.<BR><BR>I wanted to use if/else in GrADS. My condition is that if my output<BR>value is greater than "0" then write a new variable as "alpha=0.4"<BR>else "alpha=0".<BR><BR>Following are few lines that I tried but it is only saving one value<BR>for each year<BR>'open File.ctl'<BR>'set gxout fwrite '<BR>'set fwrite alpha.dat'<BR>'set t 1 30'<BR>if (output&gt;0)<BR>'define alpha=0.4'<BR>else<BR>'define alpha=0'<BR>endif<BR>'d alpha'<BR>But it is giving only one value that is 0.4 for all years. what's wrong in this?<BR><BR>Thanks,<BR><BR>Mubashar<BR>_______________________________________________<BR>gradsusr mailing list<BR>gradsusr@gradsusr.org<BR>http://gradsusr.org/mailman/listinfo/gradsusr<BR>
<DIV></DIV></includetail></DIV>