public class cwexport
extends java.lang.Object
The export tool translates earth data into external file formats.
cwexport - translates earth data into external file formats.
cwexport [OPTIONS] input output
-f, --format=TYPE
-h, --help
-H, --header
-m, --match=PATTERN
-M, --missing=VALUE
-v, --verbose
--version
-c, --scale=FACTOR/OFFSET
-o, --byteorder=ORDER
-r, --range=MIN/MAX
-s, --size=TYPE
-d, --dec=DECIMALS
-D, --delimit=STRING
-n, --nocoords
-R, --reverse
-S, --dcs
-C, --cw
The export tool translates earth data into external formats as described below. In all cases, 2D data sets are exported in row major order starting from row 0. For example, if the Earth data values form the 2D array:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
then values are output in the order:
0 1 2 3 4 5 6 7 ...
In the general case, multiple variables may be exported to the same data file. The use of the --match option may be used to select a specific variable or subset of variables.
The output is a stream of binary data values -- either 8-bit unsigned bytes, 16-bit signed integers, or 32-bit IEEE floating point values. For 8- and 16-bit output, data values may be scaled to integers using a minimum and maximum or by using a scaling factor and offset. For minimum/maximum scaling, integer data is calculated from data values using the equation:
integer = type_min + type_range*((value - min) / (max - min))
where type_min
is 0 for 8-bit and -32768 for 16-bit, and
type_range
is 255 for 8-bit and 65535 for 16-bit. For
scaling factor and offset, the following equation is used:
integer = value/factor + offset
In both cases, the results are rounded to the nearest integer and out of range values are assigned the missing value.
The output is an ASCII text file with latitude, longitude, and data value printed -- one data value per line.
The output is a stream of 32-bit IEEE floating point values, ready for input to ArcGIS applications as a binary grid file. A header file may also be created to specify the earth location and other parameters. In the case of the ArcGIS format, only one variable is allowed per binary grid file. If an attempt to export multiple variables is made, only the first variable is actually written.
The output is either a NetCDF 3 or 4 dataset with CF 1.4 convention metadata. The formatting follows as much as possible the recommendations and examples in the document "Encoding CoastWatch Satellite Data in NetCDF using the CF Metadata Conventions", Peter Hollemans, February 2010. In some cases, the source data for some attributes may not be available, in which case the output NetCDF may need to be modified and extended.
0 on success, > 0 on failure. Possible causes of errors:
The following shows the export of AVHRR channel 1 data from a CoastWatch HDF file with the default 32-bit IEEE floating point value format, host byte order, no header, in verbose mode:
phollema$ cwexport --verbose --match 'avhrr_ch1' 2002_216_1853_n16_gr.hdf 2002_216_1853_n16_gr.ch1 cwexport: writing 'avhrr_ch1'
The example below shows the export of AVHRR channels 1, 2, and 4 to the same output file from a CoastWatch HDF file using 8-bit unsigned byte format, no header, in verbose mode. Range scaling is used to scale all values between -30 and 30 prior to conversion to byte values in the range 0 to 255. Note that some values may fall outside the range and be clipped, especially albedo values which can range up to 100. The clipped values are assigned the default missing value, which for byte data is 0.
phollema$ cwexport --verbose --match 'avhrr_ch[124]' --size byte --range -30/30 2002_216_1853_n16_gr.hdf 2002_216_1853_n16_gr.ch124 cwexport: writing 'avhrr_ch1' cwexport: writing 'avhrr_ch2' cwexport: writing 'avhrr_ch4'
The example shows the export of AVHRR channel 4 data to an ASCII text file from a CoastWatch IMGMAP file in verbose mode. The geographic coordinates are printed in the order longitude, latitude, and delimited with a comma character. Any missing values are denoted with the value -999. A one line dimension header is prepended to the dataset.
phollema$ cwexport --verbose --match 'avhrr_ch4' --format text --reverse --delimit ',' --missing -999 --header 2002_214_2057_n16_wv_c4.cwf 2002_214_2057_n16_wv_c4.txt cwexport: writing 'avhrr_ch4'
The first few lines of the resulting text file are as follows:
2,512,512 -127.777901,51.212974,13 -127.768008,51.212974,13.75 -127.758116,51.212974,13.75 -127.748224,51.212974,13.1 -127.738332,51.212974,13.1 -127.728439,51.212974,13 -127.718547,51.212974,8.95 -127.708655,51.212974,7.45 -127.698763,51.212974,7.45
The example below shows the export of AVHRR channel 2 data to an ArcGIS binary grid file from a CoastWatch IMGMAP file, verbose mode on. The binary grid data is written to a '.flt' file and the header data to a '.hdr' file.
phollema$ cwexport --verbose --format arc --match 'avhrr_ch2' --header 2002_214_2057_n16_wv_c2.cwf 2002_214_2057_n16_wv_c2.flt cwexport: writing 'avhrr_ch2'
The header file contents are as follows:
nrows 512 ncols 512 xllcorner -14208797.57 yllcorner 6088966.68 cellsize 1099.96 nodata_value 1.4E-45 byteorder MSBFIRST
A final example shows the export of SST and cloud data to a NetCDF dataset:
phollema$ cwexport -v --match '(sst|cloud)' 2010_040_1636_m02_wj.hdf 2010_040_1636_m02_wj.nc" cwexport: Creating output 2010_040_1636_m02_wj.nc cwexport: Writing cloud cwexport: Writing sst
A plain text dump of the file contents:
netcdf 2010_040_1636_m02_wj { dimensions: time = 1 ; level = 1 ; row = 1024 ; column = 1024 ; variables: int coord_ref ; coord_ref:grid_mapping_name = "mercator" ; coord_ref:longitude_of_projection_origin = 0. ; coord_ref:standard_parallel = 0. ; coord_ref:false_easting = 0. ; coord_ref:false_northing = 0. ; coord_ref:semi_major_axis = 6378137. ; coord_ref:inverse_flattening = 298.257223653 ; coord_ref:longitude_of_prime_meridian = 0. ; double x(column) ; x:standard_name = "projection_x_coordinate" ; x:units = "m" ; double y(row) ; y:standard_name = "projection_y_coordinate" ; y:units = "m" ; double lat(row, column) ; lat:standard_name = "latitude" ; lat:units = "degrees_north" ; double lon(row, column) ; lon:standard_name = "longitude" ; lon:units = "degrees_east" ; double time(time) ; time:standard_name = "time" ; time:units = "seconds since 1970-01-01 00:00:00 UTC" ; double level(level) ; level:standard_name = "height" ; level:units = "m" ; level:positive = "up" ; byte cloud(time, level, row, column) ; cloud:missing = 0b ; cloud:valid_range = 0, 255 ; cloud:coordinates = "lat lon" ; cloud:cell_methods = "area: mean" ; cloud:grid_mapping = "coord_ref" ; short sst(time, level, row, column) ; sst:scale_factor = 0.01 ; sst:add_offset = -0. ; sst:missing = -32768s ; sst:units = "celsius" ; sst:coordinates = "lat lon" ; sst:cell_methods = "area: mean" ; sst:grid_mapping = "coord_ref" ; sst:source = "nonlinear_split_window linear_triple_window_modified" ; // global attributes: :Conventions = "CF-1.4" ; :source = "METOP2_AVHRR " ; :institution = "USDOC/NOAA/NESDIS CoastWatch" ; :history = "[2010-03-13 09:46:43 IST cwf-3.2.4-pre-build169 phollema] cwexport -v --match (sst|cloud) 2010_040_1636_m02_wj.hdf 2010_040_1636_m02_wj.nc" ; }
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] argv)
Performs the main function.
|