[gradsusr] zinterp.gs

Jeffrey Duda jdduda at iastate.edu
Thu Apr 21 16:51:40 EDT 2011


Meredith,
No problem.  It took me awhile to figure out how to use functions like this,
too.

If you have the standard script from the website script library (that begins
like this:)

function zinterp(field,zgrid,zlev)
*----------------------------------------------------------------------
*
* Bob Hart (hart at ems.psu.edu) /  PSU Meteorology
* 3/4/1999
*
* GrADS function to interpolate within a 3-D grid to a specified
* height level.  Can also be used on non-pressure level data, such
* as sigma or eta-coordinate output where height is a function
* of time and grid level.

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:

'zinterp(temp,height,5000)'
'd interp'

See if following that method works.

Jeff

On Thu, Apr 21, 2011 at 3:25 PM, Meredith Croke <mcroke at airdat.com> wrote:

> Thanks Jeff,
>
> 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 'zinterp(tmpprs,hgtprs,5000)' as
> the first line in the zinterp.gs script, I then tried running a very short
> script that just opened a ctl file and ‘d zinterp(tmpprs,hgtprs,5000)’
>
> I again get the following error:
>
> Syntax Error:  Invalid Operand
>
>   'zinterp' not a variable or function name
>
>   Error ocurred at column 1
>
> DISPLAY error:  Invalid expression
>
>   Expression = zinterp(tmprs,hgtprs,5000)
>
>
>
> I also tried putting ‘zinterp(tmpprs,hgtprs,5000)’ on the second line of
> zinterp.gs (under function zinterp(field,zgrid,zlev)) and got the same
> error.
>
> Not sure what I’m missing.
>
>
>
> Thanks for the help,
>
> Meredith
>
>
>
>
>
> *From:* gradsusr-bounces at gradsusr.org [mailto:
> gradsusr-bounces at gradsusr.org] *On Behalf Of *Jeffrey Duda
> *Sent:* Thursday, April 21, 2011 3:45 PM
> *To:* GrADS Users Forum
> *Subject:* Re: [gradsusr] zinterp.gs
>
>
>
> Meredith,
> 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 zinterp.gs script file.
>
> Jeff Duda
>
> On Thu, Apr 21, 2011 at 2:02 PM, Meredith Croke <mcroke at airdat.com> wrote:
>
> Hi Grads Users,
>
>
>
> I'm trying to use the zinterp.gs function to determine the 6km wind from
> model data that is output on pressure levels, however I'm running into
> some issues with zinterp.gs.
>
>
>
> To test the function I am attempting to run it from the command line and
> follow the samples in the script, so I have tried
>
> 'd zinterp(tmpprs,hgtprs,5000)', to display a temperature field at 5000,
> however I receive this error:
>
> Syntax Error:  Invalid Operand
>
>  'zinterp' not a variable or function name
>
>  Error ocurred at column 1
>
> DISPLAY error:  Invalid expression
>
>  Expression = zinterp(tmpprs,hgtprs,5000)
>
>
>
> The function is in my directory,  what else do I need to do to get this
> to work?
>
> I am using grads v1.9b4
>
>
>
> Thanks for your help.
>
>
>
> Regards,
>
>
>
> Meredith
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> --
> Jeff Duda
> Iowa State University
> Meteorology Graduate Student
> 3134 Agronomy Hall
> www.meteor.iastate.edu/~jdduda <http://www.meteor.iastate.edu/%7Ejdduda>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Iowa State University
Meteorology Graduate Student
3134 Agronomy Hall
www.meteor.iastate.edu/~jdduda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110421/2aa49e67/attachment.html 


More information about the gradsusr mailing list