Re: Error with adding color using NhlNewColor

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 14 2011 - 12:08:37 MDT

Hi Gina,
NCL currently allows a maximum of 256 colors to be defined within your
colormap. BlueWhiteOrangeRed has 256 colors. If you wish to still use
that colormap I suggest defining it as you were, retrieving it,
modifying it to remove the first two blues and last two reds (likely
indistinguishable from the 3rd/4th blues/reds), and slip in your
additional colors. The coding would be something like this:

gsn_define_colormap(wks,"BlueWhiteOrangeRed")
cmap = gsn_retrieve_colormap(wks)
cmap2 = cmap
cmap2(2:251,:) = cmap(4:253,:) ; exclude 1st 2 reds/blues
gsn_merge_colormaps(wks,cmap2(:251,:),(/"gray30","gray42"/))

or:

gsn_define_colormap(wks,"BlueWhiteOrangeRed")
cmap = gsn_retrieve_colormap(wks)
cmap2 = cmap
cmap2(2:251,:) = cmap(4:253,:)
gsn_define_colormap(wks,cmap2(:251,:))
igrey = NhlNewColor(wks,8,.8,.8)

Hope that helps! Adam

On 04/14/2011 11:55 AM, Gina Henderson wrote:
> Hi all,
>
> I am trying to use the NhlNewColor to add grey to an existing color map.
> I have done this in previous scripts but for some reason in my current
> scrip I am getting a fatal error when try the following:
>
> gsn_define_colormap(wks,"BlueWhiteOrangeRed") ; define a
> different colormap.
>
> igrey = NhlNewColor(wks,8,.8,.8) ; Add light gray to colormap,
> ; for continents.
>
> giving me the error:
>
> /fatal:_NhlNewColor:no available colors/
>
> I am currently running ncl version 6.0 beta on a Macbook Pro.
>
> Any help or suggestions would be greatly appreciated.
> Gina.
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 15 04:08:46 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT