Hi,
I'm trying to produce a number of vertical cross-sections and have two
somewhat generic questions about display options:
1. My vertical (y-) axis is writing the height labels over top one
another in the lowest position (see attached image), and I can't figure
out why/how to fix it?
2. Is there a way to control how the model terrain gets displayed in
these? Ideally I'd like to smooth it, shade it, etc, but I can't seem to
find the options to do something like this.
My script is copied below and a sample image is attached.
Thanks in advance for any insight you can pass along!
Kelly Mahoney
*****************************************************************************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
setvalues NhlGetWorkspaceObjectId()
"wsMaximumSize" : 100000000000
end setvalues
setfileoption("nc", "SuppressClose", False)
imgdir="./"
diri_past = "../WSM6_past/"
fils_past = systemfunc("ls "+diri_past+"wrfout_d02_1970*")+".nc"
;km printVarSummary(fils_past)
nf=3
f=addfile(fils_past(nf),"r")
times = wrf_user_list_times(f) ; get time(s) in the file
ntimes = dimsizes(times)
lat=f->XLAT(0,:,:)
lon=f->XLONG(0,:,:)
hgt=f->HGT(0,:,:)
dimll = dimsizes(lat) ; get size of dimensions
nlat = dimll(0)
mlon = dimll(1)
start_lat_ll = 39.3
start_lon_ll = -106.8
end_lat_ur = 39.3
end_lon_ur = -104.6
resll = True
resll@returnInt = True
start_loc = wrf_user_ll_to_ij(f,start_lon_ll,start_lat_ll,resll)
end_loc = wrf_user_ll_to_ij(f,end_lon_ur,end_lat_ur,resll)
print("start_loc = "+start_loc)
print("end_loc = "+end_loc)
; We generate plots, but what kind do we prefer?
type = "ps"
wks = gsn_open_wks(type,"xsect_hail_ex")
; Set some basic resources
res = True
res@MainTitle = "Vertical Cross-section: Hail"
res@Footer = False
gsn_define_colormap(wks,"prcp_1")
pltres = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FirstTime = True
mdims = getfilevardimsizes(f,"P") ; get some dimension sizes for the file
nd = dimsizes(mdims)
;---------------------------------------------------------------
print("Working on time: " + times(0) )
res@TimeLabel = times(0) ; Set Valid time to use on plots
tc = wrf_user_getvar(f,"tc",-1) ; T in C
rh = wrf_user_getvar(f,"rh",-1) ; relative humidity
z = wrf_user_getvar(f, "z",-1) ; grid point height
qg = wrf_user_getvar(f,"QGRAUP",-1)
if ( FirstTime ) then ; get height info for labels
zmin = 0.
zmax = max(z)/1000.
nz = floattoint(zmax/2 + 1)
FirstTime = False
end if
;---------------------------------------------------------------
; Plot a cross session that run from point A to point B
plane = new(4,float)
startx = start_loc(0)
starty = start_loc(1)
endx = end_loc(0)
endy = end_loc(1)
print("startx,starty = "+startx+", "+starty)
print("endx,endy = "+endx+", "+endy)
plane = (/ startx, starty, endx, endy /) ; start x;y & end x;y
point
opts = True ; start and
end points specified
rh_plane = wrf_user_intrp3d(rh,z,"v",plane,0.,opts)
tc_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)
qg_plane = wrf_user_intrp3d(qg,z,"v",plane,0.,opts)
printVarSummary(qg_plane)
printMinMax(qg_plane,True)
dim = dimsizes(rh_plane) ; Find the data
span - for use in labels
zspan = dim(0)
; Options for XY Plots
opts_xy = res
opts_xy@tiYAxisString = "Height (km)"
opts_xy@cnMissingValPerimOn = True
opts_xy@cnMissingValFillColor = 0
opts_xy@cnMissingValFillPattern = 11
opts_xy@tmYLMode = "Explicit"
opts_xy@tmYLValues =
fspan(0,zspan,nz) ; Create tick marks
opts_xy@tmYLLabels =
sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels
opts_xy@tiXAxisFontHeightF = 0.020
opts_xy@tiYAxisFontHeightF = 0.020
opts_xy@tmXBMajorLengthF = 0.02
opts_xy@tmYLMajorLengthF = 0.02
opts_xy@tmYLLabelFontHeightF = 0.015
opts_xy@PlotOrientation = tc_plane@Orientation
; Plotting options for QG
opts_qg = opts_xy
opts_qg@ContourParameters = (/ 0.0005, .006, .0005/)
opts_qg@pmLabelBarOrthogonalPosF = -0.07
opts_qg@cnFillOn = True
; Plotting options for Temperature
opts_tc = opts_xy
opts_tc@cnInfoLabelOrthogonalPosF = 0.00
opts_tc@ContourParameters = (/ 0.,1000.,100. /)
contour_tc = wrf_contour(f,wks,tc_plane(0,:,:),opts_tc)
contour_qg = wrf_contour(f,wks,qg_plane(0,:,:),opts_qg)
; MAKE PLOTS
plot = wrf_overlays(f,wks,(/contour_qg,contour_tc/),pltres)
delete(res)
end
exit
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT