WavePart Python is a clean Python package for partitioning directional wave spectra into wind sea and multiple swell components. The repository is organized for direct Python use, includes a compact command-line interface, and ships with a Python-native sample dataset so a new user can run it immediately.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .[plot,dev]Use the bundled sample dataset:
wavepart partition data/sample_spectra.npz --index 1 --output out/partition_case.npz
wavepart wind-limits data/sample_spectra.npz --output out/wind_limits.npz
wavepart demo data/sample_spectra.npz --index 287 --output-dir out/demoUse the package directly:
import numpy as np
from wavepart import partition_spectrum, compute_partition_params
with np.load("data/sample_spectra.npz") as data:
freq = data["freq"]
direction = data["direction"]
spectrum = data["spectra"][:, :, 0]
partition = partition_spectrum(freq, direction, spectrum)
params = compute_partition_params(
partition.smoothed_spectrum,
freq,
direction,
partition.labels,
depth=30.0,
)The package expects .npz files with these keys:
freqdirectionspectratime(optional)
The bundled sample file follows that format directly.
src/wavepart: core packagedata/sample_spectra.npz: ready-to-run example datasettests: regression, CLI, and plotting testsdocs/assets/wavepart-3d.png: package preview image
Run the full test suite:
pytestCurrent tests cover:
- reference regression cases
- wind-limit regression
- flat-spectrum and label invariants
- CLI smoke checks
- plotting smoke checks
This Python implementation is based on the original WavePart work by Douglas Cahl and George Voulgaris. The original repository remains available here:
This repository is distributed under the GNU General Public License v3.0. See LICENSE.
