<div dir="ltr"><div class="gmail_default" style="font-size:small">Does running the script produce an error message? If so, please email the exact error message.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I do see that you are imbedding a function inside the main code. I believe this is acceptable in NCL, but just to be sure, I need to see what your error message states.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If there&#39;s no error message, then describe in more detail what the problem is (i.e. if the plot is bad, describe how it is bad, and include an image if possible).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 27, 2016 at 1:33 PM, Agud Pique, Enric <span dir="ltr">&lt;<a href="mailto:eagud.q@ccma.cat" target="_blank">eagud.q@ccma.cat</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="CA" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="DE-CH" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">Hello people,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE-CH" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="DE-CH" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">I would like to plot a variable calculated from several wrf variables....for example, the following code....get temperature, pressure and relative
 humidity and after I select tempC and relhum in 850 hPa... after calculate Theta E, I want to plot it, but when I execute the scripts it fails...what is wrong?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE-CH" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="DE-CH" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl&quot;<br>
begin<br>
a = addfile(&quot;./wrfout_d01_2016-05-24_18:00:00&quot;,&quot;r&quot;)<br>
wks = gsn_open_wks(&quot;X11&quot;,&quot;plt_Surface&quot;)<br>
<br>
<br>
tc = wrf_user_getvar(a,&quot;tc&quot;,0)<br>
p = wrf_user_getvar(a,&quot;pressure&quot;,0)<br>
rh = wrf_user_getvar(a,&quot;rh&quot;,0)<br>
pressure = 850.<br>
res = True<br>
<br>
tempC = wrf_user_intrp3d(tc,p,&quot;h&quot;,850.,0.,res)<br>
relhum= wrf_user_intrp3d(rh,p,&quot;h&quot;,850.,0.,res)<br>
<br>
pltres = True<br>
mpres = True<br>
<br>
opts = res<br>
opts@cnFillOn = True<br>
opts@cnLevelSelectionMode = &quot;ExplicitLevels&quot;<br>
<br>
;-----------------------------------------<br>
; Calculate Theta E<br>
;-----------------------------------------<br>
<br>
<br>
undef(&quot;calc_thetae&quot;)<br>
<br>
function calc_thetae(tempC,pres,relhum)<br>
<br>
local tempC, pres, relhum, tc, tk, pp, p0, rh, es, en, rv, rd, cp, kd, td, tl, thetal, thetae<br>
<br>
begin<br>
pres = 850.<br>
Tc = tempC                                                          ; [C]<br>
tk = tempC+273.15                                                   ; [K]<br>
pp = pres                        ; [hPa]<br>
p0 = 1000                                        ; [hPa]<br>
rh = relhum/100                          ; [no dimensions]<br>
es = 6.112*exp(17.67*Tc/(Tc+243.5))                  ; [hPa]<br>
en = rh*es                                       ; [hPa]<br>
rv = 0.622*en/(pp-en)                  ; [no dimensions]<br>
rd = 287.04                          ; [J/kgK]<br>
cp = 1005.7                                    ; [J/kgK]<br>
kd = rd/cp                                 ; [no dimensions]<br>
tl = (1/((1/(tk-55))-(log(rh)/2840)))+55                 ; [K]<br>
thetal = tk*((p0/(pp-en))^kd)*((tk/tl)^(0.28*rv))        ; [K]<br>
thetae = thetal*exp(((3036/tl)-1.78)*rv*(1+0.448*rv))    ; [K]<br>
thetae = thetae-273.15                                              ; [C]<br>
return(thetae)<br>
end<br>
<br>
contour_t2 = wrf_contour(a,wks,thetae,opts)<br>
<br>
plot= wrf_map_overlays(a,wks,(/contour_t2/),pltres ,mpres)<br>
<br>
end<br>
<br>
</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal">Best<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Enric<u></u><u></u></p>
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">De:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Agud Pique, Enric
<br>
<b>Enviat:</b> dimarts, 24 / maig / 2016 21:17<br>
<b>Per a:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Tema:</b> get some variables from wrf output<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hello people,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I would like to use wrf_user_getvar or another function in order to get from a wrf filet he following variables:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Temperature on 850 hPa-Level in ºC,<u></u><u></u></span></b></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Geopotential height on 850 hPa-Level
<u></u><u></u></span></b></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Relative humidity on 850 hPa-Level
<u></u><u></u></span></b></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I know how to get the temperature on T2
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">T2 = wrf_user_getvar(a,&quot;T2&quot;,0)<br>
</span>where a is the wrf file...but in 850hPa?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you<u></u><u></u></p>
</div>
</div>

<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>