[ncl-talk] Issues with label bar titles and printing decimals with zeroes

Adam Phillips asphilli at ucar.edu
Tue Sep 4 14:16:42 MDT 2018


Hi Ty,
The wrf* plotting functions set a number of things automatically for you
behind the scenes, which is convenient if you are happy with the style of
the plot they return. If you'd like to change some things, it can get
complicated. In this case, I think your label bar title is getting pushed
off of the bottom of the plot. Looking at the coding of wrf_contour, it
calls a function called set_lb_resources, and that function has the
following lines:
file: $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl

opts at lbTitleOn              = get_res_value_keep(opts,"lbTitleOn", True)
      opts at lbTitleString          =
get_res_value_keep(opts,"lbTitleString", lb_desc)
      opts at lbTitleJust            = get_res_value_keep(opts,"lbTitleJust",
"BottomCenter")
      opts at lbTitleOffsetF         =
get_res_value_keep(opts,"lbTitleOffsetF", -0.5)

get_res_value_keep will check to see if a resource is set, and if not,
assigns the 3rd input as the resource value. It thus looks to me like
lbTitleJust is getting set to BottomCenter, and lbTitleOffsetF is getting
set to -0.5. I would try setting res at lbTitleJust = "TopCenter" in your
script, and see if the title appears. (You can also set lbTitleOffsetF to a
different value if you so desire.)

With regards to the labels, try setting this:
res at cnExplicitLabelBarLabelsOn = True
res at lbLabelStrings =
(/"0.1","0.25","0.5","1","2","4","8","16","32","64","96"/)

A word of caution with doing this though: You are overwriting the label bar
labels, and thus they are not connected to your cnLevels setting. So if you
change cnLevels that will not be reflected in the lbLabelStrings resource
automatically; you will need to alter lbLabelStrings as well.

Hope that helps. If you have further questions let ncl-talk know.
Adam


On Sun, Sep 2, 2018 at 12:45 PM Ty Buckingham <
ty.buckingham at manchester.ac.uk> wrote:

> Hi all,
>
> I'm having a few (probably easily solvable) issues regarding the label bar
> resources. Even using the resource:
>
> res at lbTitleString            =  "Precipitation Rate (mm/h)"
>
>
> No title is appearing on my label bar, and I'm not entirely sure why that
> is.
>
>
> Also, I've tried using a few instances of using 'sprintf' in order to add
> the zeros onto my decimals. As you can see on the attached plots, label bar
> values are printed as ".1" rather than "0.1". Is there any easy solution to
> this?
>
>
> I've attached my script.
>
>
> Thanks
>
> Ty
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180904/a4cbf84f/attachment.html>


More information about the ncl-talk mailing list