Re: mpFillColors and nglSpreadColors and LINUX comments???

From: Derrick Snowden <Derrick.Snowden_at_nyahnyahspammersnyahnyah>
Date: Thu, 21 Oct 2004 18:52:32 -0400

Hi Mary,

Thanks for the response, but I'm afraid I'm no further along. I understand
your comments and I was able to set the land fill color directly using a
named colormap, and I was able to get the length of the assigned colormap as
you suggested. But, no matter what I do, nglSpreadColors does nothing. I
still have a gray bar at the top of the BlueRedGray colorbar. I can use a
different colormap but it doesn't change the underlying problem that
nglSpreadColors doesn't seem to work.

I am supposed to pass the resources which have nglSpreadColors=True to the
contour function right?
 
map = ngl.contour_map(wks,annual,resources) # Draw contours over a map.

Is there another possibility? I've tried a few simpler tests to and as far as
I can tell, nglSpreadColors, nglSpreadColorsEnd/Start don't do anything.

Could this be another gcc3.3.3/Red Hat FC2 problem?

Thanks again,
Derrick

PS: At the risk of starting a firestorm, can anyone comment on other linux
distributions as far as reliability and smooth operations? Also, I'm
interested to hear from any Mac OS/X users regarding ncl/PyNGL performance on
a Mac.

On Thu October 21 2004 11:02 am, Mary Haley wrote:
> > I'm having difficulty deciphering how the colors in a colormap are
> > assigned to various elements in the plot. I'm following the chkbay.py
> > example from pynglex somewhat.
> >
> > I'm trying to figure out the colors which are assigned to the background
> > (I assume element 0), foreground(1), land, ocean, etc.
> >
> > I am able to set the foreground and background correctly.
> >
> > resources = ngl.Resources()
> > rlist = ngl.Resources()
> > rlist.wkColorMap = 'BlueRedGray'
> > ngl.set_values(wks,rlist)
> > resources.mpFillOn = True # Turn on map fill.
> > resources.mpLandFillColor = 254
> > resources.mpOceanFillColor = -1
> >
> > This gives me a white background with black letters and a gray fill color
> > for land, which is what I want. But, I also get a gray box in the
> > "warmest" value for my colorbar. I have tried the nglSpreadColors
> > resource like so ...
> >
> > resources.nglSpreadColors = True
> > resources.nglSpreadColorsEnd=-2
> >
> > which I then pass to the map function ...
> > map = ngl.contour_map(wks,sstma,resources) # Draw contours over a map.
> >
> > This has no effect that I can see. I thought it would tell the contour
> > function to stop using the colormap at the ncol - 2 entry. Is this the
> > wrong interpretation or am I doing something else?
>
> Hi Derrick,
>
> It looks like you are doing everything correctly. Are you using
> the same colormap, "rainbow+gray"? If not, then you should check
> your colormap to make sure that you don't have more than one gray
> entry at the end of your colormap.
>
> > On that note, is there a way, short of defining your own colormap as a
> > Numeric array, that you can find the length of a colormap in order to
> > know beforehand the indices to assign to mpOceanFillColor?
>
> You can get the length as follows: any time after the "open_wks" call,
> insert:
>
> cmap_len = Ngl.get_integer(wks,"wkColorMapLen")
>
> You can also draw the colormap, for debugging purposes with the
> following call:
>
> Ngl.draw_colormap(wks)
>
> With regard to your question, however, you don't need to use index
> values to specify what color you want for mpOceanFillColor. Instead,
> you can use one of 650 "named" colors, if the named color is
> already in your colormap. For example:
>
> resources.mpOceanFillColor = "DeepSkyBlue"
>
> To see all the named colors, visit:
>
> http://www.pyngl.ucar.edu/selectedtopics.html#CreatingColorMapNamed
>
> You can click on any of the graphics for a larger view, and also
> to be able to read the name of the color. The color names
> are case insensitive, so "PapayaWhip" is the same as "papAYAWHiP".
>
> Each named color has an associated RGB value with it. If this RGB
> value is not found in your colormap, PyNGL will find the closest color
> to using a special algorithm. (I can't think of the name of it at the
> moment.)
>
> --Mary
>
> > Any help is appreciated,
> > Derrick
> >
> > --
> > Derrick Snowden
> > PhOD/AOML/NOAA
> > 4301 Rickenbacker Causeway
> > Miami, FL 33149
> > Office: 305.361.4322 Fax: 305.361.4392
> > _______________________________________________
> > pyngl-talk mailing list
> > pyngl-talk_at_ucar.edu
> > http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

-- 
Derrick Snowden
PhOD/AOML/NOAA
4301 Rickenbacker Causeway
Miami, FL 33149
Office: 305.361.4322  Fax: 305.361.4392
_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Thu Oct 21 2004 - 16:53:50 MDT

This archive was generated by hypermail 2.2.0 : Thu Jan 19 2006 - 21:30:16 MST