comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Writing SD HDF files in IDL - prob with attributes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Writing SD HDF files in IDL - prob with attributes [message #8457] Mon, 17 March 1997 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Anne I. Morrison wrote:
> 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?

I've modified your code a bit and attached it below. It runs just fine
on
SGI and IBM Unix boxes, and on Windows NT. I get a file size of 3690165
bytes.
If you add up the sizes of your arrays (in bytes), you get

print, 4*512L*512L*3 + 2*512L*512L
3670016

So I think 4 MB is the right size. Make sure you have the latest version
of IDL
(4.01) as I recall 4.0 had some HDF bugs.

Cheers,
Liam.

----
pro hdf

;* dummy values for arrays/variables
acquisition_time = 12.0
view = 1.0
latitude_grid = fltarr( 512, 512 )
longitude_grid = fltarr( 512, 512 )
con_word = intarr( 512, 512 )
plot_param = fltarr( 512, 512 )
count_string = 'Count'

;* This line was not doing anything useful
;* Should use *only* the HDF_SD routines.
;* file_id=HDF_OPEN('tout', /ALL)

sd_id=HDF_SD_START('tout', /CREATE)

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

;* make sure all the SDS are updated
hdf_sd_endaccess, sds_id_0
hdf_sd_endaccess, sds_id_1
hdf_sd_endaccess, sds_id_2
hdf_sd_endaccess, sds_id_3

HDF_SD_END, sd_id

;* This line was not doing anything useful
;* 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

;* close the file when we're finished
hdf_sd_end, sd_id

end
[Message index]
 
Read Message
Previous Topic: "center-of-gravity" function (2D dist)
Next Topic: ERROR: Unsupported X Windows visual

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:35:27 PDT 2025

Total time taken to generate the page: 0.00367 seconds