<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'>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: ela@cola.iges.org<br>Phone: (703) 993-5725<br>Fax: (703) 993-5770</div><span name="x"></span><br></div><br><hr id="zwchr"><b>From: </b>"Amulya Chevuturi" <amulya.chevuturi@gmail.com><br><b>To: </b>"GrADS Users Forum" <gradsusr@gradsusr.org><br><b>Sent: </b>Wednesday, April 30, 2014 12:18:33 AM<br><b>Subject: </b>[gradsusr] Contingency Table<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>_______________________________________________<br>gradsusr mailing list<br>gradsusr@gradsusr.org<br>http://gradsusr.org/mailman/listinfo/gradsusr<br></div></div></body></html>