;+NAME/ONE LINE DESCRIPTION OF ROUTINE: ; WR_SDS replaces data in a given sds. ; ; wr_sds.pro will take as input the name of a dataset and the name of an sds ; FUNCTION wr_sds, file, sdsname, data, start=start, count=count ; ; return - array from sds ; file - hdf file name ; sdsname - sds name ; if (n_elements(start) eq 0) then start=-1 if (n_elements(count) eq 0) then count=-1 ; ; open the sds ; sz = size(file) if (sz(1) ne 3) then begin sd_id = HDF_SD_START( file, /RDWR ) endif else begin sd_id = file endelse ; ; get the sd index for the name ; index = HDF_SD_NAMETOINDEX( sd_id, sdsname ) if (index eq -1) then begin if (sz(1) ne 3) then $ HDF_SD_END, sd_id return,-1 endif ; ; get the dataset id ; sds_id = HDF_SD_SELECT( sd_id, index ) ; ; read the data ; if (start(0) ne -1 and count(0) ne -1) then $ HDF_SD_ADDDATA, sds_id, data, start=start, count=count $ else $ HDF_SD_ADDDATA, sds_id, data ; ; close the dataset ; HDF_SD_ENDACCESS, sds_id if (sz(1) ne 3) then $ HDF_SD_END, sd_id ; RETURN, 1 END