<div dir="ltr"><div><div><div>Matt,<br></div>The &#39;define&#39; statement doesn&#39;t work that way in Grads. &quot;define&quot; only defines a (possibly) multidimensional field based on the dimension environment and your data arrays. It is not used to define new script variables. So how you proceed here depends on what you want to do. But to get around the immediate issue, don&#39;t use &quot;define&quot; or any quotes (since the use of quotes implies a command issued at the prompt, which many script functions do not operate in).<br><br></div>Jeff<br><br></div>P.S. I see you responded to another response and got it to work, but I feel the above information will be helpful in avoiding similar issues in the future.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 6, 2017 at 11:00 AM, Matt Bunkers - NWS Rapid City <span dir="ltr">&lt;<a href="mailto:matthew.bunkers@noaa.gov" target="_blank">matthew.bunkers@noaa.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jeff,<br><br>I think you helped me narrow it down.  Here is a snippet of my code:<div><br></div><div><div>say &#39;  BUFawips = &#39; BUFawips</div><div>rc = valnum(BUFawips)</div><div>say &#39;  rc = &#39; rc</div><div><br></div><div>&#39;set lat 45.6043&#39;</div><div>&#39;set lon -103.5469&#39;</div><div>&#39;d totalQPE/25.4&#39;</div><div>line1=sublin(result,1)</div><div>BUFqpe=subwrd(line1,4)</div><div>say &#39;  BUFqpe = &#39; BUFqpe</div><div>rc = valnum(BUFqpe)</div><div>say &#39;  rc = &#39; rc</div><div><br></div><div>&#39;define BUFratio=&#39;BUFawips&#39;/&#39;BUFqpe&#39;&#39;</div><div>say &#39;  BUFratio = &#39; BUFratio</div><div>rc = valnum(BUFratio)</div><div>say &#39;  rc = &#39; rc</div></div><div><br></div><div>and here is the output:</div><div><br></div><div><div>  BUFawips = 2.23</div><div>  rc = 2</div><div>  BUFqpe = 4.96543</div><div>  rc = 2</div><div>  BUFratio = BUFratio</div><div>  rc = 0</div></div><div><br></div><div>So it looks like my last part is where I&#39;m failing.  Any thoughts on what I&#39;m doing wrong with my &quot;define&quot; statement?</div><div><br>Thanks,</div><div><br></div><div>-- Matt</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 5, 2017 at 3:01 PM, Jeff Duda <span dir="ltr">&lt;<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Matt,<br></div>Is it possible you are getting non-numeric characters stored in the variable? You say Grads prints 2.19, but are there any spaces or hidden characters that could be mixed in there? One way to check what&#39;s going on is to run valnum(<i>var</i>). It should return a value of 2 for your variables. If it returns 0 then it thinks <i>var</i> is a string. Once you know that it might help you troubleshoot further. For example, try say &quot;_&quot;var&quot;_&quot; to bracket the variable with underscores. That will tell you pretty quickly if and how many spaces are also located in the variable. That&#39;s my guess as to what&#39;s going on.<br><br></div>Jeff Duda<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 5, 2017 at 3:53 PM, Matt Bunkers - NWS Rapid City <span dir="ltr">&lt;<a href="mailto:matthew.bunkers@noaa.gov" target="_blank">matthew.bunkers@noaa.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I have a text file with numbers that I&#39;m reading into GrADS and then I want to perform calculations with them.  However, the numbers I&#39;m reading won&#39;t work and I get an error that says I have non-numeric args to a numeric operations, even though when I print my variable it shows 2.19.</div><div><br></div><div>I&#39;ve tried both of these options:</div><div><br></div><div>&#39;define BUFratio=&#39;BUFawips&#39;/&#39;BUFqpe&#39;&#39;<br></div><div>BUFratio=&#39;BUFawips&#39;/&#39;BUFqpe&#39;<br></div><div><br></div><div>Is there a command I can use to convert my &quot;2.19&quot; string to a number that can be used in calculations?</div><div><br></div><div>Thanks,<br></div><div><br></div><div>-- Matt</div><div><br></div></div>
<br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/li<wbr>stinfo/gradsusr</a><br>
<br></blockquote></div><span class="m_-3415404227783411579HOEnZb"><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><br>-- <br><div class="m_-3415404227783411579m_8687371025285732305gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research fellow<br>University of Oklahoma School of Meteorology<br></div></div></div></div></div>
</font></span></font></span></div><span class="HOEnZb"><font color="#888888">
<br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/li<wbr>stinfo/gradsusr</a><br>
<br></font></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/<wbr>listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research fellow<br>University of Oklahoma School of Meteorology<br></div></div></div></div></div>
</div>