<div dir="ltr">Hi Beata,<div><div>Try changing this:</div><div><span style="font-size:12.8px">res@cnLevels = (/1,2,3,4/)</span><br></div><div><span style="font-size:12.8px">to this:</span></div><div><span style="font-size:12.8px">res@cnLevels = (/1.5,2.5,3.5,4.5/)</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">If that does not work please send the current version of you script, along with your aridity colormap and data files to our ftp site so someone can take a look. Follow the ftp instructions here:</span></div></div><div><span style="font-size:12.8px"><a href="http://www.ncl.ucar.edu/report_bug.shtml">http://www.ncl.ucar.edu/report_bug.shtml</a></span><br></div><div><span style="font-size:12.8px">(Under "</span><span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">You can ftp larger datasets and files to:")</span></div><div><span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px"><br></span></div><div><span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">When the transfer is completed make sure you send to ncl-talk the name of the files you transferred. </span></div><div><span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">Adam</span></div><div><span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px"><br></span></div><div><b style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px"><br></b></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 23, 2016 at 1:56 AM, Beata Szabo <span dir="ltr"><<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Mary,<br>
<br>
Thank you for your response. If I apply your suggestions:<br>
<br>
res@cnLevelSelectionMode = "ExplicitLevels"<br>
res@cnLevels = (/1,2,3,4/)<br>
<br>
the labelbar will be correct but the maps are incorrect, because this<br>
method shifts the colors. I attached its result. It does not show the<br>
hyper-arid areas (brown) and the semi-arid levels (green) are missed in<br>
Iberia-Peninsula. I need same maps as I attached in the previous email.<br>
Could you or someone help me to fix this matter.<br>
<br>
Thank you in advance!<br>
Beata<br>
<br>
> Beata,<br>
><br>
> When NCL repeats colors in a labelbar like this, it's because there aren't<br>
> enough colors in the color map for the number of contour levels being<br>
> requested.<br>
><br>
> It looks like your color map only has 5 colors, so you need to use one<br>
> fewer contour levels:<br>
><br>
> res@cnLevelSelectionMode = "ExplicitLevels"<br>
> res@cnLevels = (/1,2,3,4/)<br>
><br>
><br>
> --Mary<br>
><br>
><br>
><br>
><br>
> On Thu, Sep 22, 2016 at 3:06 AM, Beata Szabo <<a href="mailto:szabo.b@czechglobe.cz">szabo.b@czechglobe.cz</a>><br>
> wrote:<br>
><br>
>> I added<br>
>> resP@lbBoxCount = 5<br>
>><br>
>> but unfortunately it does not help. I created new netcdf files with same<br>
>> variables, but I converted the unep variable to integer and I also tried<br>
>> to draw the maps with those integer variables (1,2,3,4,5) with<br>
>><br>
>> res@cnLevels = (/1,2,3,4,5/)<br>
>><br>
>> The resulted maps are correct but the label is still incorrect both with<br>
>> string and without string labels. I attached the sript and the created<br>
>> maps. I would appreciated if someone helped me!<br>
>><br>
>> Beata<br>
>><br>
>> > I don't know for certain, but you might try adding<br>
>> ><br>
>> > resP@lbBoxCount = 5<br>
>> ><br>
>> > I'm not positive that will fix it, but the docs say that the sizes of<br>
>> > arrays like lbLabelStrings, etc, must match the lbBoxCount, and in<br>
>> your<br>
>> > case it sounds like its defaulting to 11 (?)<br>
>> ><br>
>> > Hope that helps...<br>
>> > Rick<br>
>> ><br>
>> ><br>
>> > On Wed, Sep 21, 2016 at 2:12 AM, Beata Szabo <<a href="mailto:szabo.b@czechglobe.cz">szabo.b@czechglobe.cz</a>><br>
>> > wrote:<br>
>> ><br>
>> >> I created a panel plot with my own netCDF files and color table be<br>
>> >> created<br>
>> >> according to<br>
>> >> <a href="http://www.ncl.ucar.edu/Document/Graphics/create_color_table.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Graphics/create_<wbr>color_table.shtml</a><br>
>> >><br>
>> >> My own color table has ncolors = 5. The netCDF files contains five<br>
>> float<br>
>> >> values (1.0, 2.0, 3.0, 4.0, 5.0). After I run the below script I<br>
>> >> received<br>
>> >> correct maps with incorrect labelbar. The labelbar containes 11 box<br>
>> >> where<br>
>> >> the first two and the last two colors are two times and the third<br>
>> color<br>
>> >> roles three times. Moreover the label strings are the follows: Arid,<br>
>> >> Sub-humid, Label_6, Label_8.<br>
>> >><br>
>> >> How can I create a correct labelbar?<br>
>> >><br>
>> >> ;-----------------------------<wbr>------------------------------<wbr>-----------<br>
>> >> ; Main code.<br>
>> >> ;-----------------------------<wbr>------------------------------<wbr>-----------<br>
>> >> begin<br>
>> >> ;*****************************<wbr>*******************<br>
>> >> ; read in netCDF file<br>
>> >> ;*****************************<wbr>*******************<br>
>> >> a = addfile("UNEP_E-OBS_sm.nc","r"<wbr>)<br>
>> >> b = addfile("UNEP_1971-2000_sm.nc"<wbr>,"r")<br>
>> >> c = addfile("UNEP_2021-2050_sm.nc"<wbr>,"r")<br>
>> >> d = addfile("UNEP_2071-2100_sm.nc"<wbr>,"r")<br>
>> >><br>
>> >> un1 = a->unep(:,:)<br>
>> >> un2 = b->unep(:,:)<br>
>> >> un3 = c->unep(:,:)<br>
>> >> un4 = d->unep(:,:)<br>
>> >><br>
>> >> minlat = 30 ; min lat to mask<br>
>> >> maxlat = 75 ; max lat to mask<br>
>> >> minlon = -20 ; min lon to mask<br>
>> >> maxlon = 40 ; max lon to mask<br>
>> >><br>
>> >> ;*****************************<wbr>*******************<br>
>> >> ; create plot<br>
>> >> ;*****************************<wbr>*******************<br>
>> >> wks = gsn_open_wks("png","unep") ; send graphics to PNG<br>
>> >> file<br>
>> >><br>
>> >> cmap = read_colormap_file("aridity")<br>
>> >><br>
>> >><br>
>> >><br>
>> >> plot = new(4,graphic)<br>
>> >> res = True ; plot mods desired<br>
>> >> res@gsnMaximize = True ; enlarge plot<br>
>> >> res@gsnDraw = False ; Don't draw yet<br>
>> >> res@gsnFrame = False ; Don't advance frame<br>
>> >> yet<br>
>> >> res@mpProjection = "LambertConformal"; choose projection<br>
>> >><br>
>> >> res@cnFillOn = True ; turn on color<br>
>> >> res@cnLinesOn = False ; turn off contour<br>
>> lines<br>
>> >> res@lbLabelBarOn = False<br>
>> >> res@cnFillPalette = cmap(::-1,:) ; set color map<br>
>> >><br>
>> >> res@mpMinLatF = minlat<br>
>> >> res@mpMaxLatF = maxlat<br>
>> >><br>
>> >> res@mpMinLonF = minlon<br>
>> >> res@mpMaxLonF = maxlon<br>
>> >><br>
>> >> res@gsnMaskLambertConformal = True ; turn on lc masking<br>
>> >> res@mpGridAndLimbOn = True<br>
>> >> res@mpGridLatSpacingF = 10<br>
>> >> res@mpGridLonSpacingF = 5<br>
>> >> res@gsnAddCyclic = False<br>
>> >><br>
>> >> res@tiMainString = ""<br>
>> >> res@tiMainOffsetYF = 0.01 ; Move title up a little<br>
>> >> res@gsnRightString = "A"<br>
>> >> res@gsnLeftString = ""<br>
>> >> ; pr&lon = pr&lon-180 ; make lon go -180<br>
>> to<br>
>> >> 180<br>
>> >><br>
>> >> plot(0) =<br>
>> >> gsn_csm_contour_map(wks,un1({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),res);<br>
>> >> create plot<br>
>> >><br>
>> >> resb = True ; plot mods desired<br>
>> >> resb@gsnMaximize = True ; enlarge plot<br>
>> >> resb@gsnDraw = False ; Don't draw yet<br>
>> >> resb@gsnFrame = False ; Don't advance<br>
>> frame<br>
>> >> yet<br>
>> >> resb@mpProjection = "LambertConformal"; choose projection<br>
>> >><br>
>> >> resb@cnFillOn = True ; turn on color<br>
>> >> resb@cnLinesOn = False ; turn off contour<br>
>> >> lines<br>
>> >> resb@lbLabelBarOn = False<br>
>> >> resb@cnFillPalette = cmap(::-1,:) ; set color map<br>
>> >><br>
>> >> resb@mpMinLatF = minlat<br>
>> >> resb@mpMaxLatF = maxlat<br>
>> >><br>
>> >> resb@mpMinLonF = minlon<br>
>> >> resb@mpMaxLonF = maxlon<br>
>> >><br>
>> >> resb@gsnMaskLambertConformal = True ; turn on lc masking<br>
>> >> resb@mpGridAndLimbOn = True<br>
>> >> resb@mpGridLatSpacingF = 10<br>
>> >> resb@mpGridLonSpacingF = 5<br>
>> >> resb@gsnAddCyclic = False<br>
>> >><br>
>> >> resb@tiMainString = ""<br>
>> >> resb@tiMainOffsetYF = 0.01 ; Move title up a little<br>
>> >> resb@gsnRightString = "B"<br>
>> >> resb@gsnLeftString = ""<br>
>> >><br>
>> >> plot(1) =<br>
>> >> gsn_csm_contour_map(wks,un2({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),resb);<br>
>> >> create plot<br>
>> >><br>
>> >> resc = True ; plot mods desired<br>
>> >> resc@gsnMaximize = True ; enlarge plot<br>
>> >> resc@gsnDraw = False ; Don't draw yet<br>
>> >> resc@gsnFrame = False ; Don't advance<br>
>> frame<br>
>> >> yet<br>
>> >> resc@mpProjection = "LambertConformal"; choose projection<br>
>> >> resc@cnFillOn = True ; turn on color<br>
>> >> resc@cnLinesOn = False ; turn off contour<br>
>> >> lines<br>
>> >> resc@lbLabelBarOn = False<br>
>> >> resc@cnFillPalette = cmap(::-1,:) ; set color map<br>
>> >><br>
>> >> resc@mpMinLatF = minlat<br>
>> >> resc@mpMaxLatF = maxlat<br>
>> >><br>
>> >> resc@mpMinLonF = minlon<br>
>> >> resc@mpMaxLonF = maxlon<br>
>> >><br>
>> >> resc@gsnMaskLambertConformal = True ; turn on lc masking<br>
>> >> resc@mpGridAndLimbOn = True<br>
>> >> resc@mpGridLatSpacingF = 10<br>
>> >> resc@mpGridLonSpacingF = 5<br>
>> >> resc@gsnAddCyclic = False<br>
>> >><br>
>> >> resc@tiMainString = ""<br>
>> >> resc@tiMainOffsetYF = 0.01 ; Move title up a little<br>
>> >> resc@gsnRightString = "C"<br>
>> >> resc@gsnLeftString = ""<br>
>> >><br>
>> >><br>
>> >> plot(2) =<br>
>> >> gsn_csm_contour_map(wks,un3({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),resc);<br>
>> >> create plot<br>
>> >><br>
>> >><br>
>> >> resd = True ; plot mods desired<br>
>> >> resd@gsnMaximize = True ; enlarge plot<br>
>> >> resd@gsnDraw = False ; Don't draw yet<br>
>> >> resd@gsnFrame = False ; Don't advance<br>
>> frame<br>
>> >> yet<br>
>> >> resd@mpProjection = "LambertConformal"; choose projection<br>
>> >><br>
>> >> resd@cnFillOn = True ; turn on color<br>
>> >> resd@cnLinesOn = False ; turn off contour<br>
>> >> lines<br>
>> >> resd@lbLabelBarOn = False<br>
>> >> resd@cnFillPalette = cmap(::-1,:) ; set color map<br>
>> >><br>
>> >> resd@mpMinLatF = minlat<br>
>> >> resd@mpMaxLatF = maxlat<br>
>> >><br>
>> >> resd@mpMinLonF = minlon<br>
>> >> resd@mpMaxLonF = maxlon<br>
>> >><br>
>> >> resd@gsnMaskLambertConformal = True ; turn on lc masking<br>
>> >> resd@mpGridAndLimbOn = True<br>
>> >> resd@mpGridLatSpacingF = 10<br>
>> >> resd@mpGridLonSpacingF = 5<br>
>> >> resd@gsnAddCyclic = False<br>
>> >><br>
>> >> resd@tiMainString = ""<br>
>> >> resd@tiMainOffsetYF = 0.01 ; Move title up a little<br>
>> >> resd@gsnRightString = "D"<br>
>> >> resd@gsnLeftString = ""<br>
>> >><br>
>> >><br>
>> >> plot(3) =<br>
>> >> gsn_csm_contour_map(wks,un4({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),resd);<br>
>> >> create plot<br>
>> >><br>
>> >> ;---Attach latitude labels<br>
>> >> add_lc_labels(wks,plot(0),<wbr>minlat,maxlat,minlon,maxlon)<br>
>> >> add_lc_labels(wks,plot(1),<wbr>minlat,maxlat,minlon,maxlon)<br>
>> >> add_lc_labels(wks,plot(2),<wbr>minlat,maxlat,minlon,maxlon)<br>
>> >> add_lc_labels(wks,plot(3),<wbr>minlat,maxlat,minlon,maxlon)<br>
>> >><br>
>> >> ;---Drawing the plot will also draw all the attached labels.<br>
>> >> draw(plot(0))<br>
>> >> draw(plot(1))<br>
>> >> draw(plot(2))<br>
>> >> draw(plot(3))<br>
>> >> frame(wks)<br>
>> >> ;-- create panel plot<br>
>> >> ;*****************************<wbr>*******************<br>
>> >> resP = True ; modify the panel<br>
>> >> plot<br>
>> >><br>
>> >> resP@gsnPanelLabelBar = True ; add common<br>
>> colorbar<br>
>> >> resP@lbLabelFontHeightF = 0.007 ; make labels<br>
>> smaller<br>
>> >> resP@cnExplicitLabelBarLabelOn = True<br>
>> >><br>
>> >> resP@lbLabelStrings = (/"","Hyper-arid","Arid", \<br>
>> >> "Semi-arid","Sub-humid","<wbr>Humid"/)<br>
>> >><br>
>> >> gsn_panel(wks,plot,(/2,2/),<wbr>resP)<br>
>> >><br>
>> >> end<br>
>> >><br>
>> >> Thank you for your help in advance!<br>
>> >><br>
>> >> Beata<br>
>> >><br>
>> >><br>
>> >> Dr. Beata Szabo-Takacs<br>
>> >> Global Change Research Institute CAS<br>
>> >> Bělidla 986/4a<br>
>> >> 60300 Brno<br>
>> >> Czech Republic<br>
>> >><br>
>> >> ______________________________<wbr>_________________<br>
>> >> ncl-talk mailing list<br>
>> >> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
>> >> List instructions, subscriber options, unsubscribe:<br>
>> >> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
>> >><br>
>> ><br>
>><br>
>><br>
>> Dr. Beata Szabo-Takacs<br>
>> Global Change Research Institute CAS<br>
>> Bělidla 986/4a<br>
>> 60300 Brno<br>
>> Czech Republic<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> ncl-talk mailing list<br>
>> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
>> List instructions, subscriber options, unsubscribe:<br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
>><br>
>><br>
><br>
<br>
<br>
Dr. Beata Szabo-Takacs<br>
Global Change Research Institute CAS<br>
Bělidla 986/4a<br>
60300 Brno<br>
Czech Republic<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>