; Example of using panels with WRF data ; In this case we first get all the data - then plot 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_panel2-2") ; Set some basic resources res = True res@NoHeaderFooter = True ; Switch headers and footers off res@pmLabelBarOrthogonalPosF = -0.1 res@lbTitleOn = False pltres = True pltres@PanelPlot = True ; Indicate these plots are to be paneled. mpres = True mpres3 = True ;mpres3@mpGeophysicalLineColor = "Black" ;mpres3@mpNationalLineColor = "Black" ;mpres3@mpUSStateLineColor = "Black" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; What times and how many time steps are in the data set? times = wrf_user_getvar(a,"times",-1) ; get all times in the file ntimes = dimsizes(times) ; number of times in the file ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; First get the variables we will need slp = wrf_user_getvar(a,"slp",-1) ; slp wrf_smooth_2d( slp, 3 ) ; smooth slp tc2 = wrf_user_getvar(a,"T2",-1) ; T2 in Kelvin tc2 = tc2-273.16 ; T2 in C td2 = wrf_user_getvar(a,"td2",-1) ; Td2 in C u10 = wrf_user_getvar(a,"U10",-1) ; u at 10 m, mass point v10 = wrf_user_getvar(a,"V10",-1) ; v at 10 m, mass point tf2 = 1.8*tc2+32. ; Turn temperature into Fahrenheit tf2@description = "Surface Temperature" tf2@units = "F" td_f = 1.8*td2+32. ; Turn temperature into Fahrenheit td_f@description = "Surface Dew Point Temp" td_f@units = "F" u10 = u10*1.94386 ; Turn wind into knots v10 = v10*1.94386 u10@units = "kts" v10@units = "kts" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; plots = new ( 4, graphic ) do it = 0,ntimes-1 print("Working on time: " + times(it) ) res@TimeLabel = times(it) ; Set Valid time to use on plots ; Plotting options for T opts = res opts@cnFillOn = True opts@ContourParameters = (/ -20., 90., 5./) opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map contour_tc = wrf_contour(a,wks,tf2(it,:,:),opts) contour_tc2 = wrf_contour(a,wks,tf2(it,:,:),opts) delete(opts) ; Plotting options for Td opts = res opts@cnFillOn = True opts@cnLinesOn = True opts@cnLineLabelsOn = True opts@ContourParameters = (/ -20., 90., 5./) opts@cnLineLabelBackgroundColor = -1 opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map contour_td = wrf_contour(a,wks,td_f(it,:,:),opts) delete(opts) ; Plotting options for SLP opts = res opts@cnFillOn = True contour_psl2 = wrf_contour(a,wks,slp(it,:,:),opts) opts@ContourParameters = (/ 996, 1032., 4. /) opts@cnFillOn = False opts@cnInfoLabelOrthogonalPosF = -0.115 opts@cnLineColor = "NavyBlue" opts@cnHighLabelsOn = True opts@cnLowLabelsOn = True opts@cnLineLabelBackgroundColor = -1 opts@gsnContourLineThicknessesScale = 2.0 contour_psl = wrf_contour(a,wks,slp(it,:,:),opts) delete(opts) ; Plotting options for Wind Vectors opts = res opts@FieldTitle = "Wind" ; overwrite Field Title opts@NumVectors = 35 ; density of wind barbs vector = wrf_vector(a,wks,u10(it,:,:),v10(it,:,:),opts) delete(opts) ; MAKE PLOTS plots(0) = wrf_map_overlays(a,wks,(/contour_tc/),pltres,mpres) plots(1) = wrf_map_overlays(a,wks,(/contour_tc2,contour_psl/),pltres,mpres) plots(2) = wrf_map_overlays(a,wks,(/contour_td/),pltres,mpres) plots(3) = wrf_map_overlays(a,wks,(/contour_psl2,vector/),pltres,mpres3) ; Panel the WRF plots. pnlres = True pnlres@txString = "PLOTS for : " + times(it) pnlres@gsnPanelYWhiteSpacePercent = 5 ; Add white space b/w plots. pnlres@gsnPanelScalePlotIndex = 1 gsn_panel(wks,(/plots/),(/2,2/),pnlres) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end do ; END OF TIME LOOP end