For example, say you've downloaded a sample MODIS Airborne Simulator HDF file from the SHARP page. Then in IDL you could interactively select an SDS like this:
IDL> sds_read, 'MAS_960426_08.hdf', latitude
You'll see a dialog that looks like:
Every SDS found in the HDF file is listed. Then you scroll down to the SDS named 'Latitude' and click on it. Now a data selection dialog appears:
You edit the 'Number of value' fields to read 716x716 points, and click on 'Done'. Now the data is an array in memory, e.g.
IDL> help, latitude
LATITUDE FLOAT
= Array[716, 716]
In addition, a non-interactive mode is available which is suitable for embedding in IDL programs, e.g.
sds_read, file, latitude, sds='PixelLatitude', /read_all
help, latitude
LATITUDE FLOAT
= Array[716, 8765]
Notes:
SDS_READ is compatible with IDL 4 and IDL 5.
Where to get it:
Please download sds_read.pro, give it a whirl, and let me know what you think. You will also need the support procedures cw_getfields.pro (written by me) and xlist.pro (from the JHU APL library).