h5py

Version:

3.9.0

Category:

data

Cluster:

Vali

Author / Distributor

https://www.h5py.org/

Description

HDF5 for Python (h5py) is a general-purpose Python interface to the Hierarchical Data Format library, version 5. HDF5 is a versatile, mature scientific software library designed for the fast, flexible storage of enormous amounts of data.

Documentation

$ python -m h5py --help

usage: python -m h5py [-h] {run_tests} ...

optional arguments:
  -h, --help     show this help message and exit

Available commands:
  run_tests      Run unit tests

Example test run:
  python -m h5py.run_tests

Official documentation:
  https://docs.h5py.org/en/stable/

Examples/Usage

  • Load the h5py module:

    $ module load data/h5py/3.9.0-foss-2023a
    
  • Unload the module:

    $ module unload data/h5py/3.9.0-foss-2023a
    
  • Example usage in Python:

    import h5py
    import numpy as np
    
    # Create and write to a file
    with h5py.File("example.h5", "w") as f:
        dset = f.create_dataset("my_data", (100,), dtype='i')
        dset[...] = np.arange(100)
    
    # Read from a file
    with h5py.File("example.h5", "r") as f:
        data = f["my_data"][:]
        print(data)
    

Installation

Source code is obtained from h5py GitHub