[ncl-talk] labelbar

Barry Lynn barry.h.lynn at gmail.com
Thu Jun 6 13:03:05 MDT 2019


Hello:

I don't know if this will help, but here is snippet of code I use to label
my label bars.

 levels= (/10,20,30,40,50,60/)

 n_colors = 7

 sres_colors = (/ \

                                    "SpringGreen1", \

                                    "SpringGreen4", \


"Yellow","Orange","Red1","HotPink1","Violet"/)

  sres at cnLevels             = (/15,25,35,45,55/)

  sres at cnFillOpacityF = 0.80

  sres at cnFillColors         = sres_colors

  sres at lbLabelAlignment     = "BoxCenters"

  sres at lbLabelStrings       = (/"10-20","20-30","30-40","40-50","50-60",">
60"/)

On Thu, Jun 6, 2019 at 8:28 PM Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Frank,
>
> Apologies for the delay in response -- I've been in a hectic workshop
> these past 3 days. I sat down to look at this problem. Indeed, the source
> of the warning message is that one of the labelbar end-values is a space.
> In looking into how that comes to be, I stumbled across this note in the
> docs for cnLabelBarEndStyle:
>
> IncludeMinMaxLabels The two end boxes represent the fill color and/or
> patterns used for areas of the plot where the data is below the minimum
> contour level or above the maximum contour level. The first and last
> labels, representing the minimum and maximum values in the field, are
> aligned with the exterior boundaries of the outer boxes. However, if the
> minimum and/or maximum field values fall within the range specified by the
> minimum and maximum contour levels, one or both of these labels will be set
> to an empty string.
>
> The range of data values in this particular example is on the order of -29
> ... -14.5  Indeed, if I set the min/maxLevelVals to something like -25/-15,
> I do get a labelbar that has the outer edges labelled.
>
> So, it seems the code is behaving in a manner intended, and I'm not sure
> what to suggest. You could force the issue by explicitly labeling the
> labelbar, if you really want a guaranteed span of values.
>
> I wish I had a better answer...
> Rick
>
>
>
> On Mon, Jun 3, 2019 at 11:22 PM Kreienkamp Frank <Frank.Kreienkamp at dwd.de>
> wrote:
>
>> Hello Rick,
>>
>>
>>
>> i have now a complete example (ncl, data, colortable).
>>
>>
>>
>> The target is to have a label bar covering 9 colors with labels on both
>> ends and being based on a min, max, step definition and a 9 step color
>> table.
>>
>>
>>
>> Frank
>>
>>
>>
>> *Von:* Rick Brownrigg [mailto:brownrig at ucar.edu]
>> *Gesendet:* Montag, 3. Juni 2019 14:44
>> *An:* Kreienkamp Frank
>> *Cc:* ncl-talk at ucar.edu
>> *Betreff:* Re: [ncl-talk] labelbar
>>
>>
>>
>> Hi,
>>
>>
>>
>> The place in the code where the warning message is issued is guarded by
>> this conditional:
>>
>>
>>
>>
>> if(end_labels_on.and.end_labelbar_style.eq.get_enum_value("IncludeMinMaxLabels").and.
>> \
>>         (lbstrings(0).eq."".or.lbstrings(nlab-1).eq."")) then
>>
>>
>>
>> It appears as though at least one of the end-labels is blank. Its not
>> clear to me why, and I would need your code and datasets in order to track
>> this down.  (BTW: I a bit puzzled by the narrowing of the label range -- I
>> might have thought widening it was in order; e.g., -135 - 15. / 0 + 15. ??)
>>
>>
>>
>> Rick
>>
>>
>>
>> On Mon, Jun 3, 2019 at 12:50 AM Kreienkamp Frank <Frank.Kreienkamp at dwd.de>
>> wrote:
>>
>> Hello,
>>
>>
>>
>> to solve my problem can change  the Min and Max value to
>>
>> Min + cnLevelSpacingF
>>
>> Max – cnLevelSpacingF
>>
>> and using res at cnLabelBarEndStyle            = " IncludeMinMaxLabels"
>>
>>
>>
>>
>> unfortunately I get an warning:
>>
>> (0)        Warning: add_labelbar: invalid end labels, turning them off.
>>
>>
>>
>> The colors are shown all. But no labeling at the ends. (NCL version 6.4.0)
>>
>>
>>
>> ;************************************************
>>
>> ; adding color definition
>>
>>    res at cnFillPalette                             = "NCL_DWD_RedYellow"
>>
>> ;************************************************
>>
>> ; adding map
>>
>>    res at cnFillOn                      = True               ; color Fill
>>
>>    res at cnFillMode                    = "RasterFill"       ; Raster Mode
>>
>>    res at cnLinesOn                     =  False             ; Turn off
>> contour lines
>>
>>    res at cnLevelSelectionMode          = "ManualLevels"
>>
>>    res at cnMinLevelValF       =    -135.0 + 15.             ; min contour
>> level
>>
>>    res at cnMaxLevelValF       =       0.0 - 15.              ; max contour
>> level
>>
>>    res at cnLevelSpacingF      =      15.0             ; contour spacing
>>
>>    res at cnLabelBarEndStyle            = "IncludeMinMaxLabels"
>>
>>    ;res at cnLabelBarEndStyle            = "IncludeMinMaxLabels"
>> ;"ExcludeOuterBoxes"        ; no additional ColorBoxes
>>
>>    res at gsnAddCyclic                  = False              ; regional
>> data: not cyclic
>>
>> ;************************************************
>>
>> ; Plot will just be created, and not drawn yet.
>>
>>    plot                              = gsn_csm_contour_map(wks,u,res)
>>
>>
>>
>>
>>
>> Frank
>>
>>
>>
>>
>>
>> *Von:* Kreienkamp Frank [mailto:Frank.Kreienkamp at dwd.de]
>> *Gesendet:* Mittwoch, 29. Mai 2019 09:15
>> *An:* Barry Lynn; Kreienkamp Frank
>> *Cc:* ncl-talk at ucar.edu
>> *Betreff:* AW: [ncl-talk] labelbar
>>
>>
>>
>> Hello,
>>
>>
>>
>> if you look at the included labelbar you can see that two colors are
>> shown twice (position 2+3 and 7+8). The two other colors from the palette
>> are not shown.
>>
>>
>>
>> [image: cid:image002.png at 01D515F2.EC6CCD40]
>>
>>
>>
>> Frank
>>
>>
>>
>> *Von:* Barry Lynn [mailto:barry.h.lynn at gmail.com]
>> *Gesendet:* Mittwoch, 29. Mai 2019 08:25
>> *An:* Kreienkamp Frank
>> *Cc:* ncl-talk at ucar.edu
>> *Betreff:* Re: [ncl-talk] labelbar
>>
>>
>>
>> Hi:
>>
>>
>>
>> Could you please explain in greater detail what you mean by: "not all
>> colors are shown."
>>
>>
>>
>> Thank you,
>>
>>
>>
>> On Wed, May 29, 2019 at 8:52 AM Kreienkamp Frank <Frank.Kreienkamp at dwd.de>
>> wrote:
>>
>> Hello,
>>
>>
>>
>> i am currently are stuck in a problem. I want to add a labelbar with 9
>> colors. Using the following source:
>>
>>
>>
>> ;************************************************
>>
>> ; adding color definition
>>
>>    res at cnFillPalette                             = "NCL_DWD_RedYellow"
>>
>> ;************************************************
>>
>> ; adding map
>>
>>    res at cnFillOn                      = True               ; color Fill
>>
>>    res at cnLevelSelectionMode          = "ManualLevels"
>>
>>    res at cnMinLevelValF       =    -135.0             ; min contour level
>>
>>    res at cnMaxLevelValF       =       0.0              ; max contour level
>>
>>    res at cnLevelSpacingF      =      15.0             ; contour spacing
>>
>>    res at cnLabelBarEndStyle            = "ExcludeOuterBoxes"        ; no
>> additional ColorBoxes
>>
>>
>>
>> the color-palette "NCL_DWD_RedYellow"  has 9 colors:
>>
>> ncolors= 9
>>
>> # r   g   b
>>
>> 102 051 051
>>
>> 140 039 039
>>
>> 178 026 026
>>
>> 216 013 013
>>
>> 255 000 000
>>
>> 255 063 000
>>
>> 255 127 000
>>
>> 255 191 000
>>
>> 255 255 000
>>
>>
>>
>> Unfortunately not all colors are shown.
>>
>>
>>
>>
>>
>> What do I have to change? I use version  6.4.0.
>>
>>
>>
>> Thanks in advance
>>
>> Frank
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>>
>> --
>>
>> Barry H. Lynn, Ph.D
>>
>> Senior Associate Scientist, Lecturer,
>>
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>>
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>>
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Barry H. Lynn, Ph.D
Senior Associate Scientist, Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190606/ec04f605/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 9914 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190606/ec04f605/attachment.png>


More information about the ncl-talk mailing list