<div dir="ltr">Dear Eric,<div><br></div><div>Thank you so much for the help. The explanation of the subtle difference between data variable and script variable was excellent.</div><div><br></div><div>Warm regards,</div><div>
<br></div><div>Amulya Chevuturi</div><div>School of Environmental Sciences</div><div>Jawaharlal Nehru University</div><div>New Delhi, India</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 1, 2014 at 12:08 AM, Eric Altshuler <span dir="ltr"><<a href="mailto:ela@cola.iges.org" target="_blank">ela@cola.iges.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:arial,helvetica,sans-serif">Dear Amulya,<div><br></div><div>The grads scripting language does not support directly accessing the values of data variables (either defined or from a dataset). In your 'if' statements, the variables 'a' and 'b' refer to script variables, not data variables. You need to first obtain the values of your <i>defined</i> variables a and b, then assign these values to script variables. Just before each 'if' statement in your script, insert the following lines:</div>
<div><br></div><div>'display a'</div><div>a=subwrd(result,4)</div><div>'display b'</div><div>b=subwrd(result,4)</div><div><br></div><div>It may be a bit confusing, but the script variables 'a' and 'b' (i.e. those assigned values using subwrd function) are NOT the same as the data variables a and b (i.e. those in the 'display' commands).</div>
<div><br></div><div>Best regards,<br><br><div><span name="x"></span>Eric L. Altshuler<br>Research Scientist<br>Center for Ocean-Land-Atmosphere Studies<br>253 Research Hall, Mail Stop 6C5<div>George Mason University</div>
<div>4400 University Drive<br>Fairfax, VA 22030 USA<br><br>E-mail: <a href="mailto:ela@cola.iges.org" target="_blank">ela@cola.iges.org</a><br>Phone: (703) 993-5725<br>Fax: (703) 993-5770</div><span name="x"></span><br></div>
<br><hr><b>From: </b>"Amulya Chevuturi" <<a href="mailto:amulya.chevuturi@gmail.com" target="_blank">amulya.chevuturi@gmail.com</a>><br><b>To: </b>"GrADS Users Forum" <<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>><br>
<b>Sent: </b>Wednesday, April 30, 2014 12:18:33 AM<br><b>Subject: </b>[gradsusr] Contingency Table<div><div class="h5"><br><br><div dir="ltr">Dear Grads Users<div><br></div><div>I am trying to build contingency table for model verification using grads. Currently my model and observation are both at exactly same resolution. So I have written the following script. But it is not giving me the count of Yes/Yes, No/No etc correctly. How am I supposed to build contingency table using grads if someone can please help.</div>
<div><br></div><div>Following is the script. </div><div><br></div><div><div>'reinit'</div><div><br></div><div>'open model.ctl'</div><div>'set t 3'</div><div>'set y 57 208'</div><div>'set x 72 228'</div>
<div>'define a = rain'</div><div>'close 1'</div><div><br></div><div>'open observation.ctl'</div><div>'set t 3'</div><div>'set y 57 208'</div><div>'set x 72 228'</div><div>'define b = prec'</div>
<div><br></div><div>n1=0</div><div>n2=0</div><div>n3=0</div><div>n4=0</div><div>j=72<br></div><div>while (j<=228)</div><div>'set y 'j</div><div>i=57</div><div>while (i<=208)</div><div>'set x 'i</div>
<div>if(a>0&b>0)</div><div>n1=n1+1</div><div>else</div><div>if(a<=0&b<=0)</div><div>n2=n2+1</div><div>else</div><div>if(a<=0&b>0)</div><div>n3=n3+1</div><div>else</div><div>if(a>0&b<=0)</div>
<div>n4=n4+1</div><div>endif</div><div>endif</div><div>endif</div><div>endif</div><div>i=i+1</div><div>endwhile</div><div>j=j+1</div><div>endwhile</div><div>say n1</div><div>say n2</div><div>say n3</div><div>say n4</div>
</div>
<div>'close 1'</div><div><br></div><div>Or is anyother method available for making contingency tables for forecast verification with grads?</div><div><br></div><div>Please let me know.</div><div><br></div><div>Regards</div>
<div>Amulya Chevuturi</div><div><br></div><div><br></div></div>
<br></div></div>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</div></div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br></div>