;+ ; NAME: ; HDFreturnSDS.pro ; ; ; PURPOSE: ; Given a .hdf filename and an SDS name within that file, will return that SDS ; ; ; AUTHOR: ; Alex Fraser ; ; ; CATEGORY: ; HDF utility ; ; ; CALLING SEQUENCE: ; see example ; ; ; INPUTS: ; filename: a string leading to the hdf file (including path). ; sdsname: a string representing the name of the SDS within the HDF file. To find out which SDSs exist, ; use the free HDF Explorer (http://www.space-research.org/explorer.htm), or use another of my routines, HDFAttribs.pro ; ; KEYWORDS: ; none ; ; ; OUTPUTS: ; returns the requested SDS ; ; ; RESTRICTIONS: ; no error handling included. This program is designed to be a lightweight HDF file reader, ; and any other programs which use this can do the error checking. ; ; ; EXAMPLE: ; the below example would return the 'Cloud_Mask' SDS from within the hdf file c:\test.hdf ; dataset = HDFreturnSDS('c:\test.hdf', 'Cloud_Mask') ; ; ; MODIFICATION HISTORY: ; ; Written by Alex Fraser, 2007. ;- FUNCTION HDFreturnSDS, filename, sdsname sdfileid=hdf_sd_start(filename, /read) ; Find the index of the "Gridded Data" SDS. index = HDF_SD_NAMETOINDEX(sdFileID, sdsname) ; Select the Gridded Data SDS. thisSdsID = HDF_SD_SELECT(sdFileID, index) HDF_SD_GETDATA, thisSdsID, sds hdf_sd_end, sdfileid return, sds END