This tool is used to generate, manipulate and interact with DIRSIG emissivity files.
$ ems_tool -h
Usage: ems_tool [options] <command> ...
Options:
-h/--help
Display this help and exit.
--log_level string
Sets the minimum logging level. Values are: debug, info, warning, error, critical, off
Commands:
generate
export
expand
For subcommand help: ems_tool <command> -h
The Export Tool
The export
tool strips some of the formatting from the input file
and writes a two-column, ASCII/Text file that can be easily plotted
in Gnuplot (or any other plotting package)
to visualize it. The format of the exported data is:
-
Two column (wavelength and value), one pair per line, tab-separated.
-
At the start of each curve is a "comment" line (e.g.,
# Curve #2
).-
Gnuplot ignores lines that begin with
#
.
-
-
After each curve is an empty line
-
Gnuplot will break a plot line when it encounters an empty line.
-
export
tool.$ ems_tool export -h
Usage: ems_tool ... export [options] input_filename
Positional Arguments:
input_filename (required!)
The input DIRSIG emissivity file to export.
Options:
-h/--help
Display this help and exit.
-o/--output string
The ASCII/Text output file containing the exported data.
--as_reflectance
The output file will contain reflectance rather than emissivity data.
Example Usage
$ ems_tool export --output_filename=example.txt example.ems
If you want to convert the data from emissivity to reflectance during the
export, you can add the (optional) --as_reflectance
option:
$ ems_tool export --as_reflectance --output_filename=example.txt example.ems
And this file can be easily plotted in GNUplot with the following command:
gnuplot> plot "example.txt" using 1:2 with lines
If you want to export an emissivity file to a an ENVI Spectral Library file, use the "convert" tool in the sli_tool utility. |
The Expand Tool
The expand
tool is used to take a small emissivity database file (limited
number of curves) and generate a new file that contains many curves. The
input is an existing DIRSIG emissivity file and the number
of curves to generate.
expand
tool.$ ems_tool expand -h
Usage: ems_tool ... expand [options] input_filename output_filename
Positional Arguments:
input_filename (required!)
The input DIRSIG emissivity file to expand.
output_filename (required!)
The output DIRSIG emissivity file containing the expanded curve set.
Options:
-h/--help
Display this help and exit.
-c/--curve_count uint
The number of curves to generate in the output file.
Example Usage
$ ems_tool --log_level=debug expand --curve_count=100 --output_filename=out.ems in.ems
[debug] ExpandTool
[debug] Reading emissivity file 'in.ems'
[debug] File contains 6 curve(s)
[debug] Computing multivariate stats for curve set
[debug] Computing the mean vector
[debug] Computing the covariance matrix
[debug] Computing the eigen values
[debug] Checking if eigen matrix is singular
[debug] Computing the inverse eigen matrix
[debug] Generating 100 new curves
[debug] Generating curve #0
[debug] Generating curve #1
...
[debug] Generating curve #99
[debug] Writing emissivity file 'out.ems'
Important Notes:
-
The input emissivity file should contain data for a single material, represented by a uni-modal distribution.
-
The input emissivity file should contain enough curves to capture the spectral mean, variance and covariance of the material.
The Generate Tool
The generate
tool is similar to the expand tool except
that is takes a binary ENVI statistics file as the primary input to
generate a new multi-curve database.
generate
tool.$ ems_tool generate -h
Usage: ems_tool ... generate [options] input_filename output_filename
Positional Arguments:
input_filename (required!)
The input ENVI statistics file (.sta) used to generate the curve set.
output_filename (required!)
The output DIRSIG emissivity file containing the generated curve set.
Options:
-h/--help
Display this help and exit.
-c/--curve_count uint
The number of curves to generate in the output file.
Example Usage
$ ems_tool --log_level=debug generate --sta_filename=grass.sta --curve_count=100 --output_filename=grass.ems
[debug] GenerateTool
[debug] Reading ENVI statistics file 'grass.sta'
[debug] ID = 1313426753 (new format, non-native endian)
[debug] sampleCount = 1688
[debug] lineCount = 2034
[debug] bandCount = 272
[debug] dataType = 4
[debug] ROI index = -1
[debug] ROI Box = [273,529] -> [1473,2007]
[debug] ROI name = '[/Users/dirsig//raw_9088_rd_rf_or]^[]^[b]'
[debug] File contains 272 wavelength(s)
[debug] Wavelengths scalar = 0.001
[debug] Extracting spectral mean data
[debug] Extracting spectral covariance data
[debug] Computing the eigen values
[debug] Checking if eigen matrix is singular
[debug] Computing the inverse eigen matrix
[debug] Generating 10 new curves
[debug] Generating curve #0
[debug] Generating curve #1
[debug] Generating curve #2
...
[debug] Generating curve #99
[debug] Writing emissivity file 'grass.ems'
Important Notes:
-
The input statistics file should contain data for a single material, represented by a uni-modal distribution.