Chuck,<br>Thank you for introducing me to the 'set defval' command. I had been using Grads under the assumption that you couldn't define a new field grid point by grid point. Now I see that you can! This actually makes Meredith's problem more tractable. Again, all she needs to do is compute the parcel path (temperature) at each grid point (you might have to make a new variable at each grid point called t_p for "temperature of parcel"). If she can do that, then defining the LFC at each point could be done.<br>
<br>Jeff Duda<br><br><div class="gmail_quote">On Thu, Apr 21, 2011 at 2:16 PM, Charles Seman <span dir="ltr"><<a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</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;">
Following Jeff Duda's idea for getting the LFC...<br>
<br>
I'm not sure if this would work, but perhaps you could use "defval" to<br>
re-define a GrADS 2D LFC field initially defined to "undef"...<br>
<br>
here is some GrADS pseudo-code for a single time-level, NOT TESTED, that<br>
you may be able to adapt?<br>
<br>
'open 'your_GrADS_ctl_file<br>
<br>
* find "nx" and "ny"...<br>
<br>
'query file'<br>
say<br>
say result<br>
rec5 = sublin(result,5)<br>
nx = subwrd(rec5,3) ; ny = subwrd(rec5,6) ; nz = subwrd(rec5,9) ; nt =<br>
subwrd(rec5,12)<br>
<br>
'set x 1 'nx<br>
'set y 1 'ny<br>
'set z 1'<br>
'set t 1'<br>
<br>
* initialize LFC field variable to "undef" using<br>
"a_GrADS_ctl_file_2D_var" from "your_GrADS_ctl_file"...<br>
<br>
* define maskoutfield = -1 everywhere to use maskout() define a new<br>
"LFC" field = undef everywhere<br>
<br>
'maskoutfield = const(a_GrADS_ctl_file_2D_var,-1,-a)'<br>
'undef = maskout(a_GrADS_ctl_file_2D_var,maskoutfield)'<br>
'LFC = undef'<br>
'set x 1' ; 'set y 1' ; 'd undef' ; undef_value = subwrd(result,4)<br>
<br>
yy=1<br>
while ( yy <= ny )<br>
xx=1<br>
while ( xx <= nx )<br>
'set x 'xx<br>
'set y 'yy<br>
<br>
* load a sounding for this (x,y) point and<br>
* use some GrADS code to calculate LFC<br>
* note, LFC may not exist and if it doesn't<br>
* don't redefine LFC variable at this point (remains undefined)...<br>
<br>
LFC_value = undef_value ; initialize LFC_value for this (x,y) point to<br>
"undef" value<br>
<br>
...do calculations to update "LFC_value" if possible<br>
<br>
if ( LFC_value != undef_value )<br>
<br>
* use "defval" to redefine LFC for this point in 2D field using LFC_value<br>
<br>
'set defval LFC 'xx' 'yy' 'LFC_value<br>
<br>
endif<br>
<br>
xx=xx+1<br>
endwhile<br>
yy=yy+1<br>
endwhile<br>
<br>
I hope this helps... please let me know if you have any questions on the<br>
above GrADS pseudo-code...<br>
<br>
Chuck<br>
<br>
<br>
Jeffrey Duda wrote:<br>
> Unless you're using OpenGrads, which might allow for defining a variable<br>
> by grid point, you probably can't compute LFC height in any direct way.<br>
> If you were somehow able to compute a vertical parcel path at each<br>
> gridpoint, however, you could then use the fndlvl command<br>
> (<a href="http://www.iges.org/grads/gadoc/gradfuncfndlvl.html" target="_blank">http://www.iges.org/grads/gadoc/gradfuncfndlvl.html</a>) to find the first<br>
> vertical level at which the parcel temperature exceeds the environmental<br>
> temperature. It's the first part that I can't think of a way to do.<br>
><br>
> If you are dealing with WRF output and you have the netCDF files, you<br>
> can run ARWpost or WPP on them to get LFC calculated. Otherwise you<br>
> might try using some other graphics software. Sorry I can't be of more<br>
> help.<br>
><br>
> Jeff Duda<br>
><br>
> On Wed, Apr 20, 2011 at 9:39 AM, Meredith Croke <<a href="mailto:mcroke@airdat.com">mcroke@airdat.com</a><br>
> <mailto:<a href="mailto:mcroke@airdat.com">mcroke@airdat.com</a>>> wrote:<br>
><br>
> Hi Everyone,<br>
><br>
> I’m looking to plot a contour plot of LFC height, similar to the<br>
> graphic on the SPC Mesoscale Analysis page, my control file does not<br>
> output LFC directly, is there anyway I can calculate this in grads?<br>
><br>
><br>
><br>
> Thanks for your help.<br>
><br>
><br>
><br>
> Meredith<br>
><br>
><br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a> <mailto:<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>
><br>
><br>
><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> <<a href="http://www.meteor.iastate.edu/%7Ejdduda" target="_blank">http://www.meteor.iastate.edu/~jdduda</a>><br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><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>
--<br>
<br>
Please note that <a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a> should be considered my NOAA<br>
email address, not <a href="mailto:cjs@gfdl.noaa.gov">cjs@gfdl.noaa.gov</a>.<br>
<br>
********************************************************************<br>
Charles Seman <a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a><br>
U.S. Department of Commerce / NOAA / OAR<br>
Geophysical Fluid Dynamics Laboratory voice: <a href="tel:%28609%29%20452-6547" value="+16094526547">(609) 452-6547</a><br>
201 Forrestal Road fax: <a href="tel:%28609%29%20987-5063" value="+16099875063">(609) 987-5063</a><br>
Princeton, NJ 08540-6649 <a href="http://www.gfdl.noaa.gov/%7Ecjs/" target="_blank">http://www.gfdl.noaa.gov/~cjs/</a><br>
********************************************************************<br>
<br>
"The contents of this message are mine personally and do not reflect any<br>
official or unofficial position of the United States Federal Government,<br>
the United States Department of Commerce, or NOAA."<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>
</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>