Converting Ferret Colormaps to VCS colormaps
Explains how to convert Ferret colormaps to VCS colormaps
CDAT comes with a script (found in the bin directory of your cdat installation) called spktovcs.py
You can either use it from the command line:
spk2scr.py --help
usage: spk2scr.py [options]Or import this file and use the spk2vcs function it contains:
Reads in and converts Ferret (spk) colormap file to vcs colormap
If method is set to 'blend':
colors will be set using the ferret % value, and blending will be used in between
0% in ferret corresponds to index_start
100% in ferret corresponds to index_end
If method is set to 'contiguous':
colors will be set starting at index_start and assigned in order as found in the ferret (spk) file,
no blending between colors
options:
--version show program's version number and exit
-h, --help show this help message and exit
--file=FILE Ferret (spk) colormap file to convert, [default:
pal1.spk]
--name=NAME Name of the returned vcs colormap, [default: uses
ferret (spk) file name]
--out=OUT Name of the returned vcs script file, [default:
file.scr]
--index_start=INDEX_START
start index for mapping of ferret colors into vcs
colormap, [default: 16]
--index_end=INDEX_END
end index for mapping of ferret colors into vcs
colormap, [default: 239]
--method=METHOD method for mapping of ferret colors into vcs colormap
(blend or contiguous), [default: blend]
--blend end index for mapping of ferret colors into vcs
colormap, overrides --method option
--contiguous end index for mapping of ferret colors into vcs
colormap, overrides --method option
--verbose Enable verbose method while converting colorcells,
[default: False]
>>> import spk2scr
>>> print spk2scr.spk2vcs.__doc__
Reads in and converts Ferret (spk) colormap file to vcs colormap
If method is set to 'blend':
colors will be set using the ferret % value, and blending will be used in between
0% in ferret corresponds to index_start
100% in ferret corresponds to index_end
If method is set to 'contiguous':
colors will be set starting at index_start and assigned in order as found in the ferret (spk) file,
no blending between colors
Usage:
cmap, ncolors = spk2vcs(file,cname=None,x=None)
Input:
file : Ferret (spk) colormap file
cname : VCS output colormap name, if None, uses ferret file name
x : vcs canvas, if None then a vcs canvas instance will be created
index_start : 0% of ferret % index, default is 16
index_end : 100% of ferret % index, defalut is 239
method : 'blend' or 'adjacent', defalut is 'blend'
Output:
cmap : vcs colormap object, with conitguous color set from index_Start if method='contiguous'
or spread from index_start to index_end if method is 'blend'