[ncl-talk] different orientations depending on output png or eps, wrf_overlays

xiaoming Hu yuanfangcan at hotmail.com
Thu Jan 5 10:31:20 MST 2017


Hello Mary


  "pltres at gsnMaximize = False" worked for me!

  Thank you so much!


Xiaoming


________________________________
From: Mary Haley <haley at ucar.edu>
Sent: Thursday, January 5, 2017 11:03 AM
To: Xiaoming Hu
Cc: xiaoming Hu; ncl-talk at ucar.edu
Subject: Re: [ncl-talk] different orientations depending on output png or eps, wrf_overlays

I was unable to run your script because of an error:

fatal:Subscript out of range, error in subscript #0

fatal:An error occurred reading zcordinate

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 256 in file wrf_CrossSection_WSPplusVecter_positive90tilt_smooth_for2ndMax_combine_another.ncl

I made a small modification to get it to run.

For starters, you cannot use "gsn" resources in a "setvalues" call. "gsn" resources are only meant to be passed to various gsn_xxxx or wrf_xxx routines (in some cases).

Part of the issue is that you are trying to use wrf_xxxx routines for plotting some highly customized plots. The wrf_xxxx routines are really meant to be used as "black box" type of scripts without a lot of plot customizations.  I always tell users that if they want to do major customizations, to use the gsn_csm_xxx scripts.

However, having said all that, the real issue is that whenever you set gsnMaximize to True, this is going to cause your plots to be maximized in whatever output device you are sending it to, including having the plot rotated if it fits better in a landscape orientation.

Many of the wrf_xxxx plotting routines set gsnMaximize to True under the hood, so in order to turn this off, you have to set gsnMaximize to FAlse.  wrf_overlays is one of those routines that sets gsnMaximize to True, so I suggest setting this resource before you call wrf_overlays:

  pltres at gsnMaximize = False

Remove *all* other settings of gsnMaximize set in your code, and any references to gsnPaperOrientation, wkOrientation, and gsnOrientation (which is not a valid resource, byt the way). Since "portrait" is the default mode, you don't need to set any orientation resources.


--Mary



On Thu, Jan 5, 2017 at 8:57 AM, Xiaoming Hu <xhu at ou.edu<mailto:xhu at ou.edu>> wrote:
Hello Mary

   Thanks a lot!
   I actually used  "vpYF"             : 0.9-ispecies*0.3484, see below:

"
        plot = wrf_overlays(a,wks,(/contour_theta,vector,contour_ter,contour_ter3/),pltres)
      setvalues contour_theta
         "vpHeightF"        : 0.34
;         "vpYF"             : 0.93-ispecies*0.34084
         "vpYF"             : 0.9-ispecies*0.3484
;         "vpWidthF"         : 0.35
;         "vpXF"             : 0.15+ispecies*0.355
         "tiMainOffsetYF"   : -0.01
;         "gsnRightString"   : "RString" ; res at TimeLabel
         "gsnPaperOrientation" : "portrait"
        "tmXBLabelFontHeightF"    : 0.0182
        "tiYAxisFontHeightF"      : 0.01820  ; effective
        "tmYLLabelFontHeightF"    : 0.0182
        "tiXAxisFontHeightF"      : 0.0182
        "tiYAxisOffsetXF" : 0.012
        "tmYLLabelDeltaF" : -0.8

       end setvalues
"

  I tested "res at gsnMaximize = True" as you suggested, I still got   (when output eps)

But if I output png, then it is portrait (i.e., rotated)

I put my script and input data at
http://www.caps.ou.edu/micronet/WRF-UCM/FocusON_OKC/WRFV3.7.1/with_rr_fixed/wrfNARR2d_UCM_Snudge_WangRec53wave.2002_2015Mean/wrf_CrossSection_WSPplusVecter_positive90tilt_smooth_for2ndMax_combine_another.ncl
http://www.caps.ou.edu/micronet/WRF-UCM/FocusON_OKC/WRFV3.7.1/with_rr_fixed/wrfNARR2d_UCM_Snudge_WangRec53wave.2002_2015Mean/wrfout_d02_21_ncea_14yrAugmean_wrfNARR2d_UCM_Snudge_WangRec53wave.nc
You should be able to run the script.

Thanks a lot!
Xiaoming
http://xiaominghu.oucreate.com/


On 01/05/2017 09:23 AM, Mary Haley wrote:
Hi Xiaoming,

I assume you are using gsn_panel to do the final draw of these two plots.

If so, you want to set gsnMaximize to True *and* set gsnPaperOrientation.

I've included a short script that illustrates this. Change the "orientation" variable to the desired orientation and run the script.

--Mary


On Wed, Jan 4, 2017 at 11:18 AM, xiaoming Hu <yuanfangcan at hotmail.com<mailto:yuanfangcan at hotmail.com>> wrote:

Interesting, I got different orientations depending on output png or eps. If I output png, I got portrait, but I got landscape if I output eps.


See my output figure

http://www.caps.ou.edu/micronet/WRF-UCM/FocusON_OKC/WRFV3.7.1/with_rr_fixed/wrfNARR2d_UCM_Snudge_WangRec53wave.2002_2015Mean/wrfout_d02_W_crossSN90_2ndMax_smooth_partial_8.png


http://www.caps.ou.edu/micronet/WRF-UCM/FocusON_OKC/WRFV3.7.1/with_rr_fixed/wrfNARR2d_UCM_Snudge_WangRec53wave.2002_2015Mean/wrfout_d02_W_crossSN90_2ndMax_smooth_partial_8.eps


See my script:

http://www.caps.ou.edu/micronet/WRF-UCM/FocusON_OKC/WRFV3.7.1/with_rr_fixed/wrfNARR2d_UCM_Snudge_WangRec53wave.2002_2015Mean/wrf_CrossSection_WSPplusVecter_positive90tilt_smooth_for2ndMax_combine_another.ncl


I tried a few resources (including gsnPaperOrientation,  wkOrientation = "portrait" ) to rotate the eps orientation, but all failed. Currently landscape, I want portrait.


Any suggestions?


 Thanks a lot!

Xiaoming


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/14bb87ed/attachment.html 


More information about the ncl-talk mailing list