;*********************************************** 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" ;*********************************************** begin xmin = 0. xmax = 23. ymin = 0. ; min height to be plotted ymax = 1000. ; max height to be plotted ncol = 12 ; number of columns of data ; (Each ascii file has the same number of columns) wks = gsn_open_wks("ps","profiler") do iday=335,355 ;-- plot temperature contours ---- nhour = 24 nlvl = 25 ncol = 10 ; number of columns of data ; (Each ascii file has the same number of columns) hour = new(24,"float") temp2D = new((/nlvl,nhour/),"float") do i=0,23 hour(i) = i end do fils = systemfunc("ls CCO_temp_2011_Dec/cco11"+iday+".*t") nfiles = dimsizes(fils) do gg = 0,nfiles-1 t = asciiread(fils(gg) ,(/-1/), "float") nlvl = dimsizes(t)/ncol ; figure out number of levels in the ascii file delete(t) TestData = asciiread(fils(gg) ,(/nlvl,ncol/), "float") height = TestData (:,0)*1000. temp1D = TestData (:,1) ; create 1D array temp2D(:,gg) = temp1D delete(TestData) end do gsn_define_colormap(wks,"BlAqGrYeOrReVi200") res = True res@cnFillOn = True res@gsnDraw = False res@gsnFrame = False res@vpWidthF = 0.8 res@vpHeightF = 0.5 res@vpXF = 0.1 res@vpYF = 0.9 res@trXMinF = xmin res@trXMaxF = xmax res@trYMinF = ymin res@trYMaxF = ymax res@sfXArray = hour res@sfYArray = height res@gsnSpreadColors = True res@gsnSpreadColorStart = 10 res@gsnSpreadColorEnd = 96 res@cnMissingValFillPattern = -1 res@cnMonoLineColor = False res@cnLevelSelectionMode = "ManualLevels" res@cnMinLevelValF = 10 res@cnMaxLevelValF = 30 res@cnLevelSpacingF = 2 res@tiMainString = "Profiler Temperature and Wind on December ="+sprintf("%2.0f",iday-334) res@tiMainFontHeightF = 0.025 ; title font size tcontours = ispan(10,30,2)*1. tcolors = (/20,30,40,45,50,55,60,65,70,75,80,85,90,95/) plot = gsn_csm_contour(wks,temp2D,res) ;-------------------------------------------------------------------------- ; Draw Labelbar ;-------------------------------------------------------------------------- lbres = True lbres@lbPerimOn = False ; no label bar box lbres@lbOrientation = "Horizontal" ; orientation lbres@vpWidthF = 0.5 ; size lbres@vpHeightF = 0.075 lbres@lbLabelFontHeightF = 0.015 ; label font height lbres@lbLabelAlignment = "InteriorEdges" ; where to label lbres@lbMonoFillPattern = True ; fill sold lbres@lbFillColors = tcolors lbres@lbTitleOn = True ; turn on labelbar title lbres@lbTitleString = "T(C)" ; labelbar title string lbres@lbTitleFontHeightF = .02 ; make labelbar title smaller lbres@lbTitleDirection = "Across" ; labelbar title direction gsn_labelbar_ndc (wks,dimsizes(tcontours)+1,sprintf("%3.0f",tcontours),0.25,0.20,lbres) draw(plot) ; draw the plot delete(fils) ;-- plot wind barb ---- xmin = 0. xmax = 23. ymin = 0. ; min height to be plotted ymax = 1000. ; max height to be plotted ncol = 12 ; number of columns of data ; (Each ascii file has the same number of columns) gsn_define_colormap(wks,"WhBlGrYeRe") fils = systemfunc("ls CCO_wind_2011_Dec/cco11"+iday+".*w") nfiles = dimsizes(fils) do gg = 0,nfiles-1 t = asciiread(fils(gg) ,(/-1/), "float") nlvl = dimsizes(t)/ncol ; figure out number of levels in the ascii file delete(t) TestData = asciiread(fils(gg) ,(/nlvl,ncol/), "float") z = TestData (:,0)*1000. wspd = TestData (:,1) wdir = TestData (:,2) delete(TestData) rad = 4.0*atan(1.0)/180. u = -wspd*sin(rad*wdir) v = -wspd*cos(rad*wdir) if (gg.eq.0) then res = True res@cnFillOn = True res@gsnDraw = False res@gsnFrame = False res@vpWidthF = 0.8 res@vpHeightF = 0.5 res@vpXF = 0.1 res@vpYF = 0.9 res@trXMinF = xmin res@trXMaxF = xmax res@trYMinF = ymin res@trYMaxF = ymax res@sfXArray = hour res@sfYArray = height res@gsnSpreadColors = True res@gsnSpreadColorStart = 10 res@gsnSpreadColorEnd = 96 res@cnMissingValFillPattern = -1 res@cnMonoLineColor = False res@cnLevelSelectionMode = "ManualLevels" res@cnMinLevelValF = 5 res@cnMaxLevelValF = 65 res@cnLevelSpacingF = 5 xc = (/xmin,xmax,xmax,xmin,xmin/) yc = (/ymin,ymin,ymax,ymax,ymin/) plot = gsn_csm_xy(wks,xc,yc,res) ; draw blank xy plot by ; outlining min/max of X/Y axes contours = ispan(5,65,5)*1. ; set contours used to define ; barb color colors = (/20,30,40,45,50,55,60,65,70,75,80,85,90,95/) ; set colors end if wmsetp ("wdf", 1) ; meteorological dir wmsetp("wbs",0.025) do hh = 0,dimsizes(z)-1 wmsetp("col", GetFillColorIndex(contours,colors,wspd(hh))) ; assign barb color based on wind speed value if (z(hh).lt.ymax.and.z(hh).ge.ymin .and. \ abs(u(hh)).le.30. .and. abs(v(hh)).le.30.) then wmbarb(wks, gg*1., z(hh), u(hh), v(hh)) ; draw wind barb end if end do delete([/z,wspd,wdir,u,v/]) end do ; end of a day ;-------------------------------------------------------------------------- ; Draw Labelbar ;-------------------------------------------------------------------------- lbres = True lbres@lbPerimOn = False ; no label bar box lbres@lbOrientation = "Horizontal" ; orientation lbres@vpWidthF = 0.5 ; size lbres@vpHeightF = 0.075 lbres@lbLabelFontHeightF = 0.015 ; label font height lbres@lbLabelAlignment = "InteriorEdges" ; where to label lbres@lbMonoFillPattern = True ; fill sold lbres@lbFillColors = colors lbres@lbTitleOn = True ; turn on labelbar title lbres@lbTitleString = "m/s" ; labelbar title string lbres@lbTitleFontHeightF = .02 ; make labelbar title smaller lbres@lbTitleDirection = "Across" ; labelbar title direction gsn_labelbar_ndc (wks,dimsizes(contours)+1,sprintf("%3.0f",contours),0.25,0.32,lbres) draw(plot) ; draw the plot frame(wks) ; advance the frame delete(fils) end do end