[ncl-talk] Page Orientation with WRF Panel Plots

Mary Haley haley at ucar.edu
Thu Dec 1 11:11:02 MST 2016


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161201/72110c79/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_plot_geo_domains_gsn.pdf
Type: application/pdf
Size: 397884 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161201/72110c79/attachment-0001.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_WRF_terrain_post_gsn.ncl
Type: application/octet-stream
Size: 1881 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161201/72110c79/attachment-0001.obj 


More information about the ncl-talk mailing list