ANSI-C programs: float2short.c, float2uchar.c, short2float.c, uchar2float.c
NAME
float2short - Convert file of type float to file of type short
integer.
float2uchar - Convert file of type float to file of type unsigned
char.
short2float - Convert file of type short integer to file of type
float.
uchar2float - Convert file of type unsigned char to file of type
float.
SYNOPSIS
float2short <infile> <outfile> [a]
[b]
<infile> | input data file (float) |
<outfile> | output data file (short integer) |
[a] | scaling factor (default=1.0) |
[b] | scaling exponent (default=1.0) |
float2uchar <infile> <outfile> [a]
[b]
<infile> | input data file (float) |
<outfile> | output data file (unsigned char) |
[a] | scaling factor (default=1.0) |
[b] | scaling exponent (default=1.0) |
short2float <infile> <outfile> [a]
[b]
<infile> | input data file (short integer) |
<outfile> | output data file (float) |
[a] | scaling factor (default=1.0) |
[b] | scaling exponent (default=1.0) |
uchar2float <infile> <outfile> [scale]
[exp [offset]
<infile> | input data file (unsigned char) |
<outfile> | output data file (float) |
[scale] | scaling factor (default=1.0) |
[exp] | exponent (default=1.0) |
[offset] | offset (default=0.0) |
EXAMPLES
short2float short_integer_dem float_dem 0.1 1.0
(converts the input file of type short integer to floating point
and multiplies each value with the scale factor
0.1)
DESCRIPTION
float2short, float2uchar, short2float, uchar2float convert image
data between 4-byte float, short integer (2-byte), and unsigned
char (byte) formats. the uchar2float program also has the option
to subtract a floating point number from the data prior to
scaling, i.e. the ouput values are scale * (data_in -
offset)**exp
The programs read the input data, apply the user defined scaling function of the type out = a*in^b and write out the scaled value in the output format.
Notice the valid ranges of the short integer and unsigned char formats:
format | value range |
short integer | -32768 ... 32767 |
unsigned char | 0 ... 255 |
Values which are outside the valid range after application of the scaling function are set to the nearest valid value.
The programs float2short and float2uchar allow to reduce the volume of image data by factors of 2 and 4, respectively.
Compression of SAR backscatter coefficients (files
such as *.mli, *.pwr)
To reduce the data volume of SAR backscattering coefficients to 2
byte per value we recommend to use float2short with a=1e03 and
b=0.5. short2float with a=1e-06 and b=2.0 allows to convert such
compressed short integer format data back to float format.
To reduce the data volume of SAR backscattering coefficients to 1 byte per value we recommend to use float2uchar with a=177.8 and b=0.25. uchar2float with a=1e-09 and b=4.0 allows to convert back such compressed unsigned char format data back to float format.
Compression of coherence data (files such as *.cc,
*.cc_ad)
To reduce the data volume of coherence data to 1 byte per value
we recommend to use float2uchar with a=255.0 and b=1.0.
uchar2float with a=0.00392 and b=1.0 allows to convert such
compressed unsigned char format data back to float format.
OPTIONS
ESA processed SLC and PRI data can be converted from short
integer to float format using short2float.
Decompression of ESA processed SLC data
To decompress ESA processed SLC data short2float with b=1.0 may
be used. In addition the scale factor a can be used to achieve an
approximate radiometric calibration of the data.
Decompression of ESA processed PRI data
To decompress ESA processed PRI data short2float with b=2.0 may
be used (Notice that ESA PRI values are proportional to the
square root of the backscatter intensity. The values of the MSP
and ISP *.mli and *.pwr files, on the other hand, are
proportional to the backscatter intensity).
SEE ALSO
LAT_file_formats
© Copyrights for Documentation, Users Guide and Reference Manual by Gamma Remote Sensing, 2008.
UW, CW, last change 5-Mar-2008.