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

Home » Public Forums » archive » Appending data to a dataset in an HDF5 file
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: Appending data to a dataset in an HDF5 file [message #52400 is a reply to message #52356] Fri, 02 February 2007 07:54 Go to previous messageGo to previous message
eddie haskell is currently offline  eddie haskell
Messages: 29
Registered: September 1998
Junior Member
>> Since it seems that you need a full array, even when
>> appending a few bytes, ...

Not true. In your original code example you were trying to write a full
sized larger array into the dataset, and when I wrote my example I had
mixed the two options in my mind and ended up using a full dataset array
but only writing two elements. My bad.

By defining a new dataspace you can write only the data to any portion
of the dataset you need without wasting memory.

;; extend dataset by two elements
h5d_extend, d, 12
;; get updated matching dataspace
ds2 = h5d_get_space(d)
;; mark only needing to write to the last two elements
h5s_select_hyperslab, ds2, 10, 2, /reset

;; create data to write
data = [100b, 200b]
;; create dataspace for writing
ds3 = h5s_create_simple(2)
;; write only the new elements to the dataset
h5d_write, d, data, file_space=ds2, memory_space=ds3

Sorry for the confusion.

Cheers,
eddie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL job opportunities
Next Topic: image mapping

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

Current Time: Fri Oct 10 10:58:54 PDT 2025

Total time taken to generate the page: 0.08131 seconds