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

Home » Public Forums » archive » Reopen HDF5 file to add more data?
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: Reopen HDF5 file to add more data? [message #90195 is a reply to message #90187] Tue, 10 February 2015 00:17 Go to previous messageGo to previous message
markb77 is currently offline  markb77
Messages: 217
Registered: July 2006
Senior Member
On Monday, February 9, 2015 at 5:25:56 PM UTC+1, David Grier wrote:
> Dear Folks,
>
> It appears not to be possible to add more data to an HDF5 file once
> the file has been closed, at least not in the IDL implementation.
> Is that correct?
>
> Here's a minimal example of what I'm trying to do. This triggers
> the error that inspires my question.
>
> Is there a way to reopen an file for writing, or do I have to read in the
> old archive and recopy everything to a new archive?
>
> Many thanks,
>
> David
>
> ;--- cut here for minimal example ---
> filename = 'testfile.h5'
> group = 'group'
> name = 'testdata'
>
> ;;; Create and close an HDF5 archive with one group and no data
> fid = h5f_create(filename)
> gid = h5g_create(fid, group)
> h5g_close, gid
> h5f_close, fid
>
> ;;; Reopen the HDF5 archive to add some data to the group
> fid = h5f_open(filename)
> gid = h5g_open(fid, group)
>
> ;;; attempt to write some data
> a = bindgen(640, 480)
> tid = h5t_idl_create(a)
> sid = h5s_create_simple(a.dim)
> did = h5d_create(gid, name, tid, sid) ;;; <-- this fails
> h5d_write, did, a
>
> ;;; close the file
> h5d_close, did
> h5s_close, sid
> h5t_close, tid
> h5g_close, gid
> h5f_close, fid


hi David,

You need to use H5D_EXTEND to increase the size of your dataset before you can append additional data.

best
Mark
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Hard crash
Next Topic: image function question

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

Current Time: Fri Oct 10 07:16:30 PDT 2025

Total time taken to generate the page: 1.68665 seconds