Dear Dennis,
I am trying to interpolate the vertical velocity output from WRF to a specified isentropic level (e.g., 307 K surface),
but I got a warning message:
"fatal:Dimension (bottom_top) of (xlvl) does not have an associated coordinate variable"
Here is my code:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("./wrfout_d03_2011-06-13_18_00_00.nc","r")
; We generate plots, but what kind do we prefer?
; type = "x11"
; type = "pdf"
type = "eps"
; type = "ncgm"
wks = gsn_open_wks(type,"isent")
;gsn_define_colormap(wks,"isent") ; Overwrite the standard color map
; Set some basic resources
res = True
res@MainTitle = "REAL-TIME WRF"
res@mpDataBaseVersion = "HighRes"
res@mpDataSetName = "Earth..4"
res@mpGridAndLimbOn = False ; Turn off lat/lon lines
res@mpOutlineOn = True ; Turn on map outlines
;res@mpGeophysicalLineColor = "Black" ; Change the outline line color
res@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
res@mpOutlineSpecifiers = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Which times and how many time steps are in the data set?
times = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
;Zoom
lats = (/ 27.7, 29.7 /)
lons = (/ 115.5, 119.5 /)
loc = wrf_user_ll_to_ij(a, lons, lats, True)
; loc(0,;) is west-east (x) ; loc(1,:) is south-north (y)
; subtract one since we want to use it as an index in NCL
x_start = loc(0,0) - 1
x_end = loc(0,1) - 1
y_start = loc(1,0) - 1
y_end = loc(1,1) - 1
res@mpMinLatF = lats(0)
res@mpMaxLatF = lats(1)
res@mpMinLonF = lons(0)
res@mpMaxLonF = lons(1)
;do it = 25,ntimes-1 ; TIME LOOP
do it = 22, 25
print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots
; First get the variables we will need
theta= wrf_user_getvar(a,"theta",it)
x = wrf_user_getvar(a,"wa",it)
lvl = (/ 307. /)
lvl@description = "isentropic level"
lvl@units = theta@units
lvl!0 = "lvl"
lvl&lvl = lvl
xlvl = int2p_n_Wrap (theta, x, lvl, 0, 1)
xlvl@lat2d = a->XLAT(0,:,:) ; direct assignment
xlvl@lon2d = a->XLONG(0,:,:)
printVarSummary(xlvl)
printMinMax(xlvl, 0)
res@cnFillOn = True ;automatically creates a color bar.
res@ContourParameters = (/ 0.1, 1.3, 0.3/) ; (/ start, end, step /)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
plot = gsn_csm_contour_map(wks,xlvl({lvl(0)},y_start:y_end,x_start:x_end),res)
end do ; END OF TIME LOOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end
------------------ 原始邮件 ------------------
发件人: "Dennis Shea";<shea@ucar.edu>;
发送时间: 2014年7月7日(星期一) 晚上10:00
收件人: "Li Qi"<liqi123sh@qq.com>;
抄送: "ncl-talk"<ncl-talk@ucar.edu>; "wrfhelp"<wrfhelp@ucar.edu>;
主题: Re: [ncl-talk] interpolate WRF output to isentropic levels
It is the exact same approach as outlined at
http://www.ncl.ucar.edu/Applications/isent.shtml,%e2%80%8d
Even easier because wrf_user_getvar returns theta.
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
a = addfile("...","r")
time = -1
theta= wrf_user_getvar(a,"theta",time)
printVarSummary(theta)
x = wrf_user_getvar(a,"tc" ,time)
printVarSummary(x)
printMinMax(x, 0)
; isentropic level(s)
lvl = 320. ; (/300., 320., 340./)
lvl@description = "isentropic level"
lvl@units = theta@units
xlvl = int2p_n_Wrap (theta, x, lvl, 0, 1)
printVarSummary(xlvl)
print("xlvl: min="+min(xlvl)+" max="+max(xlvl))
-----
Please send WRF related questions to wrfhelp@ucar.edu
You can cc ncl-talk@ucar.edu
On Sun, Jul 6, 2014 at 8:35 PM, Li Qi <liqi123sh@qq.com> wrote:
Dear all,
I'd like to interpolate a variable in WRF output to a specified isentropic level.
GrADS has a function (i.e., isen(field,tgrid,pgrid,tlev)) to complete the task, like
* 1) Display vertical velocity field on 320K surface:
*
* "d "isen(w,t,PP,320)
Is there any corresponding function in NCL?
I've checked the examples and got this one: http://www.ncl.ucar.edu/Applications/isent.shtml,%e2%80%8d
but I have no idea about the hybrid coef in WRF.
Best,
Li Qi
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 09 08:01:22 2014
This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT