<pre style="font-family:SimSun;white-space:pre-wrap;"><i>Hello Everyone </i></pre>
<pre style="font-family:SimSun;white-space:pre-wrap;"><i> </i></pre>
<pre style="font-family:SimSun;white-space:pre-wrap;"><i>I use ncl 6.6.2 when I deal with wrfout_* files </i><i> generated by WRF, I have this problem: </i></pre>
<pre style="font-family:SimSun;white-space:pre-wrap;"><span style="font-family:SimSun;">I want to draw a cross section of the potential temperature between any two points (longitude and latitude). I have drawn a figure based on the example of "http://www.ncl.ucar.edu/applications/scripts/wrf'interp'3.ncl"(wrf_user_vert_cross). </span></pre>
<pre style="font-family:SimSun;white-space:pre-wrap;"><span style="font-family:SimSun;">But there is no value below 200m in the figure:</span> <span style="font-family:SimSun;"> </span> </pre>
<pre style="font-family:SimSun;white-space:pre-wrap;"><span style="font-family:SimSun;"> </span> <img src="cid:29c8da0d$1$16df27f5533$Coremail$1801111815$pku.edu.cn" width="500" height="500" title="" align="" alt=""></pre>
<pre style="font-family:SimSun;white-space:pre-wrap;">
<pre style="white-space:pre-wrap;"><i>Here is my code:</i></pre>
<pre style="white-space:pre-wrap;"><i>;----------------------------------------------------------------------
; wrf_interp_3.ncl
;----------------------------------------------------------------------
; Concepts illustrated:
; - Interpolating a vertical cross-section from a 3D WRF-ARW field.
;----------------------------------------------------------------------
; wrf_user_vert_cross and wrf_user_interp_level replace the
; deprecated wrf_user_intrp3d function.
;
; NCL V6.6.0 or higher is required to run this example.
;----------------------------------------------------------------------
begin
filename = "/home/jxp/wrfout_d02_2017120215"
a = addfile(filename,"r")
z = wrf_user_getvar(a, "z",0)
dim = dimsizes(z)
all_n=dim(0) ;time
all_k=dim(1) ;south-north
all_j=dim(2) ;west-east
hgt0 = wrf_user_getvar(a,"ter",0)
zag0=new((/all_n,all_k,all_j/),"float") ;z above ground
hgt2=new((/all_n,all_k,all_j/),"float") <span style="white-space:pre;"> </span>do n=0,all_n-1 <span style="white-space:pre;"> </span>hgt2(n,:,:)=hgt0 <span style="white-space:pre;"> </span>end do <span style="white-space:pre;"> </span>zag0 = z-hgt2 <span style="white-space:pre;"> </span>printVarSummary(zag0)
th = wrf_user_getvar(a, "th",0) ; theta k
loc = wrf_user_ll_to_ij(a,116.21,39.28,True)
print(th(:,loc(1),loc(0)))
print(zag0(:,loc(1),loc(0)))
lats = wrf_user_getvar(a, "lat",0)
lons = wrf_user_getvar(a, "lon",0)
start_lat = 38.625
end_lat = 39.982
start_lon = 116.61
end_lon = 115.782
opt = True
opt@latlon = True
opt@linecoords = True
opt@file_handle = a
th_latlon = wrf_user_vert_cross(th,zag0,(/start_lon,start_lat,end_lon,end_lat/),opt)
; printVarSummary(th) ; [bottom_top | 31] x [south_north | 546] x [west_east | 480]
; printVarSummary(th_latlon) ; [vertical | 100] x [cross_line_idx | 171]
wks = gsn_open_wks("png","wrf_interp2017120215")
res = True
res@gsnMaximize = True ; maximize plot in frame
res@cnFillOn = True ; turn on contour fill
res@cnLinesOn = True ; turn off contour lines
res@cnLineLabelsOn = True ; turn off line labels
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = 276
res@cnMaxLevelValF = 285
res@cnLevelSpacingF = 0.5
res@lbOrientation = "Vertical"
res@lbLabelFontHeightF = 0.01
res@tiMainString = "Cross section from ("+start_lat+","+start_lon+ \
") to ("+end_lat + ","+end_lon+")"
res@gsnStringFontHeightF = 0.015
res@tmXBLabelFontHeightF = 0.01
res@tmXBLabelAngleF = 45.
res@tmYLMode = "Explicit"
res@tmYLLabels = (/0, 200, 400, 600, 800, 1000/)
res@trYMinF = 0;ymin
res@trYMaxF = 1000;ymax
;--Explicitly set lat/lon labels for X axis
xvalues = ispan(0,dimsizes(th_latlon(0,:))-1,1)
ll_step = 15 ; step interval for tickmarks
res@tmXBMode = "Explicit"
res@tmXBValues = xvalues(::ll_step)
res@tmXBLabels = sprintf("%6.2f",th_latlon@lats(::ll_step)) + "~S~o~N~N~C~" + \
sprintf("%6.2f",th_latlon@lons(::ll_step)) + "~S~o~N~E"
<span style="white-space:pre;"> </span>
plot = gsn_csm_contour(wks,th_latlon,res)
end
<div style="white-space:nowrap;">
</div>
<pre style="white-space:pre-wrap;"><i>What's wrong with my code? Why there is no value below 200m in the figure?</i></pre>
<pre style="white-space:pre-wrap;"><i>Thank you!</i></pre>
<pre style="white-space:pre-wrap;"><i> </i></pre>
<pre style="white-space:pre-wrap;"><i>Xipeng Jin</i></pre>
<br>
</i></pre>
</pre>