[Thread Prev][Thread Next][Index]

Re: [ferret_users] Getting at levels and colors used



Hi Gary,

The script in question is part of the standard Ferret distribution:
GO exact_colors #_of_colors  [input_spectrum] [output_filename]

    - Steve

================================

Steve Hankin wrote:
Hi Gary,

There are a number of aspects to this question.  I interpret your main question to be how to know the particular RGB values that Ferret is using for each color level in the color key of  a given plot.  The palette file defines a piecewise linear path through color space; now how to get the actual colors used in a particular plot.   It isn't hard to get these RGB triple values.  I had some scripts around, but *many* years ago and I cannot find them now.   But have outlined the algorithm below.   I know of no tool to generate color names like "light green-blue", though one could create it ... even as a Ferret script.

To get the RGB triples just follow these steps
  1. tell Ferret to read the spk file (the palette file) as if it were a data file
    • read the percentage field (column 10 in the first pass, and create an axis from it; and a grid from that
    • read the r,g,b values onto this axis

      The RGB values from the palette file are now defined as variables (Rval, Gval, Bval) on an axis that goes from 0 to 1.


  2. Regrid them onto a regularly-spaced axis that has the number of color levels on your plot.  E.g.
       DEFINE AXIS/X=0:1/npoints=40 x40  !  if there are 39 color levels
       LIST Rval[gx=x40], Gval[gx=x40], Bval[gx=x40]
Maybe this is of some help ....

    - Steve

=====================

Gary Strand wrote:

Does ferret have a means to list the levels and colors used in a color-filled contour plot, given:

fill/lev="(-6000,-1000,1000)(-1000,-100,100)(-100,100,10)(100,1000,100)(1000,6000,1000)"/pal=topo elev

with an accompanying color specification:

! Palette for ocean/terrestrial elevation.
! *jc* 11/00
RGB_Mapping By_Value
! Val    R    G    B
-8000.   0.   0.  10. ! blue-black
-4000.   0.   0.  50.
-2000.   0.   0. 100. ! blue
-300.   40.  70. 100. 
-100.   50. 100. 100.
 -50.   40.  80.  70.
  -0.1  90. 100. 100. ! light green-blue
   0.    0.  20.  00. ! dark green
 100.    0.  70.  30. ! light green
 300.   90. 100.   0. ! light yellow
1200.   60.  30.   0. ! rust
4000.   90.  90. 100. ! ice blue
5000.  100. 100. 100. ! white

I'm aware of 'ppl list levels', which will give the actual levels used in the PLOT command, but is there a way to get at the RGB triples associated with each level?

Thanks!

Gary Strand




-- 
Steve Hankin, NOAA/PMEL -- Steven.C.Hankin@xxxxxxxx
7600 Sand Point Way NE, Seattle, WA 98115-0070
ph. (206) 526-6080, FAX (206) 526-6744

"The only thing necessary for the triumph of evil is for good men
to do nothing." -- Edmund Burke

-- 
Steve Hankin, NOAA/PMEL -- Steven.C.Hankin@xxxxxxxx
7600 Sand Point Way NE, Seattle, WA 98115-0070
ph. (206) 526-6080, FAX (206) 526-6744

"The only thing necessary for the triumph of evil is for good men
to do nothing." -- Edmund Burke

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement