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

Home » Public Forums » archive » IDL HDF5 compound type and dataspace
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL HDF5 compound type and dataspace [message #46833] Fri, 30 December 2005 14:12
zuzucat@gmail.com is currently offline  zuzucat@gmail.com
Messages: 4
Registered: April 2005
Junior Member
I am trying to emulate HDF5 table functions in IDL. I thought it would
be feasible to just follow the lines in hl/src/H5TA.c from HDF5 source
code, since tables are high level functions in HDF5. But, I'm getting
a segfault at H5D_Write line below. I wonder if anybody has an insight
on my problem.
best,

Nobuki Matsui

------------------------------------------------------------ ------------------------------------------------------------ -
FUNCTION H5TBmake_table, table_title, loc_id, dsetname, nrecords,
chunksize, data
print, "Table Title ", table_title
print, "N of Records", nrecords


; bail out if no proper args
if (n_elements(table_title) eq 0 || n_elements(loc_id) eq 0 ||
n_elements(nrecords) eq 0 || n_elements(nrecords) eq 0 ||
n_elements(dsetname) eq 0) then return, -1


datatype_id = H5T_IDL_CREATE(data) ; create a datatype object
; I was doing this manually with 20 lines of the code for a while.


sid = H5S_Create_Simple(nrecords,max_dimensions=-1) ; create a
simple dataspace
did = H5D_Create(loc_id, dsetname, datatype_id, sid,
chunk_dimensions=chunksize)
H5D_Extend,did,size(data,/dimensions)


print, "writing data"
H5D_Write, did, data
print, "Closing Dataspace"
H5S_Close, sid
H5D_Close, did
print, "All done"
END


PRO TEST_H5TBmake_table
file = 'hdf5_test_table.h5'
fid = H5F_CREATE(file)
nrecords = 100
chunk_size = 20


cat = REPLICATE({cat, name:'', Weight:0.0, Sex:"", Color:""
},nrecords) ; create an array of structures


;test = h5tbmake_table( "Cat", fid, 'Cat Stats', nrecords+1,
chunk_size, cat)
test = h5tbmake_table( "Cat", fid, 'Cat Stats', nrecords,
chunk_size, cat)


H5F_Close,fid
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Looking for Eyeballs
Next Topic: subset an image programatically

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

Current Time: Fri Oct 10 10:28:30 PDT 2025

Total time taken to generate the page: 0.72121 seconds