ucar.unidata.ui.colortable
Class ColorTableDefaults

java.lang.Object
  extended by ucar.unidata.ui.colortable.ColorTableDefaults

public class ColorTableDefaults
extends Object

A class to provide color tables suitable for data displays. Uses some code by Ugo Taddei. All methods are static.

Version:
$Id: ColorTableDefaults.java,v 1.15 2007/05/04 19:56:06 jeffmc Exp $

Field Summary
static String NAME_DEFAULT
          The name of the "default" color table
 
Constructor Summary
ColorTableDefaults()
           
 
Method Summary
static float[][] allOneColor(Color color)
          Make a color table representing this color.
static float[][] allOneColor(Color color, boolean addAlpha)
           
static float[][] bright12()
          Make 12 color bright spectrum; blue (lo) to red (hi)
static float[][] bright14()
          Make 14 color bright spectrum; blue (lo) to red (hi)
static float[][] bright16()
          Make 16 color bright spectrum; blue (lo) to red (hi)
static float[][] bright38()
          Make a 38-color bright spectrum; blue (low values) to red (high values).
static ColorTable createColorTable(ArrayList l, String name, String category, float[][] table)
          _more_
static ColorTable createColorTable(ArrayList l, String name, String category, float[][] table, boolean tableFlipped)
          Create a ColorTable and add it to the given list
static ColorTable createColorTable(String name, String category, float[][] table)
          Create a ColorTable and add it to the given list
static ArrayList createColorTables()
          Create the default color tables
static float[][] DZ1()
          Make a color table for radar reflectivity as close as possible to the one used by the NWS in their web page displays of same.
static float[][] DZ2()
          A 2nd color table for radar reflectivity, better than DZ1 for VisAD.
static float[][] grayTable(int numColors, boolean inverse)
          Make a color table ranging from black to white; linear changes in RGB amounts.
static float[][] grayTable1(int len)
          Make a color table ranging from black to white; linear changes in RGB amounts.
static float[][] invRainbow(int len)
          Make the standard VisAD inverse rainbow (red to blue) table with definable length; created by by Ugo Taddei.
static void main(String[] args)
          _more_
static List makeGempakColorTables(String name, String category, String file)
          _more_
static List makeNclRgbColorTables(String name, String cat, String file, String contents)
          _more_
static List makeRgbColorTables(String name, String cat, String file)
          _more_
static List makeRgbColorTables(String name, String cat, String file, List lines, String delimiter)
          _more_
static float[][] makeTableFromAct(String name)
          Read in and process the act color table
static float[][] makeTableFromET(String name)
          Read in and process the mcidas color table
static float[][] makeTableFromET(String name, boolean fromAuxdata)
          Read in and process the mcidas color table
static float[][] makeTableFromPal(String name)
          Read in and process the pal color table
static float[][] makeTableFromPal1(String name)
          Read in and process the pal1 color table
static float[][] makeTableFromPal2(String name)
          Read in and process the pal2 color table
static float[][] percentBlue(int len)
          Make a color table ranging from white to dark blue, typically for parms with 0 to 100%.
static float[][] percentYelGrnBlue(int len)
          Make a color table ranging from yellow to blue, through green; typically for parms with values spanning 0 to 100 %.
static float[][] percentYellowBlue(int len)
          Make a color table ranging from yellow to dark blue, typically for parms with 0 to 100%.
static float[][] precipCT1()
          Make The first standard Unidata MetApps liquid precip amount color table.
static float[][] rainbow(int len)
          Make the standard VisAD rainbow (blue lo to red high) color table with definable length.
static float[][] temperatureCT1()
          Make the first temperature color table.
static float[][] temperatureCT2()
          Make a bright temperature spectrum; blue (lo) to red (hi) 5 deg C steps or bands; some duplicate colors below 0 Length is fixed at 21 for now.
static float[][] temperatureCT3()
          Make a third temperature spectrum; NEEDS WORK setRange() to -55 to 50 Celsius
static float[][] temperatureCT4()
          Make the fourth temperature color table.
static float[][] topographyCT()
          Provide a color table suitable for topography
static float[][] windspeed()
          make the nominal wind speed color table, based on color table temperatureCT4.
static float[][] windSpeed(int len)
          Make a color table ranging from white to dark blue (negatives); white to green going 0 to large positive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_DEFAULT

public static final String NAME_DEFAULT
The name of the "default" color table

See Also:
Constant Field Values
Constructor Detail

ColorTableDefaults

public ColorTableDefaults()
Method Detail

createColorTable

public static ColorTable createColorTable(String name,
                                          String category,
                                          float[][] table)
Create a ColorTable and add it to the given list

Parameters:
name - The CT name
category - Its category
table - The actual data
Returns:
The color table

createColorTable

public static ColorTable createColorTable(ArrayList l,
                                          String name,
                                          String category,
                                          float[][] table)
_more_

Parameters:
l - _more_
name - _more_
category - _more_
table - _more_
Returns:
_more_

createColorTable

public static ColorTable createColorTable(ArrayList l,
                                          String name,
                                          String category,
                                          float[][] table,
                                          boolean tableFlipped)
Create a ColorTable and add it to the given list

Parameters:
l - List to add the ColorTable to
name - The CT name
category - Its category
table - The actual data
tableFlipped - If true then the table data is not in row major order
Returns:
The color table

createColorTables

public static ArrayList createColorTables()
Create the default color tables

Returns:
List of color tables

rainbow

public static final float[][] rainbow(int len)
                               throws IllegalArgumentException
Make the standard VisAD rainbow (blue lo to red high) color table with definable length.

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

temperatureCT1

public static final float[][] temperatureCT1()
                                      throws IllegalArgumentException
Make the first temperature color table. Pale blue to dark blue in lower bins, for below 0 C or 273.15 Kelvin; white thru yellow, orange, red-orange to red in upper bins over 0 C to 50C. designed for 5-degrees-wide Celcius bands. SHOULD do scalarMap.setRange -85 to +50 Celsius.

Returns:
float[3][27] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

temperatureCT4

public static final float[][] temperatureCT4()
                                      throws IllegalArgumentException
Make the fourth temperature color table. This is notably better than temperature color tables CT1, CT2, or CT3. SHOULD also set the data's scalarMap.setRange -90 to +45 Celsius. for temperature to lock blue transition to freezing point. also happens to make a good color table for wind speed 0 to 60 m/s or so.

Returns:
float[3][135] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

temperatureCT2

public static final float[][] temperatureCT2()
Make a bright temperature spectrum; blue (lo) to red (hi) 5 deg C steps or bands; some duplicate colors below 0 Length is fixed at 21 for now. setRange() to -55 to 50 Celsius This looks better than tempCT1 in VisAD 3D surfaces; worse in 2D.

Returns:
float[3][21] the color table

temperatureCT3

public static final float[][] temperatureCT3()
Make a third temperature spectrum; NEEDS WORK setRange() to -55 to 50 Celsius

Returns:
float[2][21] the color table

precipCT1

public static final float[][] precipCT1()
                                 throws IllegalArgumentException
Make The first standard Unidata MetApps liquid precip amount color table. Pale blue to dark blue to green to yellow, to orange, to red-orange to red. Length 100. SHOULD also do Contour2DDisplayable::setRangeforColor(0.0, 25.0) so that first color band (above black) starts at 25/100 = 0.25.

Returns:
float[3][100] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

invRainbow

public static final float[][] invRainbow(int len)
                                  throws IllegalArgumentException
Make the standard VisAD inverse rainbow (red to blue) table with definable length; created by by Ugo Taddei.

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

percentBlue

public static final float[][] percentBlue(int len)
                                   throws IllegalArgumentException
Make a color table ranging from white to dark blue, typically for parms with 0 to 100%. setRange of values 0.0 to 100.0 Used for relative humidity, probability of precip (rain, snow); fog.

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

grayTable

public static final float[][] grayTable(int numColors,
                                        boolean inverse)
                                 throws IllegalArgumentException
Make a color table ranging from black to white; linear changes in RGB amounts.

Parameters:
numColors - number of descrete colors for the table
inverse - true for white to black instead of black to white
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

grayTable1

public static final float[][] grayTable1(int len)
                                  throws IllegalArgumentException
Make a color table ranging from black to white; linear changes in RGB amounts. Offset; begins at X gray25, RGB = 64, 64, 64 out of 255

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

percentYellowBlue

public static final float[][] percentYellowBlue(int len)
                                         throws IllegalArgumentException
Make a color table ranging from yellow to dark blue, typically for parms with 0 to 100%. setRange of values 0.0 to 100.0 Can use for relative humidity, probability of precip. Problem: 50% RH color is dull grey; see percentYelGrnBlue()

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

percentYelGrnBlue

public static final float[][] percentYelGrnBlue(int len)
                                         throws IllegalArgumentException
Make a color table ranging from yellow to blue, through green; typically for parms with values spanning 0 to 100 %. setRange of values 0.0 to 100.0. Can use for relative humidity, probability of precip, etc. Espcially good where a higher percewnt is associated with mnore moisture.

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

windSpeed

public static final float[][] windSpeed(int len)
                                 throws IllegalArgumentException
Make a color table ranging from white to dark blue (negatives); white to green going 0 to large positive. center SetRange of values on 0.0 for proper alignment with colors. Used for speed of wind components u and v, which can have negative speeds.

Parameters:
len - length; how many entries desired in the color table.
Returns:
float[3][len] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

bright38

public static final float[][] bright38()
Make a 38-color bright spectrum; blue (low values) to red (high values). These are close to or at the brightest possible colors. Good for general purpose with higher values needing warmer colors.

Returns:
float[3][38] the color table

bright16

public static final float[][] bright16()
Make 16 color bright spectrum; blue (lo) to red (hi)

Returns:
float[3][16] the color table

bright14

public static final float[][] bright14()
Make 14 color bright spectrum; blue (lo) to red (hi)

Returns:
float[3][14] the color table

bright12

public static final float[][] bright12()
Make 12 color bright spectrum; blue (lo) to red (hi)

Returns:
float[3][12] the color table

topographyCT

public static final float[][] topographyCT()
Provide a color table suitable for topography

Returns:
float[3][256] the color table

allOneColor

public static final float[][] allOneColor(Color color)
Make a color table representing this color.

Parameters:
color - color to use
Returns:
the color table this color

allOneColor

public static final float[][] allOneColor(Color color,
                                          boolean addAlpha)

DZ1

public static final float[][] DZ1()
Make a color table for radar reflectivity as close as possible to the one used by the NWS in their web page displays of same. It turns out that this color table used in VisAD makes a crummy appearence (due to VisAD blurring colors between values?). Smoother transistions of color do much better in VisAD displays, such as in color table DZ2 below. for data displayed, setRange() 0 to 80 (dbz); 16 bins

Returns:
float[3][16] the color table

DZ2

public static final float[][] DZ2()
A 2nd color table for radar reflectivity, better than DZ1 for VisAD. for data displayed, setRange() -10.0 to 60.0 (dbz); 16 bins. by Stu Wier.

Returns:
float[3][16] the color table

windspeed

public static final float[][] windspeed()
                                 throws IllegalArgumentException
make the nominal wind speed color table, based on color table temperatureCT4. set the data's scalarMap.setRange from 0.0 to say 70 or 80.0 m/s

Returns:
float[3][70] the color table
Throws:
IllegalArgumentException - from construction of VisAd objects

makeTableFromET

public static final float[][] makeTableFromET(String name)
                                       throws IllegalArgumentException
Read in and process the mcidas color table

Parameters:
name - File name
Returns:
The processed CT data
Throws:
IllegalArgumentException

makeTableFromET

public static final float[][] makeTableFromET(String name,
                                              boolean fromAuxdata)
                                       throws IllegalArgumentException
Read in and process the mcidas color table

Parameters:
name - File name
fromAuxdata - Is this file from the auxdata dir
Returns:
The processed CT data
Throws:
IllegalArgumentException - When bad things happen

makeTableFromPal1

public static final float[][] makeTableFromPal1(String name)
                                         throws IOException
Read in and process the pal1 color table

Parameters:
name - File name
Returns:
The processed CT data
Throws:
IOException - On badness

makeTableFromPal2

public static final float[][] makeTableFromPal2(String name)
                                         throws IOException
Read in and process the pal2 color table

Parameters:
name - File name
Returns:
The processed CT data
Throws:
IOException - On badness

makeGempakColorTables

public static List makeGempakColorTables(String name,
                                         String category,
                                         String file)
_more_

Parameters:
name - _more_
category - _more_
file - _more_
Returns:
_more_

main

public static void main(String[] args)
                 throws Exception
_more_

Parameters:
args - _more_
Throws:
Exception - _more_

makeNclRgbColorTables

public static List makeNclRgbColorTables(String name,
                                         String cat,
                                         String file,
                                         String contents)
                                  throws IOException
_more_

Parameters:
name - _more_
cat - _more_
file - _more_
contents - _more_
Returns:
_more_
Throws:
IOException - _more_

makeRgbColorTables

public static List makeRgbColorTables(String name,
                                      String cat,
                                      String file,
                                      List lines,
                                      String delimiter)
_more_

Parameters:
name - _more_
cat - _more_
file - _more_
lines - _more_
delimiter - _more_
Returns:
_more_

makeRgbColorTables

public static List makeRgbColorTables(String name,
                                      String cat,
                                      String file)
                               throws IOException
_more_

Parameters:
name - _more_
cat - _more_
file - _more_
Returns:
_more_
Throws:
IOException - _more_

makeTableFromAct

public static final float[][] makeTableFromAct(String name)
                                        throws IOException
Read in and process the act color table

Parameters:
name - File name
Returns:
The processed CT data
Throws:
IOException - On badness

makeTableFromPal

public static final float[][] makeTableFromPal(String name)
                                        throws IOException
Read in and process the pal color table

Parameters:
name - File name
Returns:
The processed CT data
Throws:
IOException - On badness