Re: NCL plot orientation changing from one computer cluster to another

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 14 2012 - 09:58:00 MDT

Hi Kelly,
I believe that those 2 resources need to be set in the pltres resource
list that gets passed to wrf_map_overlays. Try setting:
pltres@gsnMaximize = True
pltres@gsnPaperOrientation = True

If I understand correctly the way the WRF plotting functions work, your
opts_r resource list controls the way your plot is drawn (Not including
drawing over a map) via wrf_contour.. Your pltres resource list
generally controls the way the plot is drawn, and your mpres resource
list controls the various map resources, both resource lists getting
passed through wrf_map_overlays.

I find all that slightly confusing but it's the price that's paid when
the WRF plotting functions do a whole bunch of automatic things behind
the scenes to make things easier for the user.

Anyway, give that a shot and let us know if that doesn't do the trick.. Adam

On 03/14/2012 09:18 AM, Kelly Mahoney wrote:
> Thanks, Dave, for your suggestions! I really appreciate your response.
>
> I tried both of those solutions as well and still the image is rotated
> 90-degrees, to be in portrait mode.
>
> I suppose I can just rotate all of my images after the fact, but it
> seems like there should be a way to get it to plot correctly from the
> start!
>
> Thanks again,
> Kelly
>
>
>
>
> On 3/13/2012 5:15 PM, Dave Allured wrote:
>> Oops, my answer was incomplete. See the documentation for the
>> gsnPaperOrientation resource for the full explanation.
>>
>> res = True
>> res@gsnMaximize = True
>> res@gsnPaperOrientation = "landscape"
>>
>> Alternatively, try the wkOrientation resource. I have not tried this.
>> The resource is passed in a different way, not through the "res"
>> variable. See the documentation page for gsn_open_wks:
>>
>> wks_type = "ps" ; or "pdf"
>> wks_type@wkOrientation = "landscape"
>> wks = gsn_open_wks (wks_type, "AZAR_1km_D02_precip_mm_NPVU_colors_v2"+nf)
>>
>> HTH.
>>
>> --Dave
>>
>> On Tue, Mar 13, 2012 at 4:20 PM, Dave Allured<dave.allured@noaa.gov> wrote:
>>> Move this line down below "res = True":
>>>
>>> gsnPaperOrientation = "landscape"
>>>
>>> and change it to read:
>>>
>>> res@gsnPaperOrientation = "landscape"
>>>
>>> --Dave
>>>
>>> On Tue, Mar 13, 2012 at 4:12 PM, Kelly Mahoney<kelly.mahoney@noaa.gov> wrote:
>>>> Hi,
>>>>
>>>> I just wanted to follow-up on an email from last week about changing
>>>> computing clusters (but not NCL versions or codes) and experiencing
>>>> changes in postscript output.
>>>>
>>>> Some of the issues I have since attributed to a different version of
>>>> ImageMagick, which I was using for viewing.
>>>>
>>>> The one outstanding question though, is about image orientation --
>>>> namely that the plot used to be landscape, and now it is portrait, and I
>>>> can't hardwire the code to do anything besides that.
>>>>
>>>> The example is below -- any help would be greatly appreciated!
>>>>
>>>> Thanks,
>>>> Kelly
>>>>
>>>>
>>>> ;*************************************************
>>>> ; WRF_pcp_1.ncl
>>>> ;
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>
>>>> begin
>>>> ;
>>>> ; Open file and get variables.
>>>> ;
>>>>
>>>> fils = systemfunc("ls ./wrfout_d02_*")+".nc" ; fils is a variable
>>>> of type list (vs. one fil would be a variable of type file)
>>>> nfil = dimsizes(fils) ; create a count of
>>>> individual files instead of...
>>>> ; concatonating
>>>> variable from all files all together
>>>>
>>>> do nf=24,24
>>>>
>>>> f=addfile(fils(nf),"r")
>>>> times = wrf_user_list_times(f) ; get time(s) in the file
>>>> ;
>>>> ; Get non-convective, convective
>>>> ; Calculate total precipitation
>>>> ;
>>>>
>>>> rain_exp = wrf_user_getvar(f,"RAINNC",-1)
>>>> rain_con = wrf_user_getvar(f,"RAINC", -1)
>>>>
>>>> rain_tot = (rain_exp + rain_con)
>>>> rain_tot@description = "CTRL Run 1km(D02) 24-h precip (mm) ending
>>>> "+times(:)
>>>>
>>>> wks =
>>>> gsn_open_wks("ps","AZAR_1km_D02_precip_mm_NPVU_colors_v2"+nf) ; Open
>>>> graphics file.
>>>> ;km gsnMaximize = True ;km have tried this true and false...
>>>> gsnPaperOrientation = "landscape"
>>>> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>>>>
>>>> ;
>>>> ; Set up resource list that will be shared between the
>>>> ; two wrf_contour calls.
>>>> ;
>>>> res = True
>>>> res@gsnDraw = False
>>>> res@gsnFrame = False
>>>> res@cnLevelSelectionMode = "ExplicitLevels"
>>>> res@cnFillOn = True
>>>> res@cnLinesOn = False
>>>> res@lbLabelAutoStride = True
>>>>
>>>>
>>>> ; Plotting options for Precipitation
>>>> opts_r = res
>>>> ; Plotting options for Precipitation
>>>> opts_r = res
>>>> opts_r@UnitLabel = "mm"
>>>> opts_r@cnLevelSelectionMode = "ExplicitLevels"
>>>> opts_r@cnLevels = (/ .25, 2.5, 6.4, 12.7, 19.1, 25.4,
>>>> 38., 51., 64., 76., 102., 127., 152., 203., 254. /)
>>>> opts_r@cnInfoLabelOn = False
>>>> opts_r@cnConstFLabelOn = False
>>>> opts_r@cnFillOn = True
>>>> opts_r@cnFillColors =
>>>> (/-1,35,20,4,86,57,70,104,123,140,155,168,177,190,201,-1/)
>>>>
>>>>
>>>> opts_r@cnSmoothingOn = True
>>>> opts_r@cnSmoothingDistanceF = .005
>>>>
>>>> ; Resources to control precipitation labelbar, which will be
>>>> ; vertical.
>>>> opts_r@lbTitleString = "Total Precipitation"
>>>> opts_r@lbTitleDirection = "Down"
>>>> opts_r@lbTitleJust = "CenterRight"
>>>> opts_r@lbTitlePosition = "Right"
>>>> opts_r@lbTitleOffsetF = 0.07
>>>> opts_r@ValidTime = True
>>>> opts_r@TimeLabel = times(:)
>>>>
>>>> opts_r@lbOrientation = "Vertical"
>>>> opts_r@pmLabelBarSide = "Right"
>>>> opts_r@pmLabelBarHeightF = 0.77
>>>> opts_r@pmLabelBarWidthF = 0.11
>>>> opts_r@pmLabelBarOrthogonalPosF = 0.03
>>>> opts_r@lbBoxMinorExtentF = 0.4
>>>>
>>>> ; Total Precipitation (color fill)
>>>> contour_tot = wrf_contour(f, wks, rain_tot(0,:,:), opts_r)
>>>>
>>>> ;
>>>> ; Use the special wrf_map_overlays function to figure out
>>>> ; the correct map projection and do the overlay.
>>>> ;
>>>> ; Set up two resource lists for wrf_map_overlays.
>>>> ;
>>>> pltres = True
>>>> mpres = True
>>>> mpres@mpGeophysicalLineColor = "Black"
>>>> mpres@mpNationalLineColor = "Black"
>>>> mpres@mpUSStateLineColor = "Black"
>>>> mpres@mpGridLineColor = "Black"
>>>> mpres@mpLimbLineColor = "Black"
>>>> mpres@mpPerimLineColor = "Black"
>>>>
>>>> plot = wrf_map_overlays(f,wks,(/contour_tot/),pltres,mpres)
>>>>
>>>> end do
>>>> end
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 3/2/2012 8:56 AM, Kelly Mahoney wrote:
>>>>> Hi,
>>>>>
>>>>> I'm having trouble getting my NCL-generated plots to look the same on
>>>>> one computing system (NOAA's Zeus) as they do on another (NOAA ESRL's
>>>>> Jet).
>>>>>
>>>>> Using the exactly same scripts (example below), the exact same
>>>>> .hluresfile in my /home directory, and the same version of NCL
>>>>> (6.0.0), some of my plots on Zeus remain stuck in "portrait" mode with
>>>>> a transparent background, and on Jet, the plots are landscape and with
>>>>> a solid white background (the latter is as desired).
>>>>>
>>>>> I have also tried all of the known-to-me NCL methods
>>>>> (gsnPaperOrientation, gsnMaximize, etc.) for hardwiring the image
>>>>> orientation, but nothing changes no matter what I set them to.
>>>>>
>>>>> Has anyone else come across these types of issues and know of a way to
>>>>> fix them? I'm working with the computing folks on this too, but wanted
>>>>> to see if the NCL community had any insight that might help.
>>>>>
>>>>> Thank you!
>>>>> Kelly Mahoney
>>>>>
>>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 14 09:58:18 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 20 2012 - 15:27:15 MDT