[ncl-talk] label bar title position (wrf)

Mary Haley haley at ucar.edu
Thu Jun 11 06:57:41 MDT 2015


Hi Matt,

Yes, it looks like the issue is that "wrf_contour" is trying to customize
the location of the labelbar.  Unfortunately, I honestly don't understand
why the title keeps moving drastically with seemingly little changes that I
make.

Here's a test script I was using, and I was able to get the title close,
but it's still shifted.  I think it has something to do with the "extent"
resources.  I'm hoping Dave will weigh in here.  I think you should be able
to run this script yourself, just substitute your own WRF output file.

If you continue to have problems with this, then you may want to consider
using gsn_csm_contour_map to plot your data instead. I'll include a sample
script below, after this one:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
  filename = "wrfout_d03_2012-04-22_23_00_00.nc"
  dir      = "$NCARGTEST/nclscripts/wrf_files/"
  a = addfile(dir + filename,"r")

  td   = wrf_user_getvar(a,"td",0)    ; 3D td

  td2  = td(0,:,:)                    ; Use lowest Td at time zero

  td_f = 1.8*td2+32.                   ; Turn temperature into Fahrenheit


  wks = gsn_open_wks("x11","test")

  td_f at description = "Surface Dew Point Temp"
  td_f at units       = "F"

  opts                            = True
  opts at cnFillOn                   = True
  opts at cnLinesOn                  = False
  opts at cnLineLabelsOn             = False
  opts at ContourParameters          = (/ -20., 90., 5./)
  opts at lbTitleOn         = True
  opts at lbTitleString     = td_f at units
  opts at lbTitlePosition   = "Right"
  opts at lbTitleDirection  = "Across"
  opts at lbTitleOffsetF    =  -0.08
  opts at lbTitleJust       =  "CenterRight"
; opts at lbTitleFontHeightF= .015

; opts at lbTitleExtentF = 0.55


  contour_td = wrf_contour(a,wks,td_f,opts)

  pltres = True
  mpres  = True
  plot   = wrf_map_overlays(a,wks,(/contour_td/),pltres,mpres)
end

Here's a similar plot, using gsn_csm_contour_map. We have more examples at:

http://www.ncl.ucar.edu/Applications/wrfgsn.shtml


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
  filename = "wrfout_d03_2012-04-22_23_00_00.nc"
  dir      = "$NCARGTEST/nclscripts/wrf_files/"
  a = addfile(dir + filename,"r")

  td   = wrf_user_getvar(a,"td",0)    ; 3D td

  td2  = td(0,:,:)                    ; Use lowest Td at time zero
                td_f = 1.8*td2+32.                   ; Turn temperature
into Fahrenheit

  wks = gsn_open_wks("x11","test")

  td_f at description = "Surface Dew Point Temp"
  td_f at units       = "F"

  opts                            = True
  opts at cnFillOn                   = True
  opts at cnLinesOn                  = False
  opts at cnLineLabelsOn             = False
  opts at cnLevelSelectionMode       = "ExplicitLevels"
  opts at cnLevels                   = ispan(-20,90,5)
  opts at lbTitleOn                  = True
  opts at lbTitleString              = td_f at units
  opts at lbTitlePosition            = "Right"
  opts at lbTitleDirection           = "Across"
  opts at lbTitleOffsetF             =  -0.09
  opts at lbTitleJust                =  "CenterRight"
  opts at lbTitleFontHeightF          = 0.015

; opts at lbTitleFontHeightF= .015                ; make title smaller
              ; opts at lbTitleExtentF = 0.55


  opts = wrf_map_resources(a,opts)
  opts at tfDoNDCOverlay = True

  plot = gsn_csm_contour_map(wks,td_f,opts)
end

On Wed, Jun 10, 2015 at 4:30 PM, Matt Masarik <mattmasarik at boisestate.edu>
wrote:

> Hi All,                     (version 6.3.0)
>
> I'm trying to place the title string for a plot label bar, just to the
> right of it, like in this image:
>
>   https://www.ncl.ucar.edu/Applications/Images/lb_4_lg.png
>
> Though my output looks like (see attached .png).  The relevant resources I
> am setting
> are:
>
>   cnres at lbTitleOn           = True
>   cnres at lbTitleString      = slp at units
>   cnres at lbTitlePosition   = "Right"
>   cnres at lbTitleDirection  = "Across"
>
> The resources are set the same as in the example.  Though the example uses
>
>   gsn_csm_contour_map_ce()
>
> and I am using
>
>   wrf_contour() & wf_map_overlays().
>
> Is the issue due to using the wrf_... routines vs. the gsn_csm...
> routine?  If so, is there
> a work-around to get the desired positioning?
>
> Thanks,
> Matt
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20150611/193384bf/attachment.html 


More information about the ncl-talk mailing list