My colleague has been trying to write an IDL procedure to write an HDF
file with a set of global attributes and 4 SD datasets. It appears to
write the file ok, but when trying to read it back in, it doesn't appear
to have the attributes. Also, the file seems to be much bigger than it
should be (nearly 4MB instead of about 1MB) Can anyone help?
Creating file goes like this:
file_id=HDF_OPEN(hdfile_name, /ALL)
sd_id=HDF_SD_START(hdfile_name, /RDWR)
sds_id_0=HDF_SD_CREATE(sd_id, count_string+'_0', [512,512], /FLOAT)
sds_id_1=HDF_SD_CREATE(sd_id, count_string+'_1', [512,512], /FLOAT)
sds_id_2=HDF_SD_CREATE(sd_id, count_string+'_2', [512,512], /INT)
sds_id_3=HDF_SD_CREATE(sd_id, count_string+'_3', [512,512], /FLOAT)
HDF_SD_ATTRSET, sd_id, 'AcTime', acquisition_time
HDF_SD_ATTRSET, sd_id, 'View', view
HDF_SD_ADDDATA, sds_id_0, latitude_grid
HDF_SD_ADDDATA, sds_id_1, longitude_grid
HDF_SD_ADDDATA, sds_id_2, con_word
HDF_SD_ADDDATA, sds_id_3, plot_param
AcTime_attr=HDF_SD_ATTRFIND(sd_id, 'AcTime')
HDF_SD_ATTRINFO, sd_id, AcTime_attr
HDF_SD_FILEINFO, sd_id, datasets, attributes
HDF_SD_END, sd_id
Reading the file back goes like this:
file_id=HDF_OPEN('tout', /READ)
sd_id=HDF_SD_START('tout', /READ)
HDF_SD_FILEINFO, sd_id, datasets, attributes
help, datasets, attributes
AcTime_attr=HDF_SD_ATTRFIND(sd_id, 'AcTime')
HDF_SD_ATTRINFO, sd_id, AcTime_attr, data=acquistion_time
And it falls over at the HDF_SD_ATTRFIND line.
Any ideas anyone?
Thanks, Anne.
|