@@ -9,26 +9,30 @@ Ruby bindings for the HDF5 library.
99This gem currently provides practical high-level wrappers for:
1010
1111- opening and creating files
12- - creating groups
13- - creating, writing, and reading one-dimensional numeric datasets
14- - reading and writing numeric attributes
12+ - creating and traversing groups
13+ - multidimensional Numo numeric datasets and attributes
14+ - scalar, zero-length, and Null dataspaces
15+ - hyperslab reads and writes, block iteration, and chunk iteration
16+ - chunked storage, gzip, shuffle, Fletcher32, resize, and append
17+ - variable-length UTF-8 scalar and array datasets and attributes
18+ - h5py-compatible bool and complex datatypes
1519
1620Unsupported at this stage:
1721
18- - string dataset read/write
19- - multidimensional array write
20-
21- Integer datasets and integer attributes currently use native C ` int ` under the hood.
22- Values outside that range are rejected with ` HDF5::Error ` to avoid silent overflow.
22+ - fixed-length strings and explicit string encoding options
23+ - general compound, enum, reference, and variable-length numeric types
24+ - fancy indexing, boolean masks, negative slice steps, and general broadcasting
25+ - SWMR, MPI, and VDS creation
2326
2427` Group#list_datasets ` filters datasets from group entries by checking object type per entry.
2528For very large groups, this may be slower than ` Group#list_entries ` .
2629
27- ## Supported HDF5 Versions
30+ ## HDF5 Versions
2831
29- - HDF5 1.10
30- - HDF5 1.14
31- - HDF5 2.x
32+ The current implementation is tested with HDF5 1.10.10 on Linux. HDF5 1.14,
33+ macOS, and Windows are planned compatibility targets but are not verified by
34+ the current test environment. Unknown major versions are not treated as
35+ compatible automatically.
3236
3337HDF5 versions older than 1.10 are not supported.
3438
@@ -71,11 +75,10 @@ export HDF5_LIB_PATH=/usr/lib/libhdf5.so
7175require ' hdf5'
7276
7377HDF5 ::File .open (' example.h5' ) do |file |
74- group = file[' foo' ]
75- dataset = group[' bar_int' ]
76- p dataset.shape
77- p dataset.dtype
78- p dataset.read
78+ dataset = file[' foo/bar_int' ]
79+ p dataset.shape
80+ p dataset.dtype.to_sym
81+ p dataset.read
7982end
8083```
8184
8588require ' hdf5'
8689
8790HDF5 ::File .create(' numbers.h5' ) do |file |
88- file.create_group(' values' ) do |group |
89- group.create_dataset(' ints' , [1 , 2 , 3 , 4 ])
90- end
91+ matrix = Numo ::SFloat .new (100 , 64 ).seq
92+ dataset = file.require_group(' measurements' ).create_dataset(
93+ ' signal' ,
94+ matrix,
95+ chunks: :auto ,
96+ compression: :gzip
97+ )
98+ dataset.attrs[' unit' ] = ' a.u.'
99+ dataset[0 ...10 , true ] = Numo ::SFloat .zeros(10 , 64 )
91100end
92101
93102reopened = HDF5 ::File .open (' numbers.h5' )
@@ -101,9 +110,9 @@ High-level API failures raise `HDF5::Error`.
101110
102111``` ruby
103112begin
104- HDF5 ::File .open (' missing.h5' )
113+ HDF5 ::File .open (' missing.h5' )
105114rescue HDF5 ::Error => e
106- warn e.message
115+ warn e.message
107116end
108117```
109118
0 commit comments