Meredith,<br>No problem. It took me awhile to figure out how to use functions like this, too.<br><br>If you have the standard script from the website script library (that begins like this:)<br><pre>function zinterp(field,zgrid,zlev)<br>
*----------------------------------------------------------------------<br>* <br>* Bob Hart (<a href="mailto:hart@ems.psu.edu">hart@ems.psu.edu</a>) / PSU Meteorology<br>* 3/4/1999<br>*<br>* GrADS function to interpolate within a 3-D grid to a specified<br>
* height level. Can also be used on non-pressure level data, such<br>* as sigma or eta-coordinate output where height is a function<br>* of time and grid level.<br></pre>then you need to put your call to the function outside of the code that contains the function (i.e., either before the first line that says "function zinterp(field,zgrid,zlev)" or after the last line "Return(interp)". The code says it will return to you a newly defined variable called "interp". Thus you will then want to display that variable. You can do it any of the ways suggested in the notes. One way I would suggest is:<br>
<br>'zinterp(temp,height,5000)'<br>'d interp'<br><br>See if following that method works.<br><br>Jeff<br><br><div class="gmail_quote">On Thu, Apr 21, 2011 at 3:25 PM, Meredith Croke <span dir="ltr"><<a href="mailto:mcroke@airdat.com">mcroke@airdat.com</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 link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks Jeff, </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I should have mentioned, initially I tried running zinterp from a script, but once that wasn’t working I was trying to trouble shoot on the command line. I tried your suggestion and put</span><span style="font-size: 10pt; color: rgb(31, 73, 125);"> </span><span style="font-size: 10pt;">'zinterp(tmpprs,hgtprs,5000)' <span style="color: rgb(31, 73, 125);">as the first line in the <a href="http://zinterp.gs" target="_blank">zinterp.gs</a> script, I then tried running a very short script that just opened a ctl file and ‘d zinterp(tmpprs,hgtprs,5000)’</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: rgb(31, 73, 125);">I again get the following error: </span></p><div class="im"><p class="MsoNormal"><span style="font-size: 10pt;">Syntax Error: Invalid Operand </span></p>
<p class="MsoNormal"><span style="font-size: 10pt;"> 'zinterp' not a variable or function name</span></p><p class="MsoNormal"><span style="font-size: 10pt;"> Error ocurred at column 1</span></p><p class="MsoNormal">
<span style="font-size: 10pt;">DISPLAY error: Invalid expression </span></p></div><p class="MsoNormal"><span style="font-size: 10pt;"> Expression = zinterp(tmprs,hgtprs,5000)</span></p><p class="MsoNormal"><span style="font-size: 10pt;"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: rgb(31, 73, 125);">I also tried putting ‘zinterp(tmpprs,hgtprs,5000)’ on the second line of <a href="http://zinterp.gs" target="_blank">zinterp.gs</a> (under function zinterp(field,zgrid,zlev)) and got the same error.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: rgb(31, 73, 125);">Not sure what I’m missing.</span></p><p class="MsoNormal"><span style="font-size: 10pt; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal">
<span style="font-size: 10pt; color: rgb(31, 73, 125);">Thanks for the help,</span></p><p class="MsoNormal"><span style="font-size: 10pt; color: rgb(31, 73, 125);">Meredith</span></p><p class="MsoNormal"><span style="font-size: 10pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a> [mailto:<a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a>] <b>On Behalf Of </b>Jeffrey Duda<br>
<b>Sent:</b> Thursday, April 21, 2011 3:45 PM<br><b>To:</b> GrADS Users Forum<br><b>Subject:</b> Re: [gradsusr] <a href="http://zinterp.gs" target="_blank">zinterp.gs</a></span></p><div><div></div><div class="h5"><p class="MsoNormal">
</p><p class="MsoNormal" style="margin-bottom: 12pt;">Meredith,<br>To my knowledge, you can't run a function from the Grads command prompt. Instead, you need to put in a call to it inside a script that contains the function code. Thus, just put the line 'zinterp(tmpprs,hgtprs,5000)' as the first line of code in the <a href="http://zinterp.gs" target="_blank">zinterp.gs</a> script file.<br>
<br>Jeff Duda</p><div><p class="MsoNormal">On Thu, Apr 21, 2011 at 2:02 PM, Meredith Croke <<a href="mailto:mcroke@airdat.com" target="_blank">mcroke@airdat.com</a>> wrote:</p><p class="MsoNormal" style="margin-bottom: 12pt;">
Hi Grads Users,<br><br><br><br>I'm trying to use the <a href="http://zinterp.gs" target="_blank">zinterp.gs</a> function to determine the 6km wind from<br>model data that is output on pressure levels, however I'm running into<br>
some issues with <a href="http://zinterp.gs" target="_blank">zinterp.gs</a>.<br><br><br><br>To test the function I am attempting to run it from the command line and<br>follow the samples in the script, so I have tried<br>
<br>'d zinterp(tmpprs,hgtprs,5000)', to display a temperature field at 5000,<br>however I receive this error:<br><br>Syntax Error: Invalid Operand<br><br> 'zinterp' not a variable or function name<br><br>
Error ocurred at column 1<br><br>DISPLAY error: Invalid expression<br><br> Expression = zinterp(tmpprs,hgtprs,5000)<br><br><br><br>The function is in my directory, what else do I need to do to get this<br>to work?<br><br>
I am using grads v1.9b4<br><br><br><br>Thanks for your help.<br><br><br><br>Regards,<br><span style="color: rgb(136, 136, 136);"><br><br><br>Meredith<br><br><br><br></span><br>_______________________________________________<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></p>
</div><p class="MsoNormal"><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/%7Ejdduda" target="_blank">www.meteor.iastate.edu/~jdduda</a></p>
</div></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><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>