Metadata-Version: 2.4
Name: h5gears
Version: 0.2.0
Summary: A collection of tools for converting HDF5 model files to other mesh/model formats
Author-email: aaronchh <aaronhsu219@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/AaronOET/h5gears
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20.0
Requires-Dist: h5py>=3.0.0
Requires-Dist: netCDF4>=1.5.0
Dynamic: license-file

# H5GEARS

A collection of Python tools for converting HDF5 model/mesh files to other mesh/model formats.

## Installation

```bash
pip install h5gears
```

Or from source:

```bash
pip install -e .
```

## Features

- **h52nc**: Convert an SRH-2D mesh file (`.h5`) to a Delft3D FM (D-Flow FM) UGRID `net.nc` mesh file
- **h52xyz**: Extract node coordinates from an SRH-2D mesh file (`.h5`) to a `<MeshName>_nodes.csv` file

## Usage

### Command-line

```bash
# List all available commands
h5gears-info

# Convert every mesh in a single SRH-2D mesh file
h52nc -i mesh.h5

# Convert every mesh in all matching files (glob expansion supported)
h52nc -i *.h5

# Convert only a specific mesh by name
h52nc -i mesh.h5 -n Mesh001

# Write outputs to a specific directory, including node elevation (z)
h52nc -i mesh.h5 -o out/ -d 3

# Extract node coordinates from every mesh in a single SRH-2D mesh file
h52xyz -i mesh.h5

# Extract only a specific mesh by name
h52xyz -i mesh.h5 -n Mesh001

# Write outputs to a specific directory, including node elevation (z)
h52xyz -i mesh.h5 -o out/ -d 3
```

### Python API

```python
from h5gears import h52nc

# List the mesh names contained in an SRH-2D file
h52nc.list_meshes("mesh.h5")

# Convert every mesh in a file to net.nc, returning the output paths
h52nc.convert_file("mesh.h5", out_dir="out/", dim=2)

# Extract node coordinates from every mesh in a file to CSV, returning the output paths
from h5gears import h52xyz
h52xyz.convert_file("mesh.h5", out_dir="out/", dim=2)
```

## Notes

- `h52nc` reads mesh geometry from the `2DMeshModule` group of SRH-2D HDF5 mesh files (node coordinates and element connectivity) and writes it out as a UGRID-style `net.nc` file compatible with Delft3D FM / D-Flow FM.
- `h52xyz` reads node coordinates from the same `2DMeshModule` group and writes a `<MeshName>_nodes.csv` file with columns `NodeID,x,y` (or `NodeID,x,y,z` with `-d 3`), one row per 1-indexed node id.
- By default, every mesh found in an input file is converted; use `-n`/`--name` to restrict conversion to specific mesh names.
- Output files are written alongside each input file by default; use `-o`/`--outdir` to choose a different destination directory.
