[Thread Prev][Thread Next][Index]

Re: [ferret_users] Diverging color scale about zero but not centered on zero



Great, thanks. This is exactly what I wanted.

Best,

Paul

On Wed, Nov 19, 2014 at 6:46 PM, Russ Fiedler <russell.fiedler@xxxxxxxx> wrote:

Hi Paul,

What you could do is create a template palette file with colour decided by values (RGB_Mapping By_value) and write a small script which takes the upper/lower bounds you want and fills them in. The substitution command can be issued via the spawn command.

Say we have dummy_template.spk
------------
RGB_Mapping By_value
! Red/White/Blue template
  LO     100   0   0
  -0.001 100 100 100
  0.001 100 100 100
  HI       0  0  100
------------

A little bit of sed...

yes?  sp "sed -s 's/LO/-2/;s/HI/5/' <dummy_template.spk > red_white_blue.spk"
yes? sp cat red_white_blue.spk
RGB_Mapping By_value
! Red/White/Blue template
  -2     100   0   0
  -0.001 100 100 100
  0.001 100 100 100
  5       0  0  100

In general you can use symbols to make this clearer

yes? def sym loval = -2
yes? def sym hival = 5
yes?  sp "sed -s 's/LO/($loval)/;s/HI/($hival)/' <dummy_template.spk > red_white_blue.spk"

 Even better put the spawn command and symbol definitions into a ferret script along with a few other commands  and it can even adjust the middle values or you can adjust multiple levels of a palette and all you'll ever need to do is issue a command like

go make_rwb_palette -2 5

Cheers,
Russ





On 20/11/14 04:45, Paul Goddard wrote:
Hello all,

I would like to have a color scale that is divergent (such as blue_darkred.spk) where the near zero-values are light and get darker the further from zero in each direction. However, I would like the, say red (positive) values to go to 4, but the blue (negative) values to only go to -2. Therefore, the zero is not the centered number on the scale, though the colors diverge from it as if it were. I hope to be able to do this to show the changes in the negative values with a darker shade. Is this possible without creating new *.spk scales for every graph?

Thanks in advance,

Paul

--
Paul Goddard
PhD Candidate
Department of Geosciences
University of Arizona




--
Paul Goddard
PhD Candidate
Department of Geosciences
University of Arizona

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement