PyMPDATA_MPI.hdf_storage

 1# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring,invalid-name,too-many-locals
 2
 3from pathlib import Path
 4
 5import h5py
 6
 7
 8class HDFStorage:
 9    @staticmethod
10    def create_dataset(*, name: str, path: Path, grid: tuple, steps: tuple):
11        with h5py.File(path, "w") as file:
12            file.create_dataset(
13                name,
14                (*grid, len(steps)),
15                dtype="float64",
16            )
17
18    @staticmethod
19    def mpi_context(path, mode, comm):
20        return h5py.File(path, mode, driver="mpio", comm=comm)
21
22    @staticmethod
23    def non_mpi_contex(path, mode):
24        return h5py.File(path, mode)
class HDFStorage:
 9class HDFStorage:
10    @staticmethod
11    def create_dataset(*, name: str, path: Path, grid: tuple, steps: tuple):
12        with h5py.File(path, "w") as file:
13            file.create_dataset(
14                name,
15                (*grid, len(steps)),
16                dtype="float64",
17            )
18
19    @staticmethod
20    def mpi_context(path, mode, comm):
21        return h5py.File(path, mode, driver="mpio", comm=comm)
22
23    @staticmethod
24    def non_mpi_contex(path, mode):
25        return h5py.File(path, mode)
@staticmethod
def create_dataset(*, name: str, path: pathlib.Path, grid: tuple, steps: tuple):
10    @staticmethod
11    def create_dataset(*, name: str, path: Path, grid: tuple, steps: tuple):
12        with h5py.File(path, "w") as file:
13            file.create_dataset(
14                name,
15                (*grid, len(steps)),
16                dtype="float64",
17            )
@staticmethod
def mpi_context(path, mode, comm):
19    @staticmethod
20    def mpi_context(path, mode, comm):
21        return h5py.File(path, mode, driver="mpio", comm=comm)
@staticmethod
def non_mpi_contex(path, mode):
23    @staticmethod
24    def non_mpi_contex(path, mode):
25        return h5py.File(path, mode)