; Example script to produce plots for a WRF real-data run, ; with the ARW coordinate dynamics option. ; Plot data on a cross section ; This script will plot data at a set angle through a specified point ; Add some label info to the Y-axis 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/wrf/WRF_contributed.ncl" load "/home/xhu2/tools/nclscripts/wrf/WRFUserARW.ncl" begin elevation_array = readAsciiTable("ACTAMERICA-Elevation_C130_20160805_R0.ict", 4, "float", 36) elevation_array@_FillValue = -9999. ; Altitude_AGL_m = elevation_array(:,3) average_points = 40 ; ; average_points = 60 ; Altitude_GPS = elevation_array(::average_points,1) Altitude_time = elevation_array(::average_points,0) average_points_more = 300 Altitude_GPS_sparse = elevation_array(::average_points_more,1)/1000. Altitude_time_sparse = elevation_array(::average_points_more,0) hours_since_midnight_UTC_simple = round(elevation_array(::average_points,0)/3600.*10, 3)/10. hours_since_midnight_UTC_simple_sparse = round(elevation_array(::average_points_more,0)/3600.*10, 3)/10. delete(elevation_array) file_data = "ACTAMERICA-Hskping_c130_20160805_R1.ict" if (file_data.eq."ACTAMERICA-Hskping_c130_20160801_R1.ict".or.file_data.eq."ACTAMERICA-Hskping_c130_20160527_R3.ict".or.file_data.eq."ACTAMERICA-Hskping_c130_20160721_R0.ict") then if (file_data.eq."ACTAMERICA-Hskping_c130_20160721_R0.ict") then data_array = readAsciiTable(file_data, 33, "float", 65) else data_array = readAsciiTable(file_data, 33, "float", 69) end if else data_array = readAsciiTable(file_data, 34, "float", 69) end if data_array@_FillValue = -9999. lat = data_array(::average_points,2) lon = data_array(::average_points,3) lat_sparse = data_array(::average_points_more,2) lon_sparse = data_array(::average_points_more,3) index_exclude = ind(lon.gt.-101.) index_include = ind(lon.le.-101.) index_exclude_sparse = ind(hours_since_midnight_UTC_simple_sparse.lt.20.483.or.hours_since_midnight_UTC_simple_sparse.gt.21.9) delete(data_array) data_array = readAsciiTable("ACTAMERICA-PICARRO_C130_20160805_R0.ict", 6, "float", 38) data_array@_FillValue = -9999. CO2_obs_raw_temp = data_array(:,3) index_good = ind(.not.ismissing(CO2_obs_raw_temp)) CO2_obs_raw = CO2_obs_raw_temp(index_good) CO2_time_raw = data_array(index_good,2) CO2_obs_raw_runave = runave_Wrap (CO2_obs_raw, average_points, 1) ; 20 point running average with reflective boundary condition ; print(CO2_obs_raw) CO2_obs = linint1 (CO2_time_raw, CO2_obs_raw_runave, False, Altitude_time, 0) CO2_obs(index_exclude) = CO2_obs@_FillValue dateshow_str_v = flt2string(hours_since_midnight_UTC_simple) dateshow_str_v(index_exclude) = "" ; dateshow_str@_FillValue CO2_obs_raw_runave = runave_Wrap (CO2_obs_raw, 120, 1) ; 20 point running average with reflective boundary condition CO2_obs_sparse = linint1 (CO2_time_raw, CO2_obs_raw_runave, False, Altitude_time_sparse, 0) CO2_obs_sparse(index_exclude_sparse) = CO2_obs_sparse@_FillValue dateshow_str = flt2string(hours_since_midnight_UTC_simple_sparse) dateshow_str(index_exclude_sparse) = "" ; dateshow_str@_FillValue print(CO2_time_raw(:10)) print(Altitude_time(:10)) if (dimsizes(Altitude_GPS).ne.dimsizes(CO2_obs)) then print("records in two files doesn't match !!!!!!!!!!!!!!!!" + "data line "+dimsizes(CO2_obs)+" elevation line "+dimsizes(Altitude_GPS)) end if gsres = True gsres@gsMarkerIndex = 16 ; circle at first gsres@gsMarkerThicknessF = 1 gsres@gsMarkerSizeF = 0.01 gsres@gsMarkerColor = "black" gsres@gsMarkerColor = "red" ; 32.453037,-93.834152 Shreveport Regional Airport ; Meteo_Lat = 32.453037 ; Meteo_Lon = -93.834152 ;46.758717,-103.258858 for C130 track on Aug 5 Meteo_Lat = 46.758717 Meteo_Lon = -103.258858 idomain = 1 ; files = systemfunc("ls wrfout_d0"+idomain+"_2011-08-??_*:00:00") files = systemfunc("ls wrfout_d01_2016-08-05_1[5-9]*00 wrfout_d01_2016-08-05_2[0-2]*:00") do ifiles = 6,6; 0 , dimsizes(files)-1 a = addfile(files(ifiles)+".nc","r") opt = True ij = wrf_user_ll_to_ij(a,Meteo_Lon, Meteo_Lat,opt) ; print(ij) ; We generate plots, but what kind do we prefer? type = "png" type@wkWidth = 1211 type@wkHeight = 1211 ifiles_show = ifiles+ 7 ; figurename = "wrfout_d0"+idomain+"_CO2total_crossSNpartial_overlayObs_runave_"+ifiles_show ; figurename = "wrfout_d0"+idomain+"_CO2total_crossSNpartial_overlayObs_combHor_"+ifiles figurename = "wrfout_d0"+idomain+"_CO2total_crossSNpartial_overlayObs_combHor_wide_"+ifiles wks = gsn_open_wks(type,figurename) gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map ; Set some basic resources res = True ; res@MainTitle = "REAL-TIME WRF" res@Footer = False ter_res = True opts_ter = ter_res opts_ter@gsnYRefLine = 0.0 opts_ter@gsnDraw = False opts_ter@gsnFrame = False ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; times = wrf_user_getvar(a,"times",-1) ; get times in the file ntimes = dimsizes(times) ; number of times in the file FirstTime = True mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file nd = dimsizes(mdims) ;--------------------------------------------------------------- do it = 0,ntimes-1,2 ; TIME LOOP print("Working on time: " + times(it) ) res@TimeLabel = times(it) ; Set Valid time to use on plots ter = wrf_user_getvar(a,"ter",0) PBLH = a->PBLH(0,:,:) xlon = wrf_user_getvar(a, "XLONG",0) xlat = wrf_user_getvar(a, "XLAT",0) tc = wrf_user_getvar(a,"tc",it) ; T in C theta = wrf_user_getvar(a,"theta",it) ; relative humidity z = wrf_user_getvar(a, "z",it) ; grid point height height = wrf_user_getvar(a,"height",0) va = wrf_user_getvar(a,"va",it) ; u on mass points ua = wrf_user_getvar(a,"ua",it) ; u on mass points temp = a->CO2_BIO(it,:,:,:) ; u on mass points temp = (/a->CO2_BIO(0,:,:,:) + a->CO2_ANT(0,:,:,:) - a->CO2_BCK(0,:,:,:)/) CO2total = temp CO2total@units = "ppmv";(/temp*1000/) wa = wrf_user_getvar(a,"wa",it) ; v on mass points CO2_5412wrf = wrf_interp_3d_z(CO2total, height, 5412.) u_5412wrf = wrf_interp_3d_z(ua,height,5412.) v_5412wrf = wrf_interp_3d_z(va,height,5412.) if ( FirstTime ) then ; get height info for labels zmin = 0. zmax = max(z)/1000. nz = floattoint(zmax/2 + 1) FirstTime = False end if ;--------------------------------------------------------------- ; Plot a cross session that run south-north through the middle of the plot ; For this we need a pivot point and a angle ; | ; angle = 90 ; E-W ; angle = -16 angle = -8.93 plane = new(2,float) plane = (/ ij(0), ij(1) /) ; pivot point is center of domain (x,y) opts = False ; start and end points not specified theta_plane = wrf_user_intrp3d(theta,z,"v",plane,angle,opts) tc_plane = wrf_user_intrp3d(tc,z,"v",plane,angle,opts) CO2total_plane = wrf_user_intrp3d(CO2total,z,"v",plane,angle,opts) va_plane = wrf_user_intrp3d(va,z,"v",plane,angle,opts) wa_plane = wrf_user_intrp3d(wa,z,"v",plane,angle,opts) ter_plane = wrf_user_intrp2d(ter,plane,angle,opts) PBLH_plane = wrf_user_intrp2d(PBLH,plane,angle,opts) X_plane = wrf_user_intrp2d(xlat,plane,angle,opts) lon_plane = wrf_user_intrp2d(xlon,plane,angle,opts) distance = (lon_plane( :)+96.8)^2+(X_plane(:)-32.7833333)^2 id_d = minind(distance) dim = dimsizes(theta_plane) ; Find the data span - for use in labels print(dim) zspan = dim(0) zcordinate = fspan(zmin,zmax,zspan) ; print(zspan) ; Options for XY Plots opts_xy = res opts_xy@tiYAxisString = "Height, km" opts_xy@tiXAxisString = "Latitude, ~S~o~N~N" opts_xy@cnMissingValPerimOn = False ; True opts_xy@cnMissingValFillColor = 0 opts_xy@cnMissingValFillPattern = 11 opts_xy@tmYLMode = "Explicit" opts_xy@tmYLValues = fspan(0,zspan,nz*2*2) ; Create tick marks opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz*2*2)) ; Create labels opts_xy@tmXBMode = "Explicit" X_plane_round = round(X_plane*10,3)/10. opts_xy@tmXBValues = ispan(0,260,20) opts_xy@tmXBLabels = X_plane_round(ispan(0,260,20)) opts_xy@tiXAxisFontHeightF = 0.0108 opts_xy@tiYAxisFontHeightF = 0.0108 opts_xy@tiXAxisOffsetYF = 0.0055 opts_xy@tmXBLabelDeltaF = -0.8 opts_xy@tmXBMajorLengthF = 0.0108 opts_xy@tmYLMajorLengthF = 0.0108 opts_xy@tmYLLabelFontHeightF = 0.0108 opts_xy@tmXBLabelFontHeightF = 0.0108 opts_xy@PlotOrientation = tc_plane@Orientation n_YMax = 360 ; domain 1 ; Aug 5 n_XMax = 240 ; id_d+1 ; domain 1 ; n_XMin = 130 ; domain 1 n_XMin = 80 ; domain 1 opts_xy@trYMaxF = n_YMax opts_xy@trXMaxF = n_XMax opts_xy@trXMinF = n_XMin ; opts_xy@gsnOrientation = "portrait" opts_xy@gsnDraw = True ; Forces the plot to be drawn opts_xy@gsnFrame = True ; Frame advance opts_xy@tiMainString = "" ;chartostring(a->Times) opts_xy@vpHeightF = 0.425 opts_xy@vpWidthF = 0.5 opts_xy@gsnRightString = "Vertical cross-section along the C130 track" ; res@TimeLabel opts_xy@FieldTitle = "Vertical cross-section along the C130 track" ; res@TimeLabel ; Plotting options for CO2total opts_theta = opts_xy opts_theta@cnFillMode = "RasterFill" opts_theta@ContourParameters = (/ 391., 406., 1. /) opts_theta@tmXBFormat = "f" opts_theta@pmLabelBarOrthogonalPosF = -0.07 opts_theta@cnFillOn = True opts_theta@gsnSpreadColors = True ; use full range of colormap opts_theta@lbTitleOn = True ; turn on title opts_theta@lbTitleString = " CO~B~2~N~~C~~V10~ppmv" ; "O~B~3, ~N~ppbv" ; title string opts_theta@lbTitlePosition = "Right" ; title position opts_theta@lbTitleFontHeightF= .0148 ; make title smaller opts_theta@lbLabelOffsetF = 0.01 opts_theta@lbTitleDirection = "Across" ; title direction opts_theta@lbTopMarginF = -0.12 opts_theta@lbBottomMarginF = 0.21 opts_theta@lbLeftMarginF = 0.31 opts_theta@lbTitleOffsetF = -0.0004 opts_theta@lbTitleJust = "CenterCenter" ; opts_theta@cnFillColors = (/"White","White","White", \ ; "White","Chartreuse","Green", \ ; "Green3","Green4", \ ; "ForestGreen","PaleGreen4"/) ; Plotting options for Temperature opts_tc = opts_xy opts_tc@cnInfoLabelOrthogonalPosF = 0.00 opts_tc@ContourParameters = (/ 5. /) ; Get the contour info for the theta and temp opts_theta@gsnMaximize = False CO2total_plane!0 = "height" CO2total_plane!1 = "lat" CO2total_plane&height = fspan(0,zmax,dim(0) ) CO2total_plane&lat = X_plane va_plane!0 = "height" va_plane!1 = "lat" va_plane&height = fspan(0,zmax,dim(0) ) va_plane&lat = X_plane wa_plane!0 = "height" wa_plane!1 = "lat" wa_plane&height = fspan(0,zmax,dim(0) ) wa_plane&lat = X_plane contour_theta = wrf_contour(a,wks,CO2total_plane,opts_theta) j_Altitude_GPS = Altitude_GPS/(zmax*1000./dim(0)) x_lat = (lat-min(X_plane))/((max(X_plane)-min(X_plane))/dimsizes(X_plane)) do i_points = 0, dimsizes(x_lat)-1 i_lat = closest_val(lat(i_points),X_plane) x_lat(i_points) = i_lat + (lat(i_points)-X_plane(i_lat))/(X_plane(i_lat+1)-X_plane(i_lat)) end do print("max, min of X_plane"+ min(X_plane)+" "+max(X_plane)+"max, min of lat "+min(lat)+" "+max(lat) ) print("max, min of x_lat"+ min(x_lat)+" "+max(x_lat) ) ; dummy1 = gsn_add_polymarker(wks,contour_theta,x_lat,j_Altitude_GPS,gsres) npts = dimsizes(lat) ; print(contour_theta@contour) ; print(contour_theta) ; getvalues contour_theta@contour ; "cnLevels" : levels ; "cnFillColors" : colors ; end getvalues levels = ispan(391, 406, 1) num_distinct_markers = dimsizes(levels)+1 ; number of distinct markers colors = round(fspan(2,201, num_distinct_markers),3) print(colors) dims=dimsizes(CO2_obs) y_new = new((/num_distinct_markers,dims/),float,-999) x_new = new((/num_distinct_markers,dims/),float,-999) do j = 0, num_distinct_markers-1 if (j.eq.0) then indexes = ind(CO2_obs.lt.levels(0)) end if if (j.eq.num_distinct_markers-1) then indexes = ind(CO2_obs.ge.max(levels)) ; print("color "+j+" indexes="+indexes) end if if (j.gt.0.and.j.lt.num_distinct_markers-1) then indexes = ind(CO2_obs.ge.levels(j-1).and.CO2_obs.lt.levels(j)) end if if (.not.any(ismissing(indexes))) then npts_range = dimsizes(indexes) ; # of points in this range. y_new(j,0:npts_range-1) = j_Altitude_GPS(indexes) x_new(j,0:npts_range-1) = x_lat(indexes) print("color "+j+"npts_range="+npts_range) end if delete(indexes) ; Necessary b/c "indexes" may be a different ; size next time. end do ; j = 0, num_distinct_markers-1 gsres = True gsres@gsMarkerIndex = 4 ; circle at first gsres@gsMarkerThicknessF = 1 gsres@gsMarkerSizeF = 0.0102 gsres@gsMarkerColor = "black" gsres@gsMarkerIndex = 16; 4 ; Use filled dots for markers. ; if (j.eq.0) then ; dummy1 = gsn_add_polymarker(wks,contour_theta,x_lat,j_Altitude_GPS,gsres) dummy1 = gsn_add_polymarker(wks,contour_theta,x_lat(index_include),j_Altitude_GPS(index_include),gsres) txres = True txres@txFontHeightF = 0.01 txres@txBackgroundFillColor = "Transparent" interval = 2400/average_points text = gsn_add_text(wks,contour_theta,dateshow_str_v(::interval),x_lat(::interval)+6, \ j_Altitude_GPS(::interval)+10 ,txres) ; dummy = new(num_distinct_markers,typeof(dummy1)) dummy = new(num_distinct_markers,graphic) dummyb = new(num_distinct_markers,graphic) ; end if do j = 0, num_distinct_markers-1 if (.not.ismissing(y_new(j,0))) gsres@gsMarkerThicknessF = 1 gsres@gsMarkerColor = "black" gsres@gsMarkerIndex = 16 ; Use filled dots for markers. gsres@gsMarkerSizeF = 0.0102 gsres@gsMarkerColor = "black" ; dummyb(j) = gsn_add_polymarker(wks,contour_theta,x_new(j,:),y_new(j,:),gsres) gsres@gsMarkerSizeF = 0.007 gsres@gsMarkerColor = colors(j) ; if (j.eq.0) then ; dummy1 = gsn_add_polymarker(wks,contour_theta,x_new(j,:),y_new(j,:),gsres) ; printVarSummary(dummy1) ; end if dummy(j) = gsn_add_polymarker(wks,contour_theta,x_new(j,:),y_new(j,:),gsres) end if end do txres = True txres@txFontHeightF = 0.016881 txres@txBackgroundFillColor = "white" text_label = gsn_add_text(wks,contour_theta,"b",n_XMin+5, n_YMax-18 ,txres) delete(y_new) delete(x_new) delete(colors) delete(levels) resvector = True resvector@vpHeightF = 0.425 resvector@vpWidthF = 0.5 resvector@gsnDraw = True ; Forces the plot to be drawn resvector@gsnFrame = True ; Frame advance resvector@vcGlyphStyle = "CurlyVector" resvector@tmXBFormat = "f" ; resvector@trXMinF = 65. resvector@trYMaxF = n_YMax resvector@trXMaxF = n_XMax resvector@trXMinF = n_XMin resvector@vcRefAnnoOn = True resvector@vcRefMagnitudeF = 10. ; define vector ref mag resvector@vcRefLengthF = 0.025 ; define length of vec ref resvector@vcRefAnnoOrthogonalPosF = -1.05 ; move ref vector resvector@vcRefAnnoParallelPosF = 0.985 ; move ref vector resvector@vcMinDistanceF = 0.025 ; larger means sparser resvector@vcLineArrowHeadMaxSizeF = 0.0075 ; default: 0.05 (LineArrow), 0.012 (CurlyVector) resvector@gsnMaximize = False resvector@vcRefAnnoString2On = True; False resvector@vcRefAnnoString2 = "m s~S~-1" vector = wrf_vector(a,wks,va_plane,wa_plane*100,resvector) ;Contour terrain cross section ; print(opts_ter) opts_ter@trXMaxF = X_plane(n_XMax) opts_ter@trXMinF = X_plane(n_XMin) opts_ter@trYMaxF = zcordinate(n_YMax)*1000 opts_ter@vpHeightF = 0.425 opts_ter@vpWidthF = 0.5 opts_ter@xyLineThicknessF = 4.0 opts_ter@pmLegendSide = "Top" ; Change location of opts_ter@pmLegendParallelPosF = .0151084 ; move units right opts_ter@pmLegendOrthogonalPosF = -1.20386 opts_ter@pmLegendWidthF = 0.07081 ; Change width and opts_ter@pmLegendHeightF = 0.051 ; height of legend. opts_ter@pmLegendDisplayMode = "Always" ; create a legend opts_ter@lgPerimOn = False opts_ter@lgLabelFontHeightF = 0.0148 opts_ter@xyExplicitLegendLabels = (/"terrain","PBL top","lfc","lcl"/) opts_ter@xyLineColors = (/"blue","black","blue"/) opts_ter@xyDashPatterns = (/0, 12, 16/) opts_ter@gsnYRefLine = 0.0 ; opts_ter@gsnAboveYRefLineColor = "black" ter_plane_mean_plusref = new ((/2,dimsizes(ter_plane)/),float) ter_plane_mean_plusref(0,:) = (/ter_plane/) ter_plane_mean_plusref(1,:) = (/ter_plane+PBLH_plane/) ; contour_ter = gsn_csm_xy(wks,X_plane,ter_plane,opts_ter) contour_ter = gsn_csm_xy(wks,X_plane,ter_plane_mean_plusref,opts_ter) ; contour_ter = gsn_csm_xy(wks,X_plane,ter_plane,opts_ter) ; dummy1 = gsn_add_polymarker(wks,contour_ter,X_plane(id_d),0.08,gsres) ; j_Altitude_GPS = elevation_array(:,1)/(zmax*1000./dim(0)) ; x_lat = (lat-min(X_plane))/((max(X_plane)-min(X_plane))/dimsizes(X_plane)) ; print("max, min of X_plane"+ min(X_plane)+" "+max(X_plane)+"max, min of lat "+min(lat)+" "+max(lat) ) ; print("max, min of x_lat"+ min(x_lat)+" "+max(x_lat) ) ; dummy1 = gsn_add_polymarker(wks,contour_ter,lat,Altitude_GPS,gsres) ; MAKE PLOTS pltres = True pltres@NoTitles = True pltres@CommonTitles = True; False pltres@PanelPlot = True pltres@gsnPaperOrientation = "portrait" pltres@FramePlot = False pltres@PlotTitle = "Vertical cross-section along the C130 track" ; plot = wrf_overlays(a,wks,(/contour_theta,vector/),pltres) plot = wrf_overlays(a,wks,(/contour_theta,vector,contour_ter/),pltres) setvalues contour_theta "vpHeightF" : 0.425 "vpWidthF" : 0.5 "vpYF" : 0.525 ; 0.9-ifile_loop*0.39 "vpXF" : 0.15;+ispecies*0.355 "tiMainString" : "Vertical cross-section along the C130 track" "tiMainFontHeightF":0.0128 "tiMainOffsetYF" : -0.01 "gsnRightString" : "Vertical cross-section along the C130 track" ; res@TimeLabel ; "gsnPaperOrientation" : "portrait" end setvalues draw(contour_theta) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; res@gsnLeftString = "CO~B~2~N~ @ 5412m above sea level" Times_char = a->Times CST_hr = mod(stringtoint(chartostring(Times_char(0,11:12)))-6+24, 24) res@gsnRightString = res@TimeLabel + " UTC "+ CST_hr+" CST" ; +ReDF"; res@vpYF = 0.965 res@vpXF = 0.15 res@vpHeightF = 0.425 res@vpWidthF = 0.5 WRF_map_c(a, res, 0) ; reads info from file res@mpOutlineBoundarySets = "AllBoundaries" res@cnFillOn = True ; color plot desired res@cnLinesOn = False ; turn off contour lines res@cnLineLabelsOn = False ; turn off contour labels res@cnLevelSelectionMode = "ManualLevels" res@tmYRMajorOutwardLengthF = 0 res@tmYLMajorOutwardLengthF = 0 res@tmYLMinorOutwardLengthF = 0 res@tmXBMajorOutwardLengthF = 0 res@tmXBMinorOutwardLengthF = 0 res@tmYRLabelsOn = False res@tmXTLabelsOn = False res@tmYLLabelsOn = True res@tmXBLabelsOn = True res@tmXTOn = True res@tmYROn = True res@tmXBOn = True res@tmYLOn = True res@lbLabelFontHeightF = 0.0108 res@tmXBLabelFontHeightF = 0.008108 res@tmYLLabelFontHeightF = 0.008108 res@cnMinLevelValF = 391 ; res@cnMaxLevelValF = 406 ; 2016 scale res@cnLevelSpacingF = 1. ; 0.5 res@cnFillMode = "RasterFill" res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks res@vcRefAnnoOn = True ; False res@vcRefMagnitudeF = 10. ; define vector ref mag res@vcRefLengthF = 0.025 ; define length of vec ref res@vcRefAnnoOrthogonalPosF = -1. ; move ref vector res@vcRefAnnoParallelPosF = 0.985 ; move ref vector res@vcMinDistanceF = 0.025 ; larger means sparser res@vcLineArrowHeadMaxSizeF = 0.0075 ; default: 0.05 (LineArrow), 0.012 (CurlyVector) res@vcGlyphStyle = "CurlyVector" ; default: "LineArrow" res@gsnScalarContour = True ; contours desired res@tfDoNDCOverlay = True res@gsnFrame = False res@gsnMaximize = False res@lbTopMarginF = -0.05810482 res@lbLeftMarginF = 0.31 res@lbBottomMarginF = 0.5318 res@lbTitleString = " ~C~~V10~ppmv" ; "O~B~3, ~N~ppbv" ; title string res@lbTitlePosition = "Right" ; title position res@lbTitleFontHeightF= .0148 ; make title smaller res@lbTitleDirection = "Across" ; title direction res@lbTitleOffsetF = -0.0004 res@lbTitleJust = "CenterCenter" res@lbLabelStride = 3 plot = gsn_csm_vector_scalar_map(wks,u_5412wrf, v_5412wrf, CO2_5412wrf,res) npts = dimsizes(lat_sparse) getvalues plot@contour "cnLevels" : levels "cnFillColors" : colors end getvalues num_distinct_markers = dimsizes(levels)+1 ; number of distinct markers dims=dimsizes(CO2_obs_sparse) lat_new = new((/num_distinct_markers,dims/),double,-999) lon_new = new((/num_distinct_markers,dims/),double,-999) do j = 0, num_distinct_markers-1 if (j.eq.0) then indexes = ind(CO2_obs_sparse.lt.levels(0)) end if if (j.eq.num_distinct_markers-1) then indexes = ind(CO2_obs_sparse.ge.max(levels)) ; print("color "+j+" indexes="+indexes) end if if (j.gt.0.and.j.lt.num_distinct_markers-1) then indexes = ind(CO2_obs_sparse.ge.levels(j-1).and.CO2_obs_sparse.lt.levels(j)) end if if (.not.any(ismissing(indexes))) then npts_range = dimsizes(indexes) ; # of points in this range. lat_new(j,0:npts_range-1) = lat_sparse(indexes) lon_new(j,0:npts_range-1) = lon_sparse(indexes) if (j.eq.0) then print("color "+j+"npts_range="+npts_range) end if end if delete(indexes) ; Necessary b/c "indexes" may be a different ; size next time. end do ; j = 0, num_distinct_markers-1 gsres = True ; gsres@gsMarkerIndex = 4 ; circle at first gsres@gsMarkerIndex = 16 ; circle at first gsres@gsMarkerThicknessF = 1 gsres@gsMarkerIndex = 16 ; Use filled dots for markers. gsres@gsMarkerSizeF = 0.01 gsres@gsMarkerSizeF = 0.0068 gsres@gsMarkerColor = "black" gsn_polymarker(wks,plot,lon,lat,gsres) do j = 0, num_distinct_markers-1 if (.not.ismissing(lat_new(j,0))) gsres@gsMarkerThicknessF = 1 gsres@gsMarkerIndex = 16 ; Use filled dots for markers. ; gsres@gsMarkerColor = "white" ; gsn_polymarker(wks,plot,lon_new(j,:),lat_new(j,:),gsres) gsres@gsMarkerSizeF = 0.005 gsres@gsMarkerColor = colors(j) gsn_polymarker(wks,plot,lon_new(j,:),lat_new(j,:),gsres) end if end do txres = True txres@txBackgroundFillColor = "Transparent" txres@txFontHeightF = 0.006881 nterval = 1500/average_points_more gsn_text(wks,plot,(dateshow_str(::nterval)),lon_sparse(::nterval)+1.81, \ lat_sparse(::nterval) ,txres) txres@txFontHeightF = 0.0119881 txres@txFontColor = "white" gsn_text(wks,plot,"Lincoln",-96.7619, \ 40.8367-1.0,txres) txres@txFontHeightF = 0.011881 txres@txFontColor = "black" gsn_text(wks,plot,"Lincoln",-96.7619, \ 40.8367-1.0,txres) txres = True txres@txFontHeightF = 0.016881 txres@txBackgroundFillColor = "white" gsn_text(wks,plot,"a",-130.2, 48 ,txres) print(dateshow_str(::nterval)) delete(lat_new) delete(lon_new) delete(colors) delete(levels) delete(res) end do ; END OF TIME LOOP delete(ter_plane) delete(wa_plane) delete(tc_plane) delete(theta_plane) delete(va_plane) delete(CO2total_plane); = wrf_user_intrp3d(CO2total,z,"v",plane,angle,opts) delete(zcordinate) frame(wks) ; system("convert -density 300 -rotate -90 -resize 1000x1000 -trim "+figurename+".eps /nsftor/xhu/public_html/HurricaneImpactonO3/WRFV3.6.1/YSU/wrfNARR3dWSM6_CONUS_UCM_YSU.2011080700/"+figurename+".png") ; system("convert -density 300 -resize 1000x1000 -trim "+figurename+".eps /nsftor/xhu/public_html/HurricaneImpactonO3/WRFV3.6.1/YSU/wrfNARR3dWSM6_CONUS_UCM_YSU.2011080700/"+figurename+".png") print("finish "+figurename+".eps") end do ; ifiles end