[gradsusr] Lifted Index Formula
Mike Manning
michael at bsch.au.com
Fri Mar 2 04:12:53 EST 2012
Thanks Jeff I'll give that a go :)
Cheers, Mike
On 2/03/2012 2:25 AM, Jeff Duda wrote:
> You've confused the different uses of scripting functions vs. Grads
> prompt functions. You can only display a variable that you have
> defined using the 'define ...' command (note the use of the quotes
> signaling that it was defined as if you typed it in at the Grads
> prompt). Your use of variable = satvap(...) with satvap being a
> script function only is causing Grads to assume variable is a script
> variable only, not one that can be displayed. The reason you get the
> other error when you put the other line in quotes is because math_exp
> is strictly a script version of the exp function that you would use in
> the Grads command prompt. Thus, you would want to change that line to
>
> 'es = 6.112*exp(17.67*temp/(temp+243.5))'
>
> in order to display es or define any other variables that would depend
> on it.
>
> Jeff Duda
>
> On Thu, Mar 1, 2012 at 7:06 AM, Mike Manning <michael at bsch.au.com
> <mailto:michael at bsch.au.com>> wrote:
>
> Hi everyone,
>
> I'm using data from the FNMOC model and am trying to make a function
> that calculates Lifted Index. I'm using bits of the code from the
> plotskew.gs <http://plotskew.gs> code. So far I've got the
> temperature (celsius) and
> dewpoint (celsius) worked out for each level. Now I'm calculating the
> parcel details.. I've pulled some of the functions and have just been
> testing to make sure I'm on the right track. If I have this code for
> example:
>
> 'c'
> 'reinit'
> 'open gfs.00z.ctl'
> 'set t 7'
> 'set lon 135 155'
> 'set lat -31 -10'
>
> 'set lev 1000'
> 't1000mb = TMPprs-273.14'
> 'define dp1000mb =
> t1000mb-((14.55+0.114*t1000mb)*(1-0.01*RHprs)+pow((2.5+0.007*t1000mb)*(1-0.01*RHprs),3)+(15.9+0.117*t1000mb)*pow((1-0.01*RHprs),14))'
>
> variable = satvap2(t1000mb)
>
> 'd variable'
>
> function satvap2(temp)
>
> *---------------------------------------------------------------
> * Given temp in Celsius, returns saturation vapor pressure in mb
> *---------------------------------------------------------------
>
> es=6.112*math_exp(17.67*temp/(temp+243.5))
>
> return(es)
> 'quit'
>
>
>
> it complains about an error? If I put the code in the satvap2 function
> in single quotes it then says "math_exp" is not a variable or
> function"?
> I'm a little lost on how to fix this one up if it's possible.
>
> Cheers, Mike
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> --
> Jeff Duda
> Graduate research assistant
> University of Oklahoma School of Meteorology
> Center for Analysis and Prediction of Storms
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120302/b2d5c0a1/attachment-0003.html
More information about the gradsusr
mailing list