;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "/usr/local/ncl/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl" ;************************************************ begin fname = "333.txt" ncols =numAsciiCol(fname) nrows =numAsciiRow(fname) big = asciiread(fname,(/nrows,ncols/),"float") wspd = big(:,1) wdir = big(:,2) wspd2 = big(:,3) wdir2 = big(:,4) wspd@_FillValue =0 wspd2@_FillValue =0 wdir@_FillValue =0 wdir2@_FillValue =0 rad = 0.01745329 ; degrees to radians u = -wspd*sin (wdir*rad) v = -wspd*cos(wdir*rad) u@long_name = "zonal wind" u@units = "m/s" v@long_name = "meridionall wind" v@units = "m/s" u2 = -wspd2*sin (wdir2*rad) v2 = -wspd2*cos(wdir2*rad) u2@long_name = "zonal wind" u2@units = "m/s" v2@long_name = "meridionall wind" v2@units = "m/s" N = nrows s = sqrt(u^2 + v^2) xx = fspan(1,N,N) s2 = sqrt(u2^2 + v2^2) s@_FillValue =0 s2@_FillValue =0 m1=max(s) m2=max(s2) m = max((/m1,m2/)) ywnd = max(m)*0.72 ywnd2 = max(m)*0.97 Tmin=1 Tmax=N data = new((/2,nrows/),float) data(0,:) =s data(1,:) =s2 wks = gsn_open_wks ("png","xy_wind") res = True ; plot mods desired res@gsnFrame = False ; don't advance frame yet res@vpHeightF= 0.3 ; change aspect ratio of plot res@vpWidthF = .8 res@trYMinF = 0.0 ; min value on y-axis res@trYMaxF = 20.0 ; max value on y-axis res@vpXF = 0.1 ; start plot at x ndc coord res@trXMinF = Tmin ; Set min/max of X axis. res@trXMaxF = Tmax res@trYMinF = 0 ; Set min/max of X axis. res@trYMaxF = m res@tiXAxisString = "Date(mm/dd)" res@tmYRLabelsOn = False ; no right labels res@tmYROn = False ; no right tickmarks res@tmXTOn = False res@txFontHeightF = .01 res@tmXTOn = False ; Turn off top tickmarks res@tmYLMinorOn = False ; Turn off left minor tickmarks res@tmXBLabelFontHeightF = 0.012 res@tiMainFontHeightF = 0.03 ; change font heights res@tiXAxisFontHeightF = 0.018 res@tiYAxisFontHeightF = 0.018 res@tmXBLabelAngleF = 90 ; tilt the XB labels 45 degrees res@tmXBLabelDeltaF = 1 ; push the XB labels down from plot res@tmXBMode = "Explicit" res@tmXBValues = ispan(17,N,24) res@tmXBLabels = (/"3/15","3/16","3/17","3/18","3/19","3/20","3/21","3/22","3/23","3/24","3/25","3/26","3/27","3/28","3/29","3/30","3/31","4/01","4/02","4/03","4/04","4/05","4/06","4/07","4/08","4/09","4/10","4/11","4/12","4/13","4/14","4/15","4/16","4/17","4/18","4/19","4/20","4/21","4/22","4/23","4/24","4/25"/) res@xyLineThicknesses = 2. ; thicker line res@xyDashPatterns = 8 ; dashed line for 2nd res@tmYRBorderOn = False res@tmXTBorderOn = False res@tiYAxisString = "speed(m/s)" ; y-axis label res@tiMainString = "Hongzehu(CST)" ; title res@xyLineColors = (/"blue","black"/) ; change line color plot = gsn_csm_xy (wks,xx,data,res) ; create base plot wmsetp("wdf", 1) ; meteorological wind direction wmsetp("wbs",0.025) do n=0,N-1,3 ; arbitrary spacing wmsetp("col",4) wmbarb(wks,xx(n), ywnd, u(n), v(n)) wmsetp("col",1) wmbarb(wks,xx(n), ywnd2, u2(n), v2(n)) end do frame(wks) ; now advance frame end