[ncl-talk] Panel Label Bar

Barry Lynn barry.h.lynn at gmail.com
Thu Aug 2 04:25:58 MDT 2018


Here's an example.

  cmap := read_colormap_file("NCV_rainbow2")

  cmap := cmap(50:, :)

  cmap(0,:) = 1.   ; Make first color white

  opts_Prec at cnFillPalette     = cmap         ; set color map


On Thu, Aug 2, 2018 at 7:52 AM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Melissa,
> If all you want is white to not be the first color in your labelbar, you
> can read in your colormap using read_colormap_file, and then specify a
> subset of the colormap (eliminating white) in cnFillPalette. See example #8
> here:
> http://www.ncl.ucar.edu/Applications/rgbacolor.shtml#ex8
>
> Hope that helps. If not or if you have further questions please respond to
> the ncl-talk email list.
> Adam
>
> On Tue, Jul 31, 2018 at 4:06 PM MELISSA KAZEMI RAD <
> mk1369 at scarletmail.rutgers.edu> wrote:
>
>> Hi,
>>
>> I'm trying to create a panel contour plot of cloud liquid water, and I
>> particularly want to have as many contour levels as possible, i.e. I need
>> to be able to show the smallest amount of cloud water. In order to do so,
>> I've set:
>> res at ContourParameters = (/0.0, max(qc_plane), 0.01 /)
>>
>> However, the plots that I get don't have any designated color for 0 value.
>> I use a similar code to produce one such plot (instead of a panel plot),
>> and it works fine, in the sense that I can divide the panel bar to the
>> number of contour levels.
>>
>> Here is my NCL code and the plot that I get: (NCL.6.4.0)
>>
>>     type = "png"
>>
>>    wks = gsn_open_wks(type,"Cloud_panel")
>>
>>    times  = wrf_user_list_times(a)
>>    time = 166
>>
>>     p    = wrf_user_getvar(a, "pressure", time)    ; Total Pressure
>>     z    = wrf_user_getvar(a,"z",time)
>>     qc   = wrf_user_getvar(a,"QCLOUD", time)
>>
>>     qc       = qc*1000.
>>     qc at units = "g/kg"
>>
>>     res                          = True
>>     res at NoHeaderFooter           = True
>>
>>     pltres                  = True
>>     pltres at PanelPlot        = True
>>     mpres                   = True
>>
>>   ; Generate Contours
>>
>>     height_levels = (/750., 1000., 1200, 1400./)   ; heigth levels to plot
>>     nlevels         = dimsizes(height_levels)     ; number of height
>> levels
>>     nplots     = 4
>>     plots      = new(nplots,"graphic")
>>     iplot      = 0
>>
>>     do level  = 0,nlevels-1
>>        res at cnFillOn            = True
>>        res at cnFillPalette       = "WhViBlGrYeOrRe"
>>        res at lbLabelBarOn        = False
>>        res at cnLinesOn           = False
>>        res at cnLevelSpacingF     = 0.1
>>
>>        height = height_levels(level)
>>        qc_plane = wrf_user_intrp3d(qc,z,"h",height,0.,False)
>>
>>        res at ContourParameters = (/0.0, max(qc_plane), 0.01 /)
>>
>>        contour = wrf_contour(a,wks,qc_plane,res)
>>        pltres at CommonTitle      = True
>>        pltres at PlotTitle        = height+"m"
>>        plots(iplot) = wrf_map_overlays(a, wks, (/contour/), pltres, mpres)
>>        delete(contour)
>>        iplot = iplot + 1
>>     end do
>>
>>   ; Panel the WRF Plots
>>     pnlres                            = True
>>     pnlres at txString                   = qc at description + "  (" + qc at units
>> + ")"+ "at" + " at "+  times(time)
>>     pnlres at gsnPanelYWhiteSpacePercent = 10       ; Add white space b/w
>> plots.
>>     pnlres at gsnPanelLabelBar           = True    ; Turn on common labelbar
>>
>>     pnlres at lbLabelAlignment           = "BoxCenters"
>>     pnlres at lbLabelsOn           = True
>>     pnlres at lbPerimOn            = False
>>     pnlres at lbTitleOn            = False
>>
>>     pnlres at pmLabelBarWidthF           = 0.6
>>
>>     gsn_panel(wks,(/plots/),(/2,2/),pnlres)
>>
>> end
>>
>> --
>> *Melissa Kazemi Rad*
>> *Atmospheric Sciences Department*
>> *Rutgers University*
>> _______________________________________________
>> 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>
> _______________________________________________
> 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/20180802/61787359/attachment.html>


More information about the ncl-talk mailing list