[ncl-talk] Page Orientation with WRF Panel Plots

Mary Haley haley at ucar.edu
Fri Dec 2 14:03:57 MST 2016


Hi Katie,

Good catch!  I think I was using the domain area from the first file for
all three files.

I was afraid there was a bug in your data, so I went overboard and created
three plots to make sure there wasn't.  I think it's all okay.  :-)

Here are the three plots and their images:

[1] plot_WRF_terrain_post_gsn_native.ncl

This plots all three data sets using the native map projection defined on
each file. This is the corrected version of what I sent you yesterday.

[2] plot_WRF_terrain_post_gsn_latlon.ncl

This plots all three data sets over a basic lat/lon projection. Since it's
not using the native projection on the files, it reads XLAT_M and XLONG_M
to correctly plot the data.

[3] plot_WRF_terrain_post_gsn_native_dom1.ncl

This plots all three data sets using the map projection defined on the
biggest domain (domain 1). Again, since I'm not using the native projection
for the two domains, I use XLAT and XLONG to correctly plot everything.
See attached

--Mary



On Thu, Dec 1, 2016 at 12:06 PM, Holman, Kathleen <kholman at usbr.gov> wrote:

> This is interesting.  The main problem with the "gsn" script and plot you
> sent is that the state boundaries are in the wrong places for the middle
> and bottom panels.  Those are the nests of the WRF simulation, and cover
> less and less area (in the state of California).
>
> Turning pnlres at gsnMaximize = True does put the figures in a portrait
> orientation, however the figures are then three different sizes.  I tried
> the pnlres at gsnPanelScalePlotIndex option to force the figures to the same
> size, but this had no effect.  I also tried forcing the plot heights using
> res at vpWidthF and res at vpHeightF, which also did not fix the problem.
>
> In the end, the three plots do show up in portrait mode now.
>
> Thanks for your help, Mary!!
>
> On Thu, Dec 1, 2016 at 11:11 AM, Mary Haley <haley at ucar.edu> wrote:
>
>> Thanks for providing the files, Katie, it looks like there's a bug, and I
>> admit I'm stumped by this one because "portrait" mode should have been the
>> default with your plots, since the panel area is higher than it is wide.
>>
>> There are some cases where your plots suddenly go into landscape mode,
>> for example if I add this:
>>
>> pnlres at gsnPanelBoxes = True
>>
>> This resource draws a red box around each object in a panel plot so you
>> can see how much room it is taking up. Sometimes there's "invisible" white
>> space around a plot (like with a blank title) and this resource helps you
>> see those.
>>
>> A quick fix is to add this resource to your panel plot:
>>
>> pnlres at gsnMaximize    = True
>>
>> Finally, you can remove the pltres at gsnPaperOrientation setting, because
>> this is likely having no effect.
>>
>> HOWEVER, after having said all this, I decided to create a "gsn" version
>> of this script, to see if it handled the paneling a little better. The
>> wrf_contour/wrf_map_overlays procedures are really tailored do to single
>> plots with nice titles, and are not easy to customize when you want to
>> throw them in a panel.
>>
>> Please see the attached "gsn" version of the script.  I use
>> "wrf_map_resources" so you can get the same map projection as what's
>> defined on the file. But, I then use gsn_csm_contour_map to plot the data.
>> One thing I noticed is that with the "gsn" version, you now get US states
>> for every plot.  I'm not sure if you wanted this or not?
>> --Mary
>>
>>
>>> The filename of my NCL script is "plot_WRF_terrain_post.ncl" without
>>> double quotes.
>>>
>>>   Katie
>>>
>>> On Tue, Nov 29, 2016 at 4:22 PM, Mary Haley <haley at ucar.edu> wrote:
>>>
>>>> Hi Katie,
>>>>
>>>> I tried to reproduce this problem using some geo_em files I have with
>>>> your script, but there's something weird going on.
>>>>
>>>> Can you provide your geo_em* files?  You can use our ftp, if the files
>>>> are not too large:
>>>>
>>>>     ftp ftp.cgd.ucar.edu
>>>>     <log in as "anonymous">
>>>>     <Use email address as password>
>>>>     cd incoming
>>>>     put <your files>
>>>>     quit
>>>>
>>>> Please note you can't list the contents of this directory; I'll need to
>>>> know the exact name of the file(s) in order to retrieve it (them). You can
>>>> email me offline with the filenames, if you are concerned about publicizing
>>>> them for any reason.
>>>>
>>>> Thanks,
>>>>
>>>> --Mary
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Nov 29, 2016 at 11:34 AM, Holman, Kathleen <kholman at usbr.gov>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to produce a portrait, three-panel plot of terrain heights
>>>>> from a nested WRF simulation.  When my workstation output type is set to
>>>>> x11, the plots show up as a 3x1 column.  However, when I change the
>>>>> workstation output type to pdf or ps, the plots are forced into landscape
>>>>> mode and some of the images are cut off.  The plots come out as a 3x1
>>>>> column that is rotated clockwise 90 degrees.  I have tried setting the
>>>>> gsnPaperOrientation option to "portrait" in four different setting
>>>>> locations with no success.  I receive no error messages when running the
>>>>> script, yet my settings are not being realized.
>>>>>
>>>>> Has anyone found a way to force WRF panel plots into a specific paper
>>>>> orientation?
>>>>>
>>>>> ​----------
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>>>
>>>>> begin
>>>>>
>>>>> ; type = "x11"
>>>>>  type = "pdf"
>>>>> ; type = "ps"
>>>>> ; type = "ncgm"
>>>>> wks = gsn_open_wks(type,"panel_plot_geo_domains")     ; Create a plot
>>>>> workstation
>>>>>
>>>>> gsn_define_colormap(wks,"rainbow")
>>>>> plot = new(3,graphic)
>>>>>
>>>>> fdir = "/home/kholman/WRF/WPS3.7/"
>>>>>
>>>>> res = True                              ; Create some plot resources
>>>>> res at cnFillOn = True                      ; Create a color fill plot
>>>>> res at cnLineLabelsOn = False
>>>>> res at NoHeaderFooter = True
>>>>> res at gsnSpreadColors = True
>>>>> res at lbLabelBarOn = False
>>>>> res at ContourParameters = (/0., 3500., 250./)
>>>>> res at gsnPaperOrientation = "Portrait"
>>>>>
>>>>> pltres = True
>>>>> pltres at PanelPlot = True
>>>>> pltres at gsnPaperOrientation = "Portrait"
>>>>>
>>>>> mpres = True
>>>>> mpres at mpGeophysicalLineColor      = "Black"  ; Overwrite basic map
>>>>> settings
>>>>> mpres at mpGridLineColor             = "Gray"
>>>>> mpres at mpLimbLineColor             = "Gray"
>>>>> mpres at mpNationalLineColor         = "Black"
>>>>> mpres at mpPerimLineColor            = "Black"
>>>>> mpres at mpUSStateLineColor          = "Black"
>>>>> mpres at gsnPaperOrientation = "Portrait"
>>>>>
>>>>> do j = 1,3
>>>>> a = addfile(fdir+"geo_em.d0"+j+".nc","r")   ; Open a file
>>>>>
>>>>> ter = a->HGT_M(0,:,:)                    ; Read the variable to memory
>>>>> contour = wrf_contour(a,wks,ter,res)
>>>>>
>>>>> plot(j-1) = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
>>>>>  ; Create plot
>>>>> delete([/ter/])
>>>>> end do
>>>>>
>>>>> pnlres                            = True
>>>>> pnlres at txString                   = ""
>>>>> pnlres at gsnPanelYWhiteSpacePercent = 5       ; Add white space b/w
>>>>> plots.
>>>>> pnlres at gsnPanelLabelBar           = True    ; Turn on common labelbar
>>>>> pnlres at lbLabelAutoStride          = True    ; Spacing of lbar labels.
>>>>> pnlres at lbBoxMinorExtentF          = 0.15
>>>>> pnlres at gsnPaperOrientation = "Portrait"
>>>>>
>>>>> gsn_panel(wks,(/plot/),(/3,1/),pnlres)
>>>>>
>>>>> end
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Katie Holman, PhD
>>>>> Meteorologist
>>>>> Bureau of Reclamation
>>>>> Technical Service Center
>>>>> P.O. Box 25007, 86-68250
>>>>> Denver, CO 80225-0007
>>>>> 303-445-2571
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Katie Holman, PhD
>>> Meteorologist
>>> Bureau of Reclamation
>>> Technical Service Center
>>> P.O. Box 25007, 86-68250
>>> Denver, CO 80225-0007
>>> 303-445-2571
>>>
>>>
>>
>
>
> --
> Katie Holman, PhD
> Meteorologist
> Bureau of Reclamation
> Technical Service Center
> P.O. Box 25007, 86-68250
> Denver, CO 80225-0007
> 303-445-2571
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_plot_geo_domains_gsn_native_dom1.png
Type: image/png
Size: 228982 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0003.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_WRF_terrain_post_gsn_native_dom1.ncl
Type: application/octet-stream
Size: 3399 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0003.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_WRF_terrain_post_gsn_latlon.ncl
Type: application/octet-stream
Size: 3245 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0004.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_WRF_terrain_post_gsn_native.ncl
Type: application/octet-stream
Size: 3516 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0005.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_plot_geo_domains_gsn_native.png
Type: image/png
Size: 204332 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0004.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_plot_geo_domains_gsn_latlon.png
Type: image/png
Size: 211794 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161202/bb1f5c2e/attachment-0005.png 


More information about the ncl-talk mailing list