On Tue, May 1, 2012 at 10:17 AM, Mubashar Dogar <span dir="ltr"><<a href="mailto:mubashardogar@gmail.com" target="_blank">mubashardogar@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear GrADS users,<br>
<br>
Could you please help me to fix the following problem. I have a file<br>
with one variable named NAO having different value for each year<br>
(1980-2002). I have two other constant gridded fields A and B. My NAO<br>
variable can have positive or negative values varying in between -3<br>
and 3. I want to calculate a formula in such a way that I need its<br>
values only when NAO absolute values are greater than 1. For other<br>
values of NAO, I want that formula to have missing (NAN) values.<br>
<br>
I am trying in the following way but it is not taking abs(NAO) instead<br>
it is taking all the NAO values.<br>
<br>
<br>
**********************************<br>
Note: My A and B are constant gridded fields.<br>
NAO is a varying means different value for each year and it is not gridded.<br>
***********************************<br>
Following is my script lines:<br>
<br>
'set time jan1979 jan2001'<br>
if ('abs(nao)' >= 1)<br></blockquote><div><br></div><div>You cannot do this: mix scripting language and grads expression parser namespace.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
'define DT=B*nao+A'<br>
else<br>
'define DT=-999'<br>
endif<br>
'd DT'<br>
<br></blockquote><div><br></div><div>If you are using opengrads, the if() can be useful here:</div><div><br></div><div>'d if(abs(nao),<,1,-u,b*nao+a)'</div><div><br></div><div>You can also use the <a href="http://grads.iges.org/grads/gadoc/gradfuncmaskout.html">maskout()</a> function as Yan Libin suggests.</div>
<div><br></div><div> Arlindo</div><div><br></div></div>-- <br><font face="'comic sans ms', sans-serif" size="6" color="#006600"><span style="font-family:Helvetica;font-size:12px"></span><span></span><span></span>Arlindo da Silva</font><br>
<font size="4"><i><a href="mailto:dasilva@alum.mit.edu" target="_blank">dasilva@alum.mit.edu</a></i></font><br>