HDF-EOS2 Dumper

The HDF-EOS2 Dumper is a command-line program that dumps information of HDF-EOS2 file. It is mainly used for dumping latitude and longitude values of different grids and swaths. It can also dump the number of grids and swaths as well as their respective name. The main advantage of this program is that it can generate actual lat and lon values when different projections, like SNSOID and SOM, and swath dimension maps are used. (Download)

The HDF-EOS2 library uses the U.S. Geological Survey General Cartographic Transformation Package (GCTP) to define and subset grid structures. Thus, HDF-EOS2 data files that are created by the HDF-EOS2 library have one of the following GCTP projections:

The above list contains the most common projections used in HDF-EOS2 data. Please see 6.5.1 GCTP Projection Codes in [1] for the complete list of projections.

1. Installation

This program requires five libraries:

Makefile template is provided to generate binary named eos2dump. Users need to set paths to those libraries above in the Makefile template at the corresponding places.

Figure 1 Set library path in Makefile
ZLIB_DIR=/mnt/scr1/xcao/hdf_java/lib/linux32/zlib
SZIP_DIR=/mnt/scr1/xcao/hdf_java/lib/linux32/szip
JPEG_DIR=/mnt/hdf/n-gupta/eos2dump/jpeg6b-linux2.4
HDF4_DIR=/mnt/hdf/n-gupta/eos2dump/hdf-4.2.5
HDFEOS2_DIR=/mnt/hdf/n-gupta/eos2dump/hdfeos/hdfeos2
With Makefile, one can build this program by issuing make command. The generated binary is named eos2dump. This software has an old version which was built by configure script. Since configure script might have installation problem in some users' machine, we provide the Makefile template for the new version.

2. How to use

This program takes several command-line arguments: options, filename and grid or swath name. It reads the input file and dumps all the latitude and/or longitude values for the specified grid/swath name. If there is only one grid or swath available, you don't need to specify its name. The program will use that name by default and dumps the corresponding lat and lon values. It will generate error message and terminate the program if no grid or swath name specified if more than one available.

When the desired grid contains SOM projection, you need to specify the block dimension number you want to dump as an additional argument after the grid name argument. The dimension number should be between 1 and 180. If you want to dump lat/lon for all block dimensions, specify all option after the grid name. When only one grid exists, you don't need to specify the grid name, but you are also required to give the block dimension number you want to dump.

In the shell, the command of using HDF-EOS2 Dumper is as following:

Figure 2 Command of HDF-EOS2 Dumper
$ ./eos2dump [OPTION]... [HDF-EOS2 FILE NAME]... [GRID or SWATH NAME]... [SOM BLOCK DIMENSION]

The names and functionalities of all the supported options are listed below.

There are three other options -d, -r, -n. They are not fully tested for all the example files. So their functions are not listed here. Users can find the detailed information for those three options in the Readme.txt file.

3. Examples

To show the illustration, we use several examples to show how to use this program to dump lat and lon values for HDF-EOS2 files.

3.1. Example 1

The first example is to dump latitude values of a swath object called L2_Standard_cloud-cleared_radiance_product in an HDF-EOS2 file AIRS.2002.12.31.001.L2.CC_H.v4.0.21.0.G06100185050.hdf. This file doesn't contain swath dimension map. The latitude is 45-by-30 array, and its type is 64-bit floating-point.

In the shell, one can issue the following command:

Figure 3 Command of HDF-EOS2 Dumper
$ ./eos2dump -c1mAIRS.2002.12.31.001.L2.CC_H.v4.0.21.0.G06100185050.hdf
The -c option tells the dumper to calculate latitude and longitude values. The -1 option determines if lat and/or lon should be printed on the screen. Here we only want dump lat data. The option -m specifies how many data are allowed to be shown per line. The second argument specifies the name of the HDF-EOS2 file. The third argument is omitted, since there is only one swath L2_Standard_cloud-cleared_radiance_product in this file. The program will use it as the default swath name and dump the corresponding lat data.

The output of this program is shown below:

Figure 4 Result by HDF-EOS2 Dumper
-71.0091, -70.9504, -70.8625, -70.7595, -70.6461,
-70.5277, -70.4059, -70.2819,-70.156, -70.0277,
-69.8982, -69.7672, -69.6335, -69.4951, -69.3532,
-69.2063, -69.0534, -68.8931, -68.7232, -68.5445,
-68.3521, -68.1443, -67.9179, -67.6685, -67.3907,
-67.0772, -66.7182, -66.2973, -65.8015, -65.1923,
...
There are five latitude data printed on each line. Since this data file contains data field Latitude, the dumper just reads the lat data from that field and prints them on the screen.

3.2. Example 2

The second example is to dump latitude values of a grid object called BlueBand in an HDF-EOS2 file MISR_AM1_GRP_ELLIPSOID_GM_P117_O058421_BA_F03_0024.hdf. This file contains SOM projection. Therefore, we need to specify the block dimension we want to dump. Here we choose the 20th dimension to dump. The latitude is 128-by-512 array.

In the shell, one can issue the following command:

Figure 5 Command of HDF-EOS2 Dumper
$ ./eos2dump -vcm1MISR_AM1_GRP_ELLIPSOID_GM_P117_O058421_BA_F03_0024.hdf BlueBand 20
The -v option tells the dumper to add explanatory information to the latitude data, like grid name and file name. The third argument specifies the name of grid whose latitude you want to print on the screen. It will generate error message and stop the program if you don't specify this argument since it contains more than one grid. The fourth argument specifies which block dimension you want to dump. Here we choose the 20th dimension. If you don't specify it, the program will also generate an error message and stop.

The output of this program is shown below:

Figure 6 Result by the HDF-EOS2 Dumper
HDF-EOS2 file MISR_AM1_GRP_ELLIPSOID_GM_P117_O058421_BA_F03_0024.hdf {

GRID: BlueBand{
84.2115,84.2018, 84.192,84.1822,84.1724,
84.1626,84.1528,84.1431,84.1333,84.1235,
84.1137,84.1039,84.0941,84.0844,84.0746,
84.0648, 84.055,84.0452,84.0354,84.0256,
84.0158,84.0061,83.9963,83.9865,83.9767,
...
}

}

If you want to dump latitude for all block dimensions, specify all option after the desired grid name. The command is:

Figure 7 Command of HDF-EOS2 Dumper
$ ./eos2dump -vcm1MISR_AM1_GRP_ELLIPSOID_GM_P117_O058421_BA_F03_0024.hdf BlueBand all

The output of this program is shown below:

Figure 8 Result by the HDF-EOS2 Dumper
HDF-EOS2 file MISR_AM1_GRP_ELLIPSOID_GM_P117_O058421_BA_F03_0024.hdf {

GRID: BlueBand{
66.2263, 66.224,66.2217,66.2195,66.2172,
66.2149,66.2126,66.2103,66.2079,66.2056,
66.2033, 66.201,66.1987,66.1963, 66.194,
66.1917,66.1893, 66.187,66.1846,66.1823,
66.1799,66.1776,66.1752,66.1729,66.1705,
...
}

}

You can also check the projection information by using -o option. Type the following command:

Figure 9 Command to check the projection information
$ ./eos2dump -oMISR_AM1_GRP_ELLIPSOID_GM_P117_O058421_BA_F03_0024.hdf

The output of this command is shown below:

Figure 10 Result by the HDF-EOS2 Dumper
File Size: 208300609
Number of grids: 6
Number of swaths: 0
Number of points: 0
Grid: BlueBand
projection: SOM
griddataclash:
Grid: GreenBand
projection: SOM
griddataclash:
Grid: RedBand
projection: SOM
griddataclash:
Grid: NIRBand
projection: SOM
griddataclash:
Grid: BRF Conversion Factors
projection: SOM
griddataclash:
Grid: GeometricParameters
projection: SOM
griddataclash:

3.3. Example 3

The third example is to dump latitude values of a swath object containing dimension maps called MODIS_SWATH_Type_L1B in an HDF-EOS2 file MYD02HKM.A2010031.0035.005.2010031183706.hdf. This file contains two swath dimension maps. The latitude is a 4060-by-2708 array.

In the shell, if you want to print the unadjusted latitude, issue the following command:

Figure 11 Command of HDF-EOS2 Dumper
$ ./eos2dump -c1mMYD02HKM.A2010031.0035.005.2010031183706.hdf

The output of this program is shown below:

Figure 12 Result by HDF-EOS2 Dumper
-61.0802, -61.1096, -61.1387, -61.1675,-61.196,
-61.2243, -61.2524, -61.2801, -61.3077,-61.335,
-61.3621, -61.3889, -61.4155, -61.4418,-61.468,
-61.4939, -61.5196, -61.5451, -61.5704, -61.5955,
-61.6203,-61.645, -61.6695, -61.6937, -61.7178,
...
This data file contains data field Latitude and its type is 32-bit floating-point. The dumper just reads the lat data from that field and prints them on the screen.

If you want to print the adjusted latitude after using swath dimension map, type the following command:

Figure 13 Command of HDF-EOS2 Dumper
$ ./eos2dump -a1mMYD02HKM.A2010031.0035.005.2010031183706.hdf

The output of this program is shown below:

Figure 14 Result by HDF-EOS2 Dumper
-61.0802, -61.0949, -61.1096, -61.1241, -61.1387,
-61.1531, -61.1675, -61.1818,-61.196, -61.2102,
-61.2243, -61.2383, -61.2524, -61.2663, -61.2801,
-61.2939, -61.3077, -61.3213,-61.335, -61.3485,
-61.3621, -61.3755, -61.3889, -61.4022, -61.4155,
...
This is the actual latitude data which has the same dimension size as the field data. It's calculated by HDF-EOS2 Dumper internally.

3.4. Example 4

Dump the longitudinal geolocation coordinates of HDF file AMSR_E_L3_5DaySnow_V09_20050126.hdf for the Northern Hemisphere LAMAZ grid. The file contains grids in Lambert Azimuthal projection (GCTP_LAMAZ) for both the Northern and Southern hemispheres.

Figure 15 Command of HDF-EOS2 Dumper
$ ./eos2dump -c2AMSR_E_L3_5DaySnow_V09_20050126.hdf "Northern Hemisphere"
Note: EOS Dumper -m option produces short lines at the ends of grid rows which are not modulo-5 values in length. This is acceptable for IDL, but MATLAB cannot tolerate the irregular length lines. When using geolocation coordinate files in MATLAB, use only -a1, -a2, -c1, -c2 options. Do not use the -m option to produce geolocation coordinate files for use in MATLAB.

The output of this program is shown below:

Figure 16 Result of HDF-EOS2 Dumper -c2
-135,
-135,
-135.16,
-135.24,
-135.32,
-135.401,
...

4. Limitation

1. The program can't handle HDF-EOS2 file which contains 'DEFAULT' values for UpperLeft and LowerRight points. The example file is CER_ES4_TRMM-PFM_Edition1_009001.199808.hdf.

2. For LAMAZ projection, the previous version of the EOS2 Dumper produced erroneous output lat and lon values ("1e+51") near the corners of the grid. This was due to a bug in the GCTP library. The current version checks for undefined values and returns the nearest-neighbor value within the valid range.

3. The program can't handle HDF-EOS2 file MISR_AM1_CGAS_MAR_01_2006_SITE_INTEXB_F06_0021.hdf. It has problem when calling "GDij2ll" function. The problem might come from the HDF-EOS2 library.

4. If the HDF-EOS2 file contains swath dimension map, using option -c will read unadjusted lat and lon that the date file provides. If you want to read adjusted lat and lon, option -a should be used instead. When the unadjusted lat and lon data contains fill value, the adjusted lat and lon will also contain fill value.

5. Now the number of output data per line could be chosen as one or five for use in other softwares, like MATLAB and IDL, further options should be added to let users specify their own number of output data per line.

6. When the swath dimension maps are used, the adjusted lat and lon values may fall out of valid range due to their closeness to the boundary lat/lon data provided in the date file. Here we make those invalid values equal to the boundary points. Special cautions are needed when handling swath dimension map file.

5. Download

Download the HDF-EOS2 Dumper.

Reference


Last modified: 10/07/2011
About Us | Contact Info | Archive Info | Disclaimer
Sponsored by NASA Cooperative Agreement Grant Number NNX08AO77A / Maintained by The HDF Group