Uncompressing HDF-EOS Data with the hrepack Tool

The hrepack tool is a command line tool from The HDF Group that copies an input HDF4 file to an output HDF4 file reproducing all the high level objects and optionally rewriting the objects with compression/uncompression and/or chunking. Many Hierarchical Data Format (HDF) files stored at the NSIDC DAAC are internally compressed using hrepack. This includes the MODIS Version 5 (V005) snow and sea ice data products stored on the Data Pool and distributed through subscriptions. This compression should be transparent to all user applications that read data from HDF files using HDF library calls since the HDF library performs uncompression automatically when reading compressed data. However, in some cases it is necessary to generate uncompressed HDF files either because a user-written program reads data from an HDF file directly or because the overhead involved in uncompressing the data on-the-fly is deemed too high for the particular application. Note that both IDL and ENVI appear to handle internally compressed HDF files properly. Please visit the The HDF Group hrepack Web site for documentation pertaining to the hrepack tool.

UNIX/Linux Users

Download HDF Libraries from The HDF Group Web Site

HDF libraries are required to run hrepack on UNIX/Linux platforms. The following instructions assume you are using either sh, csh, or tcsh on a UNIX/Linux system.

  1. Go to the szip compression external libraries pre-compiled binaries at:
  2. Follow the link to the directory for your operating system and download the corresponding "noenc" file to your home directory. 
    Example: szip2.0-linux-noenc.tar.gz
  3. Gunzip the file you downloaded using the following command:
    gunzip szip2.0-linux-noenc.tar.gz
  4. Untar the resulting tar file using the following command:
    tar xvf szip2.0-linux-noenc.tar

Note: This creates the directory szip2.0-linux-noenc in your home directory. 

Check to see if you have the environment variable LD_LIBRARY_PATH defined by typing: 

Choose one of the following steps:

  1. If the environment variable LD_LIBRARY_PATH is defined, add the szip library directory to your existing LD_LIBRARY_PATH environment variable by typing:
    setenv LD_LIBRARY_PATH LD_LIBRARY_PATH\:$HOME/szip2.0-linux-noenc/lib

  2. If the environment variable LD_LIBRARY_PATH is not defined, the following message displays on your screen: LD_LIBRARY_PATH:Undefined variable, set theLD_LIBRARY_PATH environment variable to the szip library directory by typing:
    setenv LD_LIBRARY_PATH $HOME/szip2.0-linux-noenc/lib

Download hrepack from The HDF Group Web Site

  1. Go to ftp://ftp.hdfgroup.org/HDF/HDF_Current/bin/.

  2. Select the appropriate directory for your platform.

  3. Follow the link to the utilities directory.

  4. Download hrepack to your local drive using an ftp application.

  5. Type the following command:
    chmod 775 hrepack

    Note: This ensures that the owner of the file and the group of the file have read, write, and execute permissions for running hrepack.
Windows NT/98/2000/XP Users

Download hrepack from The HDF Group Web Site

  1. Go to: ftp://ftp.hdfgroup.org/HDF/HDF_Current/bin/windows/utilities.
  2. Download the hrepack file to your local drive.
  3. For Windows XP users, you must download three library files, zlib1.dll, szlibdll.dll, and szlibdll.lib, to the same directory where you downloaded the hrepack file.
    Download zlib1.dll
    Download szlibdll.dll and szlibdll.lib 
  4. Choose one of the following steps to open a Windows DOS command prompt window:
    1. On your PC, select Start --> Run --> type the word Command in the dialog box.
    2. On your PC, select Start --> All Programs --> Accessories --> Command prompt.
  5. Change directories in the command prompt window until you are in the directory with the hrepack executable. Be sure the HDF file is also in the same directory.

Use the following csh commands for UNIX to replace a compressed Version 5 MOD10A1 snow cover HDF file with an uncompressed version of the same file having the same name as the original file:

set file = MOD10A1.A2003138.h03v06.005.2003143062148.hdf
hrepack -i $file -o $file.unpack -t '*:NONE'
if ( -e $file.unpack && "$status" == "0" ) mv $file.unpack $file