# Re: [ferret_users] Customized palette

You can write the palette from within Ferret. This is probably not the most elegant solution, but it works:


1) make a one-line file in your Ferret path consisting of the line (I call it "palette_header"):

RGB_Mapping By_Value


2) make a script in your Ferret path with the following lines (I call it "make_centered_palette.jnl"):

sp \rm centered_palette.spk

list/nohead/append/file=centered_palette.spk/format=(4f8.0) vname[i=@min,j=@min,k=@min,l=@min]-1,0,0,80 list/nohead/append/file=centered_palette.spk/format=(4f8.0) 0,90,90,90 list/nohead/append/file=centered_palette.spk/format=(4f8.0) vname[i=@max,j=@max,k=@max,l=@max]+1,80,0,0


3) in your Ferret session (or another script), suppose you want to shade the variable "rose" (e.g. from etopo20, as I tested):

set dat etopo20
let vname=rose
go make_centered_palette.jnl
pal centered_palette


I suppose this will fail if there is no zero in the data being shaded ....

Billy K

On Oct 21, 2010, at 1:36 PM, Jian Ma wrote:


Hi Andy,

Thanks! But that (percentage method) only works when you use

lev=(-a,a,b). If 0 is not in the middle of your value range, it does not
work to show 0 as white.

Tony

On Thu, 2010-10-21 at 08:59 -0600, Andy Jacobson wrote:

Hi Tony,


Did you try light_centered.spk or white_centered.spk? If you don't like those, my memory is that you can define a palette with just three colors (white and the two endpoints), and ferret will interpolate.

-Andy

On Wed 20 Oct 2010, at 19:31 , Jian Ma wrote:


Hi All,


There are 3 methods in Ferret to define new pal files. However, I found
no way to define one like this:

White near 0, dark red on maximum, and blue on minimum.


I know I can use blue_darkred to achieve this when I have proper level values or change the percentage values in the pal file, but is there any method to make a universal pal file to self adjust correctly about 0?


The last method is to write a fortran program to generate files, given
particular level values.

Many thanks,
Tony