pub fn create_hdf5_with_structure<P, F>(path: P, builder: F) -> Result<()>Expand description
Create an HDF5 file with groups and attributes
§Arguments
path- Path to the HDF5 filebuilder- Function to build the file structure
§Example
use scirs2_io::hdf5::{create_hdf5_with_structure, AttributeValue};
use scirs2_core::ndarray::array;
create_hdf5_with_structure("structured.h5", |file| {
let root = file.root_mut();
// Create groups
let experiment = root.create_group("experiment");
experiment.set_attribute("date", AttributeValue::String("2024-01-01".to_string()));
experiment.set_attribute("temperature", AttributeValue::Float(25.0));
// Add datasets
let data = array![[1.0, 2.0], [3.0, 4.0]];
file.create_dataset_from_array("experiment/measurements", &data, None)?;
Ok(())
})?;