[ncl-talk] fatal:CvtGenArrayToCmap:From array has wrong dimensionality
Mary Haley
haley at ucar.edu
Fri Nov 21 10:26:46 MST 2014
Xi,
In order to duplicate a color bar from an existing image, you need a tool
that is able to give you the RGB triplets of each color. You can then turn
this into a color table in NCL.
There are several free tools. I used one called "Digital Color Meter" on my
Mac that gives me the RGB values as I hover my mouse over each color.
The colors will not be exact, because the colors in each box vary slightly
as you move your mouse around. I tried to use the color that was in the
middle of a box.
With this, I was able to create a simple "bar.rgb" file (attached), and
then read this in with NCL to use it as a color map. See the attached.
On Thu, Nov 20, 2014 at 11:37 AM, Xi Chang <xi.chang01 at gmail.com> wrote:
> Dear Mary,,
>
> Thank you, it works, but i cant not mimic the attached labelbar that I
> found in the journal.
> can you help me, please see attached,
> how can I creat such colorbar with exact color as this labelbar. thank you
> so much for your
> help..
>
> Im looking forward to your help.
>
> Chang,
>
> On Tue, Nov 18, 2014 at 3:39 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> I think what you want is this:
>>
>> res at cnLevelSelectionMode = "ExplicitLevels"
>> res at cnLevels = (/-35, -25, -22, -18, -14, -10, -7, -5, -3,
>> -2,-1,-.25, 0 , \
>> .25, 1, 2, 3, 5, 7, 10, 14, 18, 22, 25 , 35
>> /)
>> res at cnFillOn = True
>> res at cnFillColors = (/16, 25, 45, 50, 60, 65, 81, 70, 78, 85, 90
>> , 0, \
>> 0, 0, 90, 85, 78, 70, 81, 65, 60, 50, 45,
>> 25, 16 /)
>>
>> cnFillColors is meant to take an array of color index values into the
>> current workstation color map, which is usually set by gsn_define_colormap.
>>
>> cnFillPalette is meant to take an actual color map name, like "rainbow",
>> which will be applied to a color contour plot, and fully spanned by
>> default. You shouldn't use cnFillPalette and cnFillColors together.
>>
>> --Mary
>>
>>
>> On Tue, Nov 18, 2014 at 6:51 AM, Xi Chang <xi.chang01 at gmail.com> wrote:
>>
>>> Anybody know why did I get this error?
>>>
>>> res at cnLevelSelectionMode = "ExplicitLevels"
>>> res at cnLevels = (/-35, -25, -22, -18, -14, -10, -7, -5, -3,
>>> -2,-1,-.25, 0 , .25, 1, 2, 3, 5, 7, 10, 14, 18, 22, 25 , 35 /)
>>> res at cnFillColors = True
>>> res at cnFillPalette = (/16, 25, 45, 50, 60, 65, 81, 70, 78, 85, 90 , 0,
>>> 0, 0, 90, 85, 78, 70, 81, 65, 60, 50, 45, 25, 16 /)
>>>
>>> Thank you
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141121/ece674b1/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-2.png
Type: image/png
Size: 12891 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141121/ece674b1/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar.rgb
Type: image/x-rgb
Size: 263 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141121/ece674b1/attachment.rgb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar.ncl
Type: application/octet-stream
Size: 2649 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141121/ece674b1/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar.png
Type: image/png
Size: 80619 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141121/ece674b1/attachment-0001.png
More information about the ncl-talk
mailing list