;**************************************************** ; xy_28.ncl ; ; Concepts illustrated: ; - Drawing a hodograph plot ; - Reading data from an ASCII file ; - Drawing XY plot curves with both lines and markers ; - Putting labels on an XY plot ; ;**************************************************** ; ; This script was contributed by Haoming Chen from ; LASG/IAP in Beijing, China. ; ; A hodograph plot is a suitable approach in ; describing diurnal variations in the wind vector ; at a given point. ; 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" begin ; Read data of an ASCII file fin = "inputhodotest.dat" ;nlvl = 40 nlvl = 25 ncol = 3 dat = asciiread(fin,(/nlvl,ncol/),"float") nhr = 25 badv = -999.0 alt = dat(:,0) u = dat(:,1)*1.94 v = dat(:,2)*1.94 ;==================================================== ; wks = gen_open_wks("eps","hodograph_test") wks = gsn_open_wks ("png","xy") res = True res@gsnMaximize = True ; Maximize plot in window. res@gsnDraw = False ; Don't draw plot res@gsnFrame = False ; Don't advance frame ; res@gsnPaperOrientation = "portrait" res@gsnLeftString = "" res@gsnRightString = "" res@xyMarkLineMode = "MarkLines" ; markers and lines res@xyMarkers = 16 ; filled dot res@xyMarkerSizeF = 0.0135 res@xyMarkerThicknessF = 0.6 res@tiMainString = "Hodograph plot" res@tiYAxisString = "V-Wind" res@tiXAxisString = "U-Wind" res@trXMinF = -15 res@trXMaxF = 50 res@trYMinF = -15 res@trYMaxF = 20 plot = gsn_csm_xy (wks,u,v,res) ; Create plot, but don't draw it ; Attach some text strings next to the markers. txres = True txres@txFontHeightF = 0.0275 txres@txJust = "TopLeft" ; labels = " " + ispan(2000,30000,2000) labels = " " + alt(:) labels(0:nlvl-1:2) = "" ; Don't do the last one. txid = gsn_add_text(wks,plot,labels,u,v,txres) draw(plot) ; Drawing the plot will also cause text strings to frame(wks) ; Advance the frame. end