public final class hdatt
extends java.lang.Object
The attribute tool reads and writes HDF file attributes.
hdatt - reads or writes HDF file attributes.
hdatt [OPTIONS] input
hdatt {-n, --name=STRING} [OPTIONS] input
hdatt {-n, --name=STRING} {-l, --value=STRING1[/STRING2/...]} [OPTIONS] input
-h, --help
-t, --type=TYPE
-V, --variable=STRING
--version
The attribute tool reads or writes HDF file attributes using the HDF Scientific Data Sets (SDS) interface. The two modes work as follows:
Note: The attribute tool is currently limited to reading and writing only the signed HDF data types. In read mode, unsigned HDF attribute data are read correctly, but the value displayed as if it were signed.
Type name | HDF type |
---|---|
string | DFNT_CHAR8 |
byte | DFNT_INT8 |
short | DFNT_INT16 |
int | DFNT_INT32 |
long | DFNT_INT64 |
float | DFNT_FLOAT32 |
double | DFNT_FLOAT64 |
0 on success, > 0 on failure. Possible causes of errors:
As an example of read mode, the following command reads and prints all the global attribute data from a CoastWatch HDF file:
phollema$ hdatt 2005_095_1522_n17_er.hdf satellite = noaa-17 sensor = avhrr origin = USDOC/NOAA/NESDIS CoastWatch cwhdf_version = 3.2 pass_type = day pass_date = 12878 start_time = 55371.0 projection_type = mapped projection = Mercator gctp_sys = 5 gctp_zone = 0 gctp_parm = 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 gctp_datum = 12 et_affine = 0.0 -1470.0 1470.0 0.0 -8804259.100925786 5723777.271647277 rows = 1401 cols = 1302 polygon_latitude = 45.83810150571052 45.83810150571052 45.83810150571052 45.83810150571052 45.83810150571052 42.51315402540104 38.99999999998719 35.30179546333813 31.424886223357582 31.424886223357582 31.424886223357582 31.424886223357582 31.424886223357582 35.30179546333813 38.99999999998719 42.51315402540104 45.83810150571052 polygon_longitude = -79.09000515710031 -74.79500257855015 -70.5 -66.20499742144985 -61.90999484289969 -61.90999484289969 -61.90999484289969 -61.90999484289969 -61.90999484289969 -66.20499742144985 -70.5 -74.79500257855015 -79.09000515710031 -79.09000515710031 -79.09000515710031 -79.09000515710031 -79.09000515710031 history = cwimport product.tshdf product.hdf
To dump only a single attribute:
phollema$ hdatt --name satellite 2005_095_1522_n17_er.hdf noaa-17
or a single attribute from a specific variable:
phollema$ hdatt --name units --variable avhrr_ch3a 2005_095_1522_n17_er.hdf albedo*100%
As an example of write mode, suppose that we wanted to save the date when the file was originally downloaded from the server:
phollema$ hdatt --name download_date --value "Mon Apr 11 18:20:15 PDT 2005" 2005_095_1522_n17_er.hdf
Now suppose we wanted to assign an integer quality value of 65% to the file based on some test that was performed on the file data:
phollema$ hdatt --name quality_value --value 65 --type int 2005_095_1522_n17_er.hdf
Finally, suppose that we wanted to change the units and scaling factor / offset of a variable, originally in degrees Celsius and scaled by 0.01, to degrees Fahrenheit:
phollema$ hdatt --name units --value "deg F" --variable sst 2005_095_1522_n17_er.hdf phollema$ hdatt --name scale_factor --value 0.018 --type double --variable sst 2005_095_1522_n17_er.hdf phollema$ hdatt --name add_offset --value -1777.777777 --type double --variable sst 2005_095_1522_n17_er.hdf
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] argv)
Performs the main function.
|