; 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 from a a given point A to point B ; Vertical coordinate is pressure load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" begin ; ; The WRF ARW input file. ; This needs to have a ".nc" appended, so just do it. a = addfile("../wrfout_d01_2000-01-24_12:00:00.nc","r") ; We generate plots, but what kind do we prefer? type = "x11" ; type = "pdf" ; type = "ps" ; type = "ncgm" wks = gsn_open_wks(type,"plt_CrossSection3") ; Set some basic resources res = True res@MainTitle = "REAL-TIME WRF" res@vpWidthF = .9 ; overwrite basic plot size res@vpHeightF = 1.0 pltres = True ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FirstTime = True times = wrf_user_getvar(a,"times",-1) ; get times in the file ntimes = dimsizes(times) ; number of times in the file mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file nd = dimsizes(mdims) ;--------------------------------------------------------------- do it = 0,ntimes-1 ; TIME LOOP print("Working on time: " + times(it) ) res@TimeLabel = times(it) ; Set Valid time to use on plots th = wrf_user_getvar(a,"th",it) ; theta rh = wrf_user_getvar(a,"rh",it) ; relative humidity z = wrf_user_getvar(a, "z",it) ; grid point height p = wrf_user_getvar(a, "pressure",it) ; grid point height ;--------------------------------------------------------------- ; Cross section opts = True ; specifying start and end points plane = new(4,float) plane = (/ 10,30 , 30,10 /) ; start x;y & end x;y point rh_plane = wrf_user_intrp3d(rh,p,"v",plane,0.,opts) th_plane = wrf_user_intrp3d(th,p,"v",plane,0.,opts) ; Let's create nice labels - only have to do this once if ( FirstTime ) then zmax = 200. ; Place top at model top or close to zmax zz = wrf_user_intrp3d(p,p,"v",plane,0.,opts) z_ind = ind(.not.ismissing(zz(:,0))) zmin = zz(z_ind(0),0) delete(z_ind) nice_levs = floor((zmin-zmax)/50)*50 zmax = zmin - nice_levs dims = dimsizes(zz) zmax_pos = dims(0)-1 do imax = 1,dims(0)-1 if ( .not.ismissing(zz(imax,0)) .and. zz(imax,0) .ge. zmax ) then zmax_pos = imax end if end do zspan = zmax_pos zmax = zz(zmax_pos,0) nz = floattoint((zmin-zmax)/50+1) FirstTime = False end if ; Options for XY Plots opts_xy = res opts_xy@tiYAxisString = "Pressure (mb)" opts_xy@AspectRatio = 0.75 opts_xy@cnMissingValPerimOn = True opts_xy@cnMissingValFillColor = 0 opts_xy@cnMissingValFillPattern = 11 opts_xy@tmYLMode = "Explicit" opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks opts_xy@tmYLLabels = sprintf("%.0f",fspan(zmin,zmax,nz)) ; Create labels opts_xy@tiXAxisFontHeightF = 0.020 opts_xy@tiYAxisFontHeightF = 0.010 opts_xy@tmXBMajorLengthF = 0.02 opts_xy@tmYLMajorLengthF = 0.02 opts_xy@tmYLLabelFontHeightF = 0.0001 opts_xy@PlotOrientation = th_plane@Orientation ; Plotting options for RH opts_rh = opts_xy opts_rh@pmLabelBarOrthogonalPosF = -0.07 opts_rh@ContourParameters = (/ 10., 90., 10. /) opts_rh@cnFillOn = True opts_rh@cnFillColors = (/"White", \ "White","DarkOliveGreen1","Chartreuse","Green", \ "Green1","Green3","Green4", \ "ForestGreen","PaleGreen4"/) ; Plotting options for Temperature opts_th = opts_xy opts_th@cnInfoLabelOrthogonalPosF = 0.00 opts_th@ContourParameters = (/ 270., 460., 2. /) ; Get the contour info for the rh and temp contour_th = wrf_contour(a,wks,th_plane(0:zmax_pos,:),opts_th) contour_rh = wrf_contour(a,wks,rh_plane(0:zmax_pos,:),opts_rh) ; MAKE PLOTS plot = wrf_overlays(a,wks,(/contour_rh,contour_th/),pltres) ; Delete options and fields, so we don't have carry over delete(opts_th) delete(opts_rh) delete(th_plane) delete(rh_plane) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end do ; END OF TIME LOOP end