[ncl-talk] overlaying a hodograph onto a sounding
Joe Grim
grim at ucar.edu
Mon Apr 9 14:33:26 MDT 2018
Hi,
Could someone please help me with a conceptual skewT + hodograph plot? My
hope is to create a skewT plot with a hodograph overlaid, much like what
you see from other skewT plots, such as this one:
http://weather.rap.ucar.edu/upper/dnr.gif. I couldn't find any examples on
the NCL website, so I thought I could create my own, but couldn't get it to
plot correctly.
Conceptually, I imagine the script would be created in this order:
1) Draw the background using skewT_BackGround
<https://www.ncl.ucar.edu/Document/Functions/Skewt_func/skewT_BackGround.shtml>
.
2) Draw the hodograph using gsn_csm_xy
<https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_xy.shtml>
- making sure to set gsnDraw and gsnFrame to False
- set vpXF, vpYF, vpWidthF, and vpHeightF to only plot in the
upper-lefthand side of the plot
3) Use the overlay procedure to overlay the two, like
this: overlay(skewt_bkgd,hodo_plot)
4) Draw the plot, like this: draw (skewt_bkgd)
5) Use the skewT_PlotData
<https://www.ncl.ucar.edu/Document/Functions/Skewt_func/skewT_PlotData.shtml>
to
overlay the skewT data.
6) Advance the frame: frame(wks)
I almost got it to work, except the hodograph only plots on the bottom of
the image the portion of the hodograph with positive V component (I assume
the rest is "off screen" below); I assume it is using the native coordinate
system of skewT_BackGround
<https://www.ncl.ucar.edu/Document/Functions/Skewt_func/skewT_BackGround.shtml>
instead
of having its own independent coordinate system.
Does anyone have any thoughts or ideas of how I can do this? Thanks!
Joe
P.S. Here is the current version of my code:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
begin
; Read in WRF data
in_file =
"/d3/ATEC/wrfout_misc/ATC/wrfout_d01_2017-09-02_05:00:00.ATC_P+FCST"
ncdf_in = addfile(in_file+".nc","r")
P_tot = wrf_user_getvar(ncdf_in,"pressure",0)
z_tot = wrf_user_getvar(ncdf_in,"z",-1)
U = wrf_user_getvar(ncdf_in,"U",-1)
U_unstag = wrf_user_unstagger(U,U at stagger)
V = wrf_user_getvar(ncdf_in,"V",-1)
V_unstag = wrf_user_unstagger(V,V at stagger)
TC = wrf_user_getvar(ncdf_in,"tc",-1)
TD = wrf_user_getvar(ncdf_in,"td",-1)
; Create skewT background
PlotType = "png"
PlotName = "Sounding_MartinAF"
wks = gsn_open_wks(PlotType,PlotName)
loc = wrf_user_ll_to_ij(ncdf_in,-76.42,39.33,True)
locX = loc(0) - 1
locY = loc(1) - 1
skewtOpts = True
skewtOpts at vpXF = 0.07 ; controls off-set from left
skewtOpts at vpYF = 0.92 ; controls off-set from top
skewtOpts at vpWidthF = 0.85 ; controls size of plot
skewtOpts at vpHeightF = 0.85 ; controls size of plot
skewtOpts at tiMainString = "Sounding at 39.33N, 76.42W"
skewt_bkgd = skewT_BackGround (wks, skewtOpts)
draw (skewt_bkgd)
; Draw hodograph here???
hodo_res = True
hodo_res at vpXF = 0.07
hodo_res at vpYF = 0.92
hodo_res at vpWidthF = 0.15
hodo_res at vpHeightF = 0.15
hodo_res at gsnDraw = False
hodo_res at gsnFrame = False
hodo_plot =
gsn_csm_xy(wks,U_unstag(0,:,locY,locX),V_unstag(0,:,locY,locX),hodo_res)
overlay(skewt_bkgd,hodo_plot)
draw (skewt_bkgd)
; Draw the skew-T data
dataOpts = True
dataOpts at Parcel = 1
dataOpts at WspdWdir = False ; wind speed and dir [else: u,v]
skewT_data = skewT_PlotData(wks, skewt_bkgd, P_tot(:,locY,locX), \
TC(0,:,locY,locX), \
TD(0,:,locY,locX), \
z_tot(0,:,locY,locX), \
U_unstag(0,:,locY,locX), \
V_unstag(0,:,locY,locX), \
dataOpts)
frame(wks)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180409/c631c2a6/attachment.html>
More information about the ncl-talk
mailing list