Previous Using IDL: Importing and Writing Data into Variables Next

Using Macros to Import HDF Files

To import a Hierarchical Data Format (HDF), HDF-EOS, or NETCDF file into IDL, complete the following steps:

  1. Select the Import HDF File toolbar button. The Select a valid HDF, NETCDF or HDF-EOS file dialog is displayed.

  3. Select a file to import. Click Open.

  5. See "Using the HDF Browser Interface" under "HDF_BROWSER" for instructions on how to use the dialog.

After selecting to import data and clicking OK, HDF, NETCDF, or HDF-EOS files read with the Import HDF macro are stored in structure variables which are named filename_DF where filename is the name of the file you opened without the extension.

IDL variables must begin with a letter, and may contain only letters, digits, the underscore character, or the dollar sign. If the first character of filename is not a letter, the prefix "var" is added to the variable name. Any spaces within filename are converted to underscores. Any illegal characters within filename are removed.

The variable is a structure with each data or metadata name being an element of the structure. You can specify which part of the structure variable you want to access by using the following syntax:


For example, if you imported two data elements out of a file named hydrogen.hdf and you named the elements IMAGE1 and IMAGE2, you could access each individual data element using the following:


If you wanted to view IMAGE1, you would enter:


For more information on IDL support of HDF and other scientific data formats, see the Scientific Data Formats manual.

For information on importing HDF5 files using the HDF5 Browser dialog, see H5_BROWSER

  IDL Online Help (June 16, 2005)