Package ucar.unidata.ui.colortable
Class ColorTableDefaults
java.lang.Object
ucar.unidata.ui.colortable.ColorTableDefaults
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final float[][]
allOneColor
(Color color) Make a color table representing this color.static final float[][]
allOneColor
(Color color, boolean addAlpha) Make a color table representing this color.static final float[][]
bright12()
Make 12 color bright spectrum; blue (lo) to red (hi)static final float[][]
bright14()
Make 14 color bright spectrum; blue (lo) to red (hi)static final float[][]
bright16()
Make 16 color bright spectrum; blue (lo) to red (hi)static final float[][]
bright38()
Make a 38-color bright spectrum; blue (low values) to red (high values).static ColorTable
createColorTable
(String name, String category, float[][] table) Create a ColorTable and add it to the given liststatic ColorTable
createColorTable
(ArrayList l, String name, String category, float[][] table) Create a ColorTable and add it to the given liststatic ColorTable
createColorTable
(ArrayList l, String name, String category, float[][] table, boolean tableFlipped) Create a ColorTable and add it to the given liststatic ColorTable
createColorTable
(ArrayList l, String name, String category, float[][] table, boolean tableFlipped, Range range) Create a ColorTable and add it to the given liststatic ArrayList
Create the default color tablesstatic 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.static final float[][]
DZ2()
A 2nd color table for radar reflectivity, better than DZ1 for VisAD.static final float[][]
grayTable
(int numColors, boolean inverse) Make a color table ranging from black to white; linear changes in RGB amounts.static final float[][]
grayTable1
(int len) Make a color table ranging from black to white; linear changes in RGB amounts.static final 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 methodstatic List
makeAwips2ColorTables
(String name, String category, String file) Convert a AWIPS II ".cmap" file to an IDVColorTable
and add the new color table to theColorTableManager
.static List
makeGempakColorTables
(String name, String category, String file) Make GEMPAK color tablesstatic List
makeNclRgbColorTables
(String name, String cat, String file, String contents) Make ColorTables from NCAR Command Language (NCL) RGB filesstatic List
makeRgbColorTables
(String name, String cat, String file) Make color tables from RGB filesstatic List
Make color tables from RGB tuples in a filestatic final float[][]
makeTableFromAct
(String name) Read in and process the act color tablestatic final float[][]
makeTableFromET
(String name) Read in and process the mcidas color tablestatic final float[][]
makeTableFromET
(String name, boolean fromAuxdata) Read in and process the mcidas color tablestatic final float[][]
makeTableFromPal
(String name) Read in and process the pal color tablestatic final float[][]
makeTableFromPal1
(String name) Read in and process the pal1 color tablestatic final float[][]
makeTableFromPal2
(String name) Read in and process the pal2 color tablestatic final float[][]
percentBlue
(int len) Make a color table ranging from white to dark blue, typically for parms with 0 to 100%.static final 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 final float[][]
percentYellowBlue
(int len) Make a color table ranging from yellow to dark blue, typically for parms with 0 to 100%.static final float[][]
Make The first standard Unidata MetApps liquid precip amount color table.static final float[][]
rainbow
(int len) Make the standard VisAD rainbow (blue lo to red high) color table with definable length.static final float[][]
Make the first temperature color table.static final float[][]
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 final float[][]
Make a third temperature spectrum; NEEDS WORK setRange() to -55 to 50 Celsiusstatic final float[][]
Make the fourth temperature color table.static final float[][]
Provide a color table suitable for topographystatic final float[][]
make the nominal wind speed color table, based on color table temperatureCT4.static final float[][]
windSpeed
(int len) Make a color table ranging from white to dark blue (negatives); white to green going 0 to large positive.
-
Field Details
-
NAME_DEFAULT
The name of the "default" color table- See Also:
-
-
Constructor Details
-
ColorTableDefaults
public ColorTableDefaults()
-
-
Method Details
-
createColorTable
Create a ColorTable and add it to the given list- Parameters:
name
- The CT namecategory
- Its categorytable
- The actual data- Returns:
- The color table
-
createColorTable
public static ColorTable createColorTable(ArrayList l, String name, String category, float[][] table) Create a ColorTable and add it to the given list- Parameters:
l
- List to add the ColorTable toname
- The CT namecategory
- Its categorytable
- The actual data- Returns:
- The color table
-
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 toname
- The CT namecategory
- Its categorytable
- The actual datatableFlipped
- If true then the table data is not in row major order- Returns:
- The color table
-
createColorTable
public static ColorTable createColorTable(ArrayList l, String name, String category, float[][] table, boolean tableFlipped, Range range) Create a ColorTable and add it to the given list- Parameters:
l
- List to add the ColorTable toname
- The CT namecategory
- Its categorytable
- The actual datatableFlipped
- If true then the table data is not in row major orderrange
- the color table range- Returns:
- The color table
-
createColorTables
Create the default color tables- Returns:
- List of color tables
-
rainbow
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
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
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
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
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
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 tableinverse
- 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
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
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
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
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
Make a color table representing this color.- Parameters:
color
- color to use- Returns:
- the color table this color
-
allOneColor
Make a color table representing this color.- Parameters:
color
- color to useaddAlpha
- true to add an alpha channel- Returns:
- the color table this color
-
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
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
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 namefromAuxdata
- Is this file from the auxdata dir- Returns:
- The processed CT data
- Throws:
IllegalArgumentException
- When bad things happen
-
makeTableFromPal1
Read in and process the pal1 color table- Parameters:
name
- File name- Returns:
- The processed CT data
- Throws:
IOException
- On badness
-
makeTableFromPal2
Read in and process the pal2 color table- Parameters:
name
- File name- Returns:
- The processed CT data
- Throws:
IOException
- On badness
-
makeGempakColorTables
Make GEMPAK color tables- Parameters:
name
- name of the tablecategory
- the categoryfile
- the file to read- Returns:
- a list of colors in the table (why a list, I don't know)
-
main
Main method- Parameters:
args
- arguments- Throws:
Exception
- something bad happened
-
makeNclRgbColorTables
public static List makeNclRgbColorTables(String name, String cat, String file, String contents) throws IOException Make ColorTables from NCAR Command Language (NCL) RGB files- Parameters:
name
- name of tablecat
- categoryfile
- the filecontents
- the file contents- Returns:
- the color table in a List
- Throws:
IOException
- problem opening file
-
makeRgbColorTables
public static List makeRgbColorTables(String name, String cat, String file, List lines, String delimiter) Make color tables from RGB tuples in a file- Parameters:
name
- the name of the color tablecat
- the categoryfile
- the file to readlines
- the linesdelimiter
- the rgb tuple delimiters- Returns:
- the color table in a list
-
makeRgbColorTables
Make color tables from RGB files- Parameters:
name
- name of the color tablecat
- categoryfile
- the file to read- Returns:
- the color table in a List
- Throws:
IOException
- problem reading the file
-
makeTableFromAct
Read in and process the act color table- Parameters:
name
- File name- Returns:
- The processed CT data
- Throws:
IOException
- On badness
-
makeTableFromPal
Read in and process the pal color table- Parameters:
name
- File name- Returns:
- The processed CT data
- Throws:
IOException
- On badness
-
makeAwips2ColorTables
Convert a AWIPS II ".cmap" file to an IDVColorTable
and add the new color table to theColorTableManager
.- Parameters:
name
- Name to use in the color table manager.category
- Category of the color table.file
- Path to AWIPS II ".cmap" file.- Returns:
- Either a
List
containing the newly createdColorTable
ornull
if the conversion failed.
-