Re: colormaps and file formats

From: Mark J. Stevens (stevens AT ucar.edu)
Date: Wed Jan 12 2005 - 10:20:05 MST


Hi,

I have written a function that is included in contributed.ncl that allows you
to "roll your own" colormaps with your own rgb file. To use this
here is an example. The rgb file and a ncl script for viewing the colors
are attached.

example of use in ncl script:
.....
cmap = RGBtoCmap("blueyellowred.rgb")
gsn_define_colormap(wks,cmap)
....

I use to use GMT in grad school, I think you could easily modify those
rgb files to use with ncl.

Mark Stevens

On Wednesday 12 January 2005 07:51 am, Derrick Snowden wrote:
> Hi all,
>
> I'm interested in writing a conversion script to convert GMT style *.cpt
> colormap files to a file format useable by NCL and PyNGL. First of all,
> has anyone already done this? If so are you willing to share? There are
> some good default colormaps in GMT and there is a great site (cpt-city at
> http://craik.shef.ac.uk/cpt-city/index.html) with hundreds of user
> contributed extensions. A script to go between these different file
> formats would be very useful. I have a few questions as I'm getting
> started...
>
> 1. NCL/PyNGL ships with colormaps in the $NCARG_ROOT/lib/ncarg/colormaps
> directory. In my installation, I have *.ncmap, *.gp and *.rgb files. For
> some colormaps there are multiple file type versions of the same map.
> Which is the preferred file format and why? Is there a trick to the format
> or are they just rgb (0-255) triplets on each line?
>
> 2. If I remember correctly, the first entry in the colormap is the default
> background color, and the second entry is the default foreground color.
> Which index entry provides the default color for the various fill colors
> such as the land fill and the inland waters filll? I constantly screw that
> up. If one uses the resource gsnSpreadColors = True, are the
> foreground/background colors used or not?
>
> 3. Where, other than $NCARG_ROOT/lib/ncarg/colormaps, can these files be
> stored so they are available in scripts? If I'm using a network
> installation of ncl and don't have write permission in the directory above?
>
> 4. What is a good rule of thumb for the length of a colormap, given that
> one can interpolate etc? (For this purpose I am talking about colormaps
> used for continuous variables not categorical variables.)
>
> Thanks for any help you can give...
>
> Best,
> Derrick

-- 
Mark J. Stevens            
Climate and Global Dynamics Division
NCAR Mesa Laboratory, Room 320c
ph: 303-497-1707    stevens@ucar.edu
http://www.cgd.ucar.edu/~stevens



_______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Thu Jan 13 2005 - 07:43:41 MST