As far as I'm aware, you shouldn't have to explicitly convert in grads scripting. Just use your quotes correctly. Here's an example from a script I wrote to compute theta-e:<br><br>These constants are set as variables within the grads script only (i.e., they don't exist in the command window...I can't display Rv or Rd etc.). Thus they're regarded as constants or strings.<br>
<br>Rv = 461.5<br>Rd = 287.05<br>Cp = 1005<br>lv = 2.5e6<br><br>In the actual theta-e computation below, notice how the variables are used between single quotes so as not to be a part of a command that would otherwise be issued in the command window. This is all you should have to do to use a string as a number or vice versa.<br>
<br> 'tempK = tc + 273'<br> 'es = 6.11*exp((2.5e6/461.5)*((1/273) - (1/tempK)))'<br> 'e = qvapor*((p+pb)/100) / (qvapor + 0.622)'<br> 'equivt = tempK + 'Lv'*qvapor/'Cp'<br> 'thetae = equivt*pow(1000/slp,'Rd'/'Cp')'<br>
<br><br>I hope this helps, but ask more questions if it doesn't.<br><br>Jeff Duda<br><br><div class="gmail_quote">On Tue, Jan 4, 2011 at 1:24 PM, Murphy, Darren W <span dir="ltr"><<a href="mailto:dwmurphy@nps.edu">dwmurphy@nps.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
<font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 11pt;">I’d like to second this question. I am having the same issue. I think the Grads literature says that some commands can use a number as a string for calculations. However, when I try and use my number “string” in a max or min Grads function, it throws an error.<br>
<br>
Thanks,<br>
Darren<br>
<br>
<br>
On 1/4/11 6:45 AM, "qinglan" <<a href="http://qinglan@hku.hk" target="_blank">qinglan@hku.hk</a>> wrote:<br>
<br>
</span></font><blockquote><font size="2"><font face="Tahoma, Verdana, Helvetica, Arial"><span style="font-size: 10pt;">Dear All,<br>
<br>
</span></font></font><font size="4"><font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 14pt;">Is there anybody know how to convert a string to a real number in Grads? For example, if my string is ‘300.5’, I want to get the value of 300.5, which is a real number, how to do that?<br>
<br>
Really appreciate your help!<br>
Best regards,<br>
Qinglan Li<br>
</span></font></font><font size="2"><font face="Tahoma, Verdana, Helvetica, Arial"><span style="font-size: 10pt;"> <br>
</span></font></font><font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 11pt;"><br>
<hr size="3" width="95%" align="CENTER"></span></font><font size="2"><font face="Consolas, Courier New, Courier"><span style="font-size: 10pt;">_______________________________________________<br>
gradsusr mailing list<br>
<a href="http://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>
</span></font></font></blockquote>
</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><br clear="all"><br>-- <br>Jeff Duda<br>Iowa State University<br>Meteorology Graduate Student<br>3134 Agronomy Hall<br><a href="http://www.meteor.iastate.edu/~jdduda">www.meteor.iastate.edu/~jdduda</a><br>