;+ ; NAME: ; HDFeditSDS ; ; PURPOSE: ; Replaces and HDF's SDS with new data ; ; AUTHOR: ; Alex Fraser ; ; CATEGORY: ; HDF Utility ; ; ; CALLING SEQUENCE: ; see example ; ; ; INPUTS: ; filename: filename (including path) of the HDF file ; sdsname: string containing name of the SDS you want to modify ; newdata: a variable containing the new data you want to write to the HDF SDS ; ; KEYWORDS: ; none ; ; ; OUTPUTS: ; Edits an HDF file with new data in the specified SDS ; ; ; RESTRICTIONS: ; No error checking ; ; ; EXAMPLE: ; this code replaces test.hdf's Longitude SDS with the data contained in the variable named newdata ; HDFeditSDS('c:\test.hdf', 'Longitude', newdata) ; ; ; MODIFICATION HISTORY: ; ; Written by Alex Fraser, 2007. ;- PRO HDFeditSDS, filename, sdsname, newdata sdfileid=hdf_sd_start(filename, /rdwr) ; 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_AddData, thisSdsID, newdata hdf_sd_end, sdfileid END