Hi, I'm new to HDF5 so please excuse me if I'm making any amateur mistakes
here. I'm currently creating a dataset whose space is of rank 2 with the
first dimension calculated from a set of data and a fixed second dimension
of 3. Everything works great if I do not specify maximum dimensions
however, when I do, I get a number of errors. Below is an example of what
I'm doing (with irrelevant parts omitted):
hid_t hdf_file_id;
hdf_file_id = H5Fcreate("model.h5", H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
hsize_t dimensions[2], max_dimensions[2] = {H5S_UNLIMITED, 3};
// first dimension size calculated and stored in model_size, second
dimension fixed at 3
dimensions[0] = model_size;
dimensions[1] = 3;
dataspace_id = H5Screate_simple(2, dimensions, max_dimensions);
dataset_id = H5Dcreate(hdf_file_id, POINTS_DSET_NAME, H5T_IEEE_F32LE,
dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
points);
H5Sclose(dataspace_id);
H5Fclose(hdf_file_id);
Again, when there are no maximum dimensions specified, all works fine. With
the above code I get these errors:
HDF5-DIAG: Error detected in HDF5 (1.8.6) thread 0:
#000: H5D.c line 170 in H5Dcreate2(): unable to create dataset
major: Dataset
minor: Unable to initialize object
#001: H5Dint.c line 431 in H5D_create_named(): unable to create and link
to dataset
major: Dataset
minor: Unable to initialize object
#002: H5L.c line 1640 in H5L_link_object(): unable to create new link to
object
major: Links
minor: Unable to initialize object
#003: H5L.c line 1866 in H5L_create_real(): can't insert link
major: Symbol table
minor: Unable to insert object
#004: H5Gtraverse.c line 929 in H5G_traverse(): internal path traversal
failed
major: Symbol table
minor: Object not found
#005: H5Gtraverse.c line 718 in H5G_traverse_real(): traversal operator
failed
major: Symbol table
minor: Callback failed
#006: H5L.c line 1686 in H5L_link_cb(): unable to create object
major: Object header
minor: Unable to initialize object
#007: H5O.c line 3005 in H5O_obj_create(): unable to open object
major: Object header
minor: Can't open object
#008: H5Doh.c line 295 in H5O_dset_create(): unable to create dataset
major: Dataset
minor: Unable to initialize object
#009: H5Dint.c line 1035 in H5D_create(): unable to construct layout
information
major: Dataset
minor: Unable to initialize object
#010: H5Dcontig.c line 406 in H5D_contig_construct(): extendible
contiguous non-external dataset
major: Dataset
minor: Feature is unsupported
HDF5-DIAG: Error detected in HDF5 (1.8.6) thread 0:
#000: H5Dio.c line 228 in H5Dwrite(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type
Any help would be greatly appreciated.
Paul Coyle
···
--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Errors-when-creating-dataset-when-dataspace-has-a-max-dimension-of-H5S-UNLIMITED-tp2900828p2900828.html
Sent from the hdf-forum mailing list archive at Nabble.com.
Hi Paul,
In order to use unlimited (i.e. extensible) dimensions, the data set must be chunked. The default layout for data sets is contiguous. I believe this has to do with reserving space in the file. You also need to use a chunked layout for compression. Documentation for this can be found in the properties functions, H5Pset_layout and H5Pset_chunk. I'm pretty sure there are some examples included in the HDF5 source as well.
Paul Coyle wrote:
···
Hi, I'm new to HDF5 so please excuse me if I'm making any amateur mistakes
here. I'm currently creating a dataset whose space is of rank 2 with the
first dimension calculated from a set of data and a fixed second dimension
of 3. Everything works great if I do not specify maximum dimensions
however, when I do, I get a number of errors. Below is an example of what
I'm doing (with irrelevant parts omitted):
hid_t hdf_file_id;
hdf_file_id = H5Fcreate("model.h5", H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
hsize_t dimensions[2], max_dimensions[2] = {H5S_UNLIMITED, 3};
// first dimension size calculated and stored in model_size, second
dimension fixed at 3
dimensions[0] = model_size;
dimensions[1] = 3;
dataspace_id = H5Screate_simple(2, dimensions, max_dimensions);
dataset_id = H5Dcreate(hdf_file_id, POINTS_DSET_NAME, H5T_IEEE_F32LE,
dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
points);
H5Sclose(dataspace_id);
H5Fclose(hdf_file_id);
Again, when there are no maximum dimensions specified, all works fine. With
the above code I get these errors:
HDF5-DIAG: Error detected in HDF5 (1.8.6) thread 0:
#000: H5D.c line 170 in H5Dcreate2(): unable to create dataset
major: Dataset
minor: Unable to initialize object
#001: H5Dint.c line 431 in H5D_create_named(): unable to create and link
to dataset
major: Dataset
minor: Unable to initialize object
#002: H5L.c line 1640 in H5L_link_object(): unable to create new link to
object
major: Links
minor: Unable to initialize object
#003: H5L.c line 1866 in H5L_create_real(): can't insert link
major: Symbol table
minor: Unable to insert object
#004: H5Gtraverse.c line 929 in H5G_traverse(): internal path traversal
failed
major: Symbol table
minor: Object not found
#005: H5Gtraverse.c line 718 in H5G_traverse_real(): traversal operator
failed
major: Symbol table
minor: Callback failed
#006: H5L.c line 1686 in H5L_link_cb(): unable to create object
major: Object header
minor: Unable to initialize object
#007: H5O.c line 3005 in H5O_obj_create(): unable to open object
major: Object header
minor: Can't open object
#008: H5Doh.c line 295 in H5O_dset_create(): unable to create dataset
major: Dataset
minor: Unable to initialize object
#009: H5Dint.c line 1035 in H5D_create(): unable to construct layout
information
major: Dataset
minor: Unable to initialize object
#010: H5Dcontig.c line 406 in H5D_contig_construct(): extendible
contiguous non-external dataset
major: Dataset
minor: Feature is unsupported
HDF5-DIAG: Error detected in HDF5 (1.8.6) thread 0:
#000: H5Dio.c line 228 in H5Dwrite(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type
Any help would be greatly appreciated.
Paul Coyle
--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Errors-when-creating-dataset-when-dataspace-has-a-max-dimension-of-H5S-UNLIMITED-tp2900828p2900828.html
Sent from the hdf-forum mailing list archive at Nabble.com.
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org