[ncl-talk] calculate a variable from other wrf variables and plot it
Agud Pique, Enric
eagud.q at ccma.cat
Sat May 28 01:26:24 MDT 2016
Hello Mary,
I get this error
[Enric at meteo em_real]$ ncl plot2.ncl
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
fatal:syntax error: line 15 in file plot2.ncl before or near =
relhum =
-------^
fatal:error in statement
fatal:Syntax Error in block, block not executed
fatal:error at line 66 in file plot2.ncl
Best, thank you
________________________________
De: Agud Pique, Enric
Enviat el: dissabte, 28 / maig / 2016 09:25
Per a: Mary Haley
A/c: ncl-talk at ucar.edu
Tema: RE: [ncl-talk] calculate a variable from other wrf variables and plot it
Hello Mary,
I get this error
[Enric at meteo em_real]$ ncl plot2.ncl
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
fatal:syntax error: line 15 in file plot2.ncl before or near =
relhum =
-------^
fatal:error in statement
fatal:Syntax Error in block, block not executed
fatal:error at line 66 in file plot2.ncl
________________________________
De: Mary Haley [haley at ucar.edu]
Enviat el: dissabte, 28 / maig / 2016 00:03
Per a: Agud Pique, Enric
A/c: ncl-talk at ucar.edu
Tema: Re: [ncl-talk] calculate a variable from other wrf variables and plot it
Does running the script produce an error message? If so, please email the exact error message.
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.
If there'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).
Thanks,
--Mary
On Fri, May 27, 2016 at 1:33 PM, Agud Pique, Enric <eagud.q at ccma.cat<mailto:eagud.q at ccma.cat>> wrote:
Hello people,
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?
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
a = addfile("./wrfout_d01_2016-05-24_18:00:00","r")
wks = gsn_open_wks("X11","plt_Surface")
tc = wrf_user_getvar(a,"tc",0)
p = wrf_user_getvar(a,"pressure",0)
rh = wrf_user_getvar(a,"rh",0)
pressure = 850.
res = True
tempC = wrf_user_intrp3d(tc,p,"h",850.,0.,res)
relhum= wrf_user_intrp3d(rh,p,"h",850.,0.,res)
pltres = True
mpres = True
opts = res
opts at cnFillOn = True
opts at cnLevelSelectionMode = "ExplicitLevels"
;-----------------------------------------
; Calculate Theta E
;-----------------------------------------
undef("calc_thetae")
function calc_thetae(tempC,pres,relhum)
local tempC, pres, relhum, tc, tk, pp, p0, rh, es, en, rv, rd, cp, kd, td, tl, thetal, thetae
begin
pres = 850.
Tc = tempC ; [C]
tk = tempC+273.15 ; [K]
pp = pres ; [hPa]
p0 = 1000 ; [hPa]
rh = relhum/100 ; [no dimensions]
es = 6.112*exp(17.67*Tc/(Tc+243.5)) ; [hPa]
en = rh*es ; [hPa]
rv = 0.622*en/(pp-en) ; [no dimensions]
rd = 287.04 ; [J/kgK]
cp = 1005.7 ; [J/kgK]
kd = rd/cp ; [no dimensions]
tl = (1/((1/(tk-55))-(log(rh)/2840)))+55 ; [K]
thetal = tk*((p0/(pp-en))^kd)*((tk/tl)^(0.28*rv)) ; [K]
thetae = thetal*exp(((3036/tl)-1.78)*rv*(1+0.448*rv)) ; [K]
thetae = thetae-273.15 ; [C]
return(thetae)
end
contour_t2 = wrf_contour(a,wks,thetae,opts)
plot= wrf_map_overlays(a,wks,(/contour_t2/),pltres ,mpres)
end
Best
Enric
De: Agud Pique, Enric
Enviat: dimarts, 24 / maig / 2016 21:17
Per a: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Tema: get some variables from wrf output
Hello people,
I would like to use wrf_user_getvar or another function in order to get from a wrf filet he following variables:
Temperature on 850 hPa-Level in ºC,
Geopotential height on 850 hPa-Level
Relative humidity on 850 hPa-Level
I know how to get the temperature on T2
T2 = wrf_user_getvar(a,"T2",0)
where a is the wrf file...but in 850hPa?
Thank you
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160528/2cf46dbb/attachment.html
More information about the ncl-talk
mailing list