Re: colormap confusion - continent color & colormap options

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon, 25 Aug 2008 14:59:07 -0600

Hi Leslie,

You do not see the gsdtol, etc. colortables in the colormaps
directory because they are "built-in" colortables that are
defined in the source code. These colormaps were defined before the
code to load colortables from a file was
implemented. FYI, the pre-defined colormaps are as follows:

   default
   cyclic
   gscyclic
   gsltod
   gsdtol
   uniform
   temp1
   psgcap
   example

It appears that "gsltod" is mis-labelled on the web site as
"gsltod_default". "gsltod_default" does not exist. We will correct the
documentation on this point.

You can discover the currently available colormaps using the function
"NhlPalGetDefined".

As for the apparently incomprehensible behavior of gsn_csm_map_ce
regarding the coloring of the continents,
it is easily explained (I think): There is a call inside
gsn_csm_map_ce to set the land color to "gray". If there is
an actual gray color in the color map you have loaded then it is
used. If not, then the "closest" color to gray is
used. This is actually calculated as the minimum vector distance
(sqrt of sum of squared distances between the individual components
r, g, and b)
between the available colors and the requested color. Depending on
the contents of the color table, this might be pink, light blue, or
even white.

If you want to use a color table that has no gray, but you have need
of a gray color then you should use NhlNewColor to add the color to the
color table. If you are using a color table that defines all the
possible indexes (the current maximum index is 255), then you would
need to use
instead the NhlSetColor procedure to write over a color that you
could afford to do without. Note, however, that to work well with
the "gsnSpreadColors"
resource, you should ensure that the color indexes you set are
outside the range of gsnSpreadColorStart and gsnSpreadColorEnd.

Only one color table can apply to a single plot. If you change color
tables prior to drawing a plot, the colors in the newly set table
will apply.

You can override the setting of gray for land masses in
gsn_csm_map_ce by setting the map resource mpLandFillColor. There are
similar
resources for ocean and inland water colors.

Hope this helps,
  -dave

On Aug 25, 2008, at 2:01 PM, Leslie Hartten wrote:

> I am new to NCL and trying to start simple, by drawing a base map
> of the tropical Atlantic. I am playing with color tables because
> (1) I want to have a very light grey lat/lon grid and (2) I'm going
> to want to put things on the base map eventually. I'm using NCL
> v5.0.1 on a Mac OSX system on which I have no adminstrator
> priviledges. I've got 1 question and 1 problem.
>
> The question: When I look in my $NCARG_ROOT/lib/ncarg/colormaps,
> I do not see any of the following gray scale colormaps: gsdtol,
> gsltod_default, gscyclic (c.f. www.ncl.ucar.edu/Document/Graphics/
> ColorTables/grayscale_gr.shtml). Why is this? are they kept
> somewhere else?
>
> The problem: Given the following key lines of code:
> =====
> wks = gsn_open_wks("ps","TropAtlantic")
>
> ; gsn_define_colormap(wks,"gui_default") ; *.rgb file
> ; gsn_define_colormap(wks,"rainbow+gray") ; *.gp file
> ; gsn_define_colormap(wks,"so4_23") ; *.gp file
> ; gsn_define_colormap(wks,"amwg") ; *.rgb file
>
> map = gsn_csm_map_ce(wks,mpres)
> =====
> - when I run this code with no call to gsn_define_colormap (thus using
> *wkColorMap : rainbow+gray
> from my .hluresfile, I get grey land and a white ocean.
>
> - when I run this code with gsn_define_colormap(wks,"gui_default"),
> an ncolors=24 rainbow with no gray, I get no visible land and a
> white ocean.
>
> - when I run this code with an explict call matching
> my .hluresfile, gsn_define_colormap(wks,"rainbow+gray"), I get grey
> land and a white ocean.
>
> - when use gsn_define_colormap(wks,"so4_23"), another small
> (ncolors=25) rainbow with no gray, I get light pink land and a
> white ocean! I printed the output and the color table from
> www.ncl.ucar.edu, and it looks to me as if the land is color #23
> (251,211,251).
>
> - when use gsn_define_colormap(wks,"amwg"), one more small
> (ncolors=18) rainbow with no gray, I get powder blue land.
> Comparing printed plot & color table, it looks like color #6
> (176,224,230).
>
> What's going on? The documentation for gsn_csm_map_ce says "the
> following will happen automatically: the continents will be colored
> gray ...". Is this only true if the colormap in play has a gray?
> If I want to plot something using a grey-free colormap on top of
> gray continents, do I need to switch colormaps midstream?
>
> Cheers,
> Leslie
> --
> Dr. Leslie M. Hartten
> CIRES, Univ. of Colorado email: Leslie.M.Hartten_at_noaa.gov
> 216 UCB web: http://cires.colorado.edu/
> ~hartten
> Boulder CO 80309-0216 phone: (303)497-7052 fax: 497-6181
> --
> Disclaimer: The contents of this message are mine personally and
> do not necessarily reflect any position of the Government of the
> United States of America, the National Oceanic and Atmospheric
> Administration, or the University of Colorado.
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 25 2008 - 14:59:07 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 25 2008 - 15:23:45 MDT