;Load vital libraries for NCL-WRF Functions. 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 Program and extract data to plot with. begin a=addfile("/tera9/brianjs/ruc_analysis/A_5_24_2007/cat_file.cdf","r") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Loop through all 13 time steps ;Loop through met_grid_levels 4-7 for 925 mb, 900 mb, 875 mb, and 850 mb, respectively at t = 0 do n =0, 12 ;Loop through all 13 times ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Read in wind data u_wind_tmp = a->UU(n,:,:,:) v_wind_tmp = a->VV(n,:,:,:) ;Read in lat/lon in mass coordinate system XLAT = a->XLAT_M(n,:,:) XLONG = a->XLONG_M(n,:,:) ;Isolate lat/lon components of mass coordinate system and label/establish them in proper arrays lat = XLAT(:,0) lon = XLONG(0,:) lat@units = "degrees_north" lon@units = "degrees_east" lat!0 = "lat" lon!0 = "lon" lat&lat = lat lon&lon = lon ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Unstagger winds dims_U = dimsizes(u_wind_tmp) dims_V = dimsizes(v_wind_tmp) ndU = dimsizes(dims_U) ndV = dimsizes(dims_V) dimU = dims_U(ndU-1) dimV = dims_V(ndV-2) u_wind = 0.5*(u_wind_tmp(:,:,:dimU-2) + u_wind_tmp(:,:,1:dimU-1)) v_wind = 0.5*(v_wind_tmp(:,:dimV-2,:) + v_wind_tmp(:,1:dimV-1,:)) u_wind!0 = "south_north" u_wind!1 = "west_east" v_wind!0 = "south_north" v_wind!1 = "west_east" copy_VarAtts(u_wind_tmp, u_wind) copy_VarAtts(v_wind_tmp, v_wind) u_wind@coordinates = "XLONG XLAT" v_wind@coordinates = "XLONG XLAT" u_wind@stagger = " " v_wind@stagger = " " ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Plot the winds and convert to knots u_plane = u_wind*1.94386 ; kts v_plane = v_wind*1.94386 ; kts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Assign U and V lat/lon arrays u_plane!1 = "lat" u_plane!2 = "lon" u_plane&lat = lat u_plane&lon = lon v_plane!1 = "lat" v_plane!2 = "lon" v_plane&lat = lat v_plane&lon = lon ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Calculate Convergence conv = u_plane conv = uv2dv_cfd(u_plane,v_plane,lat,lon,2) conv_scaled = conv/1e-5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Pull out the level data needed u_plane_925 = u_plane(4,:,:) v_plane_925 = v_plane(4,:,:) conv_925 = conv_scaled(4,:,:) u_plane_900 = u_plane(5,:,:) v_plane_900 = v_plane(5,:,:) conv_900 = conv_scaled(5,:,:) u_plane_875 = u_plane(6,:,:) v_plane_875 = v_plane(6,:,:) conv_875 = conv_scaled(6,:,:) u_plane_850 = u_plane(7,:,:) v_plane_850 = v_plane(7,:,:) conv_850 = conv_scaled(7,:,:) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Establish level loops for each plot (loop through the levels listed above) for labeling do i = 0, 3 plevel = (/"925","900","875","850"/) ptitle = (/"925","900","875","850"/) ptime = (/"2013_05_23-12", "2013_05_23-15", "2013_05_23-18", "2013_05_23-21", "2013_05_24-00",\ "2013_05_24-03", "2013_05_24-06", "2013_05_24-09", "2013_05_24-12", "2013_05_24-15", "2013_05_24-18", "2013_05_24-21", "2013_05_25-00"/) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Establish Plots (type of plot, title, color map for contours, indications for manual changes). wks = gsn_open_wks("png","RUC_Wind_Conv"+n+i) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Basic Plot Outline Resources vcres = True vcres@gsnDraw = False vcres@gsnFrame = False cnres = vcres mpres = vcres mpres = True mpres@gsnLeftString = ptitle(i)+"mb RUC Winds ~C~ "+ptime(n)+":00 UTC" mpres@gsnAddCyclic = False mpres@gsnRightString = "" mpres@mpFillOn = False ; turn off map fill mpres@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last mpres@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries ;Restricting domain to lat/lon of choice (same as WRF) nlon = dimsizes(lon) nlat = dimsizes(lat) mpres@mpLimitMode = "Corners" ; Zoom in on the plot area. mpres@mpLeftCornerLonF = lon(0) mpres@mpRightCornerLonF = lon(nlon-1) mpres@mpLeftCornerLatF = lat(0) mpres@mpRightCornerLatF = lat(nlat-1) mpres@tmXTOn = "False" mpres@tmYROn = "False" mpres@mpGridAndLimbDrawOrder = "Predraw" ; set to predraw phase (mandatory) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Utilize coloring and labeling resources for the winds ; Add colors to windbarbs vcres@vcRefAnnoOn = False ; turns off the ref vector vcres@vcRefLengthF = 0.045 ; set length of ref vector vcres@vcGlyphStyle = "WindBarb" ; turn on wind barbs vcres@gsnSpreadColors = True ; use full colormap vcres@gsnSpreadColorStart = 48;-1 ; don't use added gray vcres@gsnSpreadColorEnd = -2 ; don't use added gray vcres@vcGlyphStyle = "WindBarb" ; choose wind barbs vcres@vcWindBarbLineThicknessF = 2;3;2. ; wind barb thickness vcres@vcMinDistanceF = .04 vcres@vcVectorDrawOrder = "Predraw" ; set to predraw phase (mandatory) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;draw contours of convergence cnres = True cnres@gsnDraw = False cnres@gsnFrame = False cnres@cnLevelSelectionMode = "ExplicitLevels" cnres@cnLevels = (/-10,-7.5,-5,-2.5,2.5,5,7.5,10/) ;cnres@cnLevels = (/-5,-2.5,2.5,5/) cnres@cnLineThicknessF = 2.4 cnres@cnLineLabelInterval = 1. cnres@cnLineLabelsOn = True cnres@cnInfoLabelOn = False cnres@cnLineColor = "blue" cnres@cnFillDrawOrder = "Predraw" ; set to predraw phase (mandatory) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; MAKE PLOTS ;Create (before drawing) the plots if (i.eq."0") then vcid = gsn_csm_vector(wks,u_plane_925,v_plane_925,vcres) ; Plot the wind barbs cnid = gsn_csm_contour(wks,conv_925,cnres) ; Plot the convergence end if if (i.eq."1") then vcid = gsn_csm_vector(wks,u_plane_900,v_plane_900,vcres) ; Plot the wind barbs cnid = gsn_csm_contour(wks,conv_900,cnres) ; Plot the convergence end if if (i.eq."2") then vcid = gsn_csm_vector(wks,u_plane_875,v_plane_875,vcres) ; Plot the wind barbs cnid = gsn_csm_contour(wks,conv_875,cnres) ; Plot the convergence end if if (i.eq."3") then vcid = gsn_csm_vector(wks,u_plane_850,v_plane_850,vcres) ; Plot the wind barbs cnid = gsn_csm_contour(wks,conv_850,cnres) ; Plot the convergence end if mpid = gsn_csm_map(wks,mpres) ;Overlay vectors and contours upon the map overlay(mpid,vcid) ; overlay the wind barbs over base map overlay(mpid,cnid) ; overlay convergence contours over base map maximize_output(wks,True) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end do ; End level loop end do ; End time loop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end