<div dir="ltr">Hi Tabish, <div>It would help the community answer your question if you could attach an image showing your plot.</div><div>Thanks,</div><div>Adam</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 13, 2018 at 4:03 PM, Tabish Ansari <span dir="ltr"><<a href="mailto:tabishumaransari@gmail.com" target="_blank">tabishumaransari@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Hi<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I am trying to panel my WRF domains: domain1 and domain3 which have very different aspect ratios and sizes. Currently using the following script I'm able to panel them together but not change their size. I tried using vp resources but without success. Can you please let me know what changes I make to this script to make the D03 same in height as D01 without changing aspect ratios?<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Here's the script:<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><span style="font-family:tahoma,sans-serif"><font size="1">; PANELPLOT OF WRF-CHEM D01 AND D03 PM2.5 CONCENTRATIONS CONTOUR MAPS ALONG WITH OBSERVATIONS<br></font></span></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><span style="font-family:tahoma,sans-serif"><font size="1"><span style="font-family:verdana,sans-serif">load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl"<br><br>;-----------------------------<wbr>------------------------------<wbr>-----------<br>; Procedure to attach colored markers to an NCL map, given 1D<br>; data, and lat/lon arrays, a set of levels, and a color map.<br>;-----------------------------<wbr>------------------------------<wbr>-----------<br>procedure add_obs_markers_to_map(wks,<wbr>plot,levels,colormap,data_1d,<wbr>lat_1d,lon_1d)<br>local mkres, nlevels, colors, nlevels, n, ii<br>begin<br><br>;---Set resources for the markers<br>  mkres = True<br>  mkres@gsMarkerIndex = 16<br>  mkres@gsMarkerSizeF = 0.0035<br>; Based on the levels we had for the contour plot and the colormap used,<br>; get an array of colors that span the colormap. This uses the same<br>; algorithm that the contour used, so the colors will be identical.<br>;<br>  nlevels = dimsizes(levels)<br>  colors = span_color_rgba(colormap,<wbr>nlevels+1)   ; Need one more color than number of levels<br><br>;<br>; Loop through each level, gather all the data values in the given level<br>; range, and add colored markers to the existing map.<br>;<br>  do n=0,nlevels<br><br>;---These "if" statements are how color contours are handled in NCL.<br>    if(n.eq.0) then<br>      ii := ind(data_1d.lt.levels(n))<br>    else if(n.eq.nlevels) then<br>      ii := ind(data_1d.ge.levels(n-1))<br>    else<br>      ii := ind(data_1d.ge.levels(n-1).<wbr>and.data_1d.lt.levels(n))<br>    end if<br>    end if<br>    if(any(ismissing(ii))) then<br>      continue<br>    end if<br><br>;---Add the markers<br>    mkres@gsMarkerColor = colors(n,:)    ; colors is an N x 4 array<br>    plot@$unique_string("markers")<wbr>$ = gsn_add_polymarker(wks,plot,<wbr>lon_1d(ii),lat_1d(ii),mkres)<br>  end do<br>end<br><br>;-----------------------------<wbr>------------------------------<wbr>-----------<br>; Main code<br>;-----------------------------<wbr>------------------------------<wbr>-----------<br>begin<br><br>;---Open WRF output file and read data<br><br>DATADir = "/data2/tabish/control-run-<wbr>so4-ECMWF/"<br>FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d01_2014-10* ")<br>numFILES = dimsizes(FILES)<br><br>s=1<br>a = addfile(FILES(0)+".nc","r"); THIS IS JUST FOR INITIALIZATION OF PM25 ARRAY, IT WILL BE SUBSTRACTED FROM THE SUM IN THE END<br>pm25init =  a->PM2_5_DRY(15,0,:,:)<br>pm25sum =  pm25init<br>times = wrf_user_getvar(a,"times",-1)  ; get all times in the file<br>ntimes = dimsizes(times)<br>do it = 16,ntimes-1,1             ; TIME LOOP<br>    s=s+1<br>    print("Working on time: " + times(it) )<br>    pm25sum = pm25sum + a->PM2_5_DRY(it,0,:,:)<br>end do ; END OF TIME LOOP<br><br>do ifil = 1,numFILES-2             ; FILE LOOP<br>  a = addfile(FILES(ifil)+".nc","r")<wbr>   ; Open the next file<br>  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file<br>  ntimes = dimsizes(times)<br>  do it = 0,ntimes-1,1             ; TIME LOOP<br>    s=s+1<br>    print("Working on time: " + times(it) )<br>    pm25sum = pm25sum + a->PM2_5_DRY(it,0,:,:)<br>  end do ; END OF TIME LOOP<br>end do<br><br>a = addfile(FILES(numFILES-1)+".<wbr>nc","r")   ; Open the next file<br>  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file<br>  ntimes = dimsizes(times)<br>  do it = 0,16,1             ; TIME LOOP<br>    s=s+1<br>    print("Working on time: " + times(it) )<br>    pm25sum = pm25sum + a->PM2_5_DRY(it,0,:,:)<br>  end do ; END OF TIME LOOP<br><br>pm25_avg=  pm25sum/s<br>pm25_avg@description = "PM2.5 conc in ug/m3"<br><br>  lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude<br>  lon2d = wrf_user_getvar(a,"XLONG",it)<br><br>  pm25_avg@lat2d = lat2d    ; for plotting<br>  pm25_avg@lon2d = lon2d<br>;---Will use this for contours and filled markers<br>  colormap = "BlAqGrYeOrReVi200"<br>  ;levels   = ispan(0,180,9)<br>  levels   = (/0,2,5,10,15,20,25,30,35,40,<wbr>45,50,55,60,65,70,80,90,100,<wbr>110,160,200/)<br><br>  wks = gsn_open_wks("x11","wrf_obs_<wbr>d01-d03_pm25")<br><br>;---Common resources shared by both contour plot and marker plot<br>  res                        = True<br>  res@gsnMaximize            = True<br>  res@gsnLeftString          = ""<br>  res@gsnRightString         = ""<br><br>  res@mpDataBaseVersion      = "MediumRes"<br> ; res@mpFillOn               = False<br> ; res@mpMinLatF              = min(pm25_avg@lat2d)<br> ; res@mpMaxLatF              = max(pm25_avg@lat2d)<br> ; res@mpMinLonF              = min(pm25_avg@lon2d)<br> ; res@mpMaxLonF              = max(pm25_avg@lon2d)<br> ; res@pmTickMarkDisplayMode  = "Always"      ; better map tickmarks<br><br> res@mpLimitMode       = "Corners"            ; choose range of map<br> res@mpLeftCornerLatF  = 51.8<br> res@mpLeftCornerLonF  = 82.6<br> res@mpRightCornerLatF = 22.66<br> res@mpRightCornerLonF = 130.499<br> res@mpProjection         = "LambertConformal"<br> res@mpLambertParallel1F = 20<br> res@mpLambertParallel2F = 50<br> res@mpLambertMeridianF  = 110<br><br><br><br>;---Resources for filled contour plot<br>  cnres                      = res<br>  cnres@cnFillOn             = True<br>  cnres@cnLevelSelectionMode = "ExplicitLevels"<br>  cnres@cnLevels             = levels<br>  cnres@cnFillPalette        = colormap<br>  cnres@cnLinesOn            = False<br>  cnres@cnLineLabelsOn       = False<br>  cnres@lbLabelBarOn         = False   ; will add in panel later<br>  cnres@pmTitleZone          = 2       ; move title down<br>  cnres@gsnAddCyclic         = False<br>  cnres@mpLimitMode       = "Corners"            ; choose range of map<br>  cnres@mpLeftCornerLatF  = 51.8<br>  cnres@mpLeftCornerLonF  = 82.6<br>  cnres@mpRightCornerLatF = 22.66<br>  cnres@mpRightCornerLonF = 130.499<br>  cnres@mpProjection         = "LambertConformal"<br>  cnres@mpLambertParallel1F = 20<br>  cnres@mpLambertParallel2F = 50<br>  cnres@mpLambertMeridianF  = 110<br><br>  cnres@mpFillOn                <wbr>    =  True<br>  cnres@mpOutlineDrawOrder      <wbr>    = "PostDraw"<br>  cnres@mpFillDrawOrder         <wbr>    = "PreDraw"<br> ; cnres@mpOutlineBoundarySets   <wbr>    = "National"<br>  cnres@mpOutlineBoundarySets   <wbr>    = "Allboundaries"<br>  cnres@mpUSStateLineDashPattern<wbr>    = 2<br>  cnres@mpOutlineOn           = True<br>  cnres@mpDataBaseVersion        = "MediumRes"<br>  cnres@mpDataSetName            = "Earth..4"      ; U.S. counties<br>  ;cnres@mpGridAndLimbOn = True<br>  ;cnres@mpGridLineColor = "Grey"<br>  cnres@mpFillColors = (/"transparent","transparent",<wbr>"gray","transparent"/)<br>  cnres@pmTickMarkDisplayMode = "Always"<br>  cnres@tiMainString = "Domain 1 @ 27km"<br>  cnres@tiDeltaF = 3.3<br>  cnres@tfDoNDCOverlay = True<br><br>  cnres@gsnDraw  = False                          ; don't draw<br>  cnres@gsnFrame = False                          ; don't advance frame<br><br>; cnres@vpWidthF         = 0.40<br> cnres@vpHeightF        = 0.20<br><br>;---Create smooth contour plot<br>  plot_wrf_d01 = gsn_csm_contour_map(wks,pm25_<wbr>avg,cnres)<br><br><br>delete(pm25init)<br>delete(pm25sum)<br>delete(pm25_avg)<br>delete(s)<br>delete(lat2d)<br>delete(lon2d)<br>;-----------------------------<wbr>------------------------------<wbr>-----------<br>; Recreate similar plot, but by using filled markers drawn over a map.<br>;-----------------------------<wbr>------------------------------<wbr>-----------<br> fname = "surfacedata_12-31_Octmean_<wbr>improved_nomissingval.txt"<br>  lines = asciiread(fname,-1,"string")<br>  lon = tofloat(str_get_field(lines(:)<wbr>,2," "))<br>  lat = tofloat(str_get_field(lines(:)<wbr>,3," "))<br>  pm25 = tofloat(str_get_field(lines(:)<wbr>,4," "))<br><br><br>;*****************************<wbr>************<br>; add black circles over obs data<br>;*****************************<wbr>************<br>  polyres               = True          ; poly marker mods desired<br>  polyres@gsMarkerIndex = 4            ; choose circle as polymarker<br>  polyres@gsMarkerSizeF = 5           ; select size to avoid streaking<br>  polyres@gsMarkerColor = (/"black"/)   ; choose color<br>  polyres@gsMarkerThicknessF  = 2.0<br>  tabish1=gsn_add_polymarker(<wbr>wks,plot_wrf_d01,lon,lat,<wbr>polyres)  ; draw polymarkers<br><br>;---Add colored markers to the map<br>  add_obs_markers_to_map(wks,<wbr>plot_wrf_d01,levels,colormap,<wbr>pm25,lat,lon)<br><br>;  draw(plot_wrf)<br>;  frame(wks)<br><br>;*****************************<wbr>******************<br>; NOW REPEATING THE SAME ROUTINE FOR D03<br>;*****************************<wbr>******************<br><br><br>  DATADir = "/data2/tabish/control-run-<wbr>so4-ECMWF/"<br>FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d03_2014-10* ")<br>numFILES = dimsizes(FILES)<br><br>s=1<br>a = addfile(FILES(0)+".nc","r"); THIS IS JUST FOR INITIALIZATION OF PM25 ARRAY, IT WILL BE SUBSTRACTED FROM THE SUM IN THE END<br>pm25init =  a->PM2_5_DRY(15,0,:,:)<br>pm25sum =  pm25init<br>times = wrf_user_getvar(a,"times",-1)  ; get all times in the file<br>ntimes = dimsizes(times)<br>do it = 16,ntimes-1,1             ; TIME LOOP<br>    s=s+1<br>    print("Working on time: " + times(it) )<br>    pm25sum = pm25sum + a->PM2_5_DRY(it,0,:,:)<br>end do ; END OF TIME LOOP<br><br>do ifil = 1,numFILES-2             ; FILE LOOP<br>  a = addfile(FILES(ifil)+".nc","r")<wbr>   ; Open the next file<br>  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file<br>  ntimes = dimsizes(times)<br>  do it = 0,ntimes-1,1             ; TIME LOOP<br>    s=s+1<br>    print("Working on time: " + times(it) )<br>    pm25sum = pm25sum + a->PM2_5_DRY(it,0,:,:)<br>  end do ; END OF TIME LOOP<br>end do<br>pm25_avg= pm25sum/s<br>;pm25_avg@description = "NO2 conc in ppbv"<br><br>  lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude<br>  lon2d = wrf_user_getvar(a,"XLONG",it)<br><br>  pm25_avg@lat2d = lat2d    ; for plotting<br>  pm25_avg@lon2d = lon2d<br> res@mpLimitMode       = "Corners"            ; choose range of map<br> res@mpLeftCornerLatF  = 36.05806<br> res@mpLeftCornerLonF  = 113.3356<br> res@mpRightCornerLatF = 42.4514<br> res@mpRightCornerLonF = 120.2583<br>  cnres@mpLimitMode       = "Corners"            ; choose range of map<br>  cnres@mpLeftCornerLatF  = 36.05806<br>  cnres@mpLeftCornerLonF  = 113.3356<br>  cnres@mpRightCornerLatF = 42.4514<br>  cnres@mpRightCornerLonF = 120.2583<br>cnres@tiMainString = "Domain 3 @ 3km"<br>cnres@vpKeepAspect = True<br> cnres@vpHeightF        = 0.20<br><br>;---Create smooth contour plot<br>  plot_wrf_d03 = gsn_csm_contour_map(wks,pm25_<wbr>avg,cnres)<br>;*****************************<wbr>************<br>; add black circles over obs data<br>;*****************************<wbr>************<br>  polyres               = True          ; poly marker mods desired<br>  polyres@gsMarkerIndex = 4            ; choose circle as polymarker<br>  polyres@gsMarkerSizeF = 5           ; select size to avoid streaking<br>  polyres@gsMarkerColor = (/"black"/)   ; choose color<br>  polyres@gsMarkerThicknessF  = 2.0<br>tabish3=gsn_add_polymarker(<wbr>wks,plot_wrf_d03,lon,lat,<wbr>polyres)  ; draw polymarkers<br><br>;---Add colored markers to the map<br>  add_obs_markers_to_map(wks,<wbr>plot_wrf_d03,levels,colormap,<wbr>pm25,lat,lon)<br><br><br>;---Panel both plots for comparison.<br>  pres                    = True<br>  pres@gsnMaximize        = True<br>  pres@gsnPanelLabelBar   = True<br>  pres@pmLabelBarWidthF   = 0.8<br>  pres@lbLabelFontHeightF = 0.01<br>  pres@gsnFrame = False<br>  pres@gsnPanelBottom   = 0.05                   ; add space at bottom<br>  gsn_panel(wks,(/plot_wrf_d01,<wbr>plot_wrf_d03/),(/1,2/),pres)<br><br>; Draw a text string at the bottom<br>  txres               = True<br>  txres@txFontHeightF = 0.012<br>  gsn_text_ndc(wks,"PM2.5 in ug/m3",0.5,0.28,txres)<br>  frame(wks)<br></span><span style="font-family:comic sans ms,sans-serif"><span style="font-family:verdana,sans-serif">; Maximize plots in frame.<br>; psres = True<br>; maximize_output(wks,psres)  ; calls draw and frame for you</span><br><br><br>end</span></font></span><br>        <br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Your help will be greatly appreciated.<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Thanks<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Tabish<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">                              <wbr>                              <wbr>                         <br clear="all"></div><div><div class="m_4250692523251620792gmail_signature"><div dir="ltr"><div><div><font size="1"><span style="font-family:tahoma,sans-serif">Tabish U Ansari<br></span></font></div><font size="1"><span style="font-family:tahoma,sans-serif">PhD student, Lancaster Environment Center<br></span></font></div><font size="1"><span style="font-family:tahoma,sans-serif">Lancaster Univeristy<br> <span>Bailrigg</span>, <span>Lancaster</span>, <br><span>LA1 4YW</span>, <span>United Kingdom</span></span></font><br></div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>