Ocean microstructure turbulence processing: TKE dissipation and chi from Rockland Scientific instruments
Project description
microstructure-tpw
Python tools for reading Rockland Scientific microprofiler data and computing turbulent dissipation rates from VMP (Vertical Microstructure Profiler) and MicroRider instruments.
Overview
microstructure-tpw provides a complete processing pipeline for ocean turbulence measurements from Rockland Scientific instruments equipped with shear probes and fast thermistors (FP07). The package reads proprietary .p binary data files, converts channels to physical units, detects profiles, and computes both the rate of dissipation of turbulent kinetic energy (epsilon) and the rate of dissipation of thermal variance (chi), following the methods described in the Rockland Scientific ODAS MATLAB Library and associated Technical Notes.
-
Epsilon (TKE dissipation rate) from shear probe spectra (detailed mathematics), including Goodman coherent noise removal, Nasmyth spectrum fitting, and Macoun & Lueck wavenumber correction.
-
Chi (thermal variance dissipation rate) from FP07 thermistor spectra (detailed mathematics), including Batchelor/Kraichnan spectrum models, FP07 transfer function correction, and spectral fitting (iterative Peterson & Fer 2014, the default, or MLE).
The package is organized into six subpackages under odas_tpw:
- rsi — Rockland Scientific instrument I/O, NetCDF conversion, profiles, epsilon/chi orchestration
- chi — Chi (thermal variance dissipation) calculation
- scor160 — ATOMIX shear-probe benchmark processing and shared physics modules
- perturb — Full campaign processing pipeline (trim, merge, calibrate, compute, bin)
- processing — Instrument-agnostic profile processing (top trim, bottom-crash, CT alignment, multi-probe epsilon combining)
- pyturb — Third-party code (oceancascades/pyturb) hosted in-repo; maintained upstream, not refactored here
Installation
pip install -e ".[dev]" # editable install with dev dependencies
pip install . # standard install
See docs/installation.md for more options.
Quick Start
Several CLIs ship with the package (rsi-tpw, perturb, perturb-plot, perturb-diag, scor160-tpw, pyturb-cli); the two primary ones, for different workflows:
rsi-tpw— single-file or short batch processing on the command line.perturb— full campaign pipeline driven by a YAML config file (trim → merge → profiles → epsilon → chi → bin → combo), with parallel workers and stage-aware logging. Use this for cruise-scale runs.
The two CLIs use different spectral defaults (rsi-tpw: fft_length=1024
with a 4096-sample dissipation window; perturb: duration-based
fft_sec=1.0 — one second, resolved per instrument sampling rate,
= 512 samples on a 512-Hz VMP-250 — for both epsilon and chi), so their
outputs differ in vertical resolution and noise behavior.
rsi-tpw (single files / short batches)
# Full pipeline: .p files → epsilon → chi
rsi-tpw pipeline VMP/*.p -o results/
# Or run individual stages
rsi-tpw eps VMP/*.p -o epsilon/ # writes into epsilon/eps_00/
rsi-tpw chi VMP/*.p --epsilon-dir epsilon/ -o chi/ # finds eps_00/ automatically
# Pre-deployment bench test (dummy probes, instrument at rest): raw-count
# figures + spectra + an auto-evaluated Rockland checklist (see docs/rsi-tpw/bench.md)
rsi-tpw bench VMP/*.p -o bench/
Note:
epswrites into a hash-tracked subdirectory (epsilon/eps_00/, see output directories). The chi command searches the given--epsilon-dirand itseps_*subdirectories (most recently modified first), and matches both single-profile ({stem}_eps.nc) and per-profile ({stem}_prof001_eps.nc, ...) file names, concatenating the latter along time. Only when no matching epsilon files exist anywhere does chi fall back to Method 2 for that file, with a console warning.
from odas_tpw.rsi.pipeline import run_pipeline
from pathlib import Path
# Full pipeline: .p → profiles → epsilon → chi → binning → combine
run_pipeline([Path("VMP/file.p")], Path("results/"))
# Or use the modular API
from odas_tpw.rsi.dissipation import compute_diss_file
from odas_tpw.rsi.chi_io import compute_chi_file
compute_diss_file("VMP/file.p", "epsilon/")
compute_chi_file("VMP/file.p", "chi/")
Note:
get_diss()andget_chi()still work for backward compatibility but are deprecated in favor ofrun_pipeline()or the modularcompute_diss_file()/compute_chi_file()functions.
perturb (campaign-scale batch pipeline)
# Write a template config you can edit (cruise paths, GPS file,
# instrument-specific overrides, parallelism, etc.).
perturb init my-cruise.yaml
# Run the full pipeline — outputs land in <output_root>/{profiles_NN,
# diss_NN, chi_NN, ctd_NN, *_binned_NN, combo}, with a per-run log under
# <output_root>/logs/.
perturb run -c my-cruise.yaml
# Or run individual stages against the same config:
perturb trim -c my-cruise.yaml
perturb profiles -c my-cruise.yaml
perturb diss -c my-cruise.yaml
perturb chi -c my-cruise.yaml
perturb bin -c my-cruise.yaml
perturb combo -c my-cruise.yaml
See docs/perturb/pipeline.md for the full stage list and docs/perturb/configuration.md for the config schema.
Documentation
rsi-tpw (science library)
| Document | Description |
|---|---|
| CLI Reference | All rsi-tpw subcommands and flags |
| Configuration | YAML config file format and all parameter defaults |
| Pipeline | Processing stages and data flow |
| Python API | Using microstructure-tpw from Python code |
| Output Directories | Sequential hash-tracked output scheme |
| Vectorization | Vectorized compute internals |
| Bench Test | Pre-deployment bench check (bench): quick_bench figures + auto checklist |
perturb (batch pipeline)
| Document | Description |
|---|---|
| Pipeline | Batch processing stages and data flow |
| CLI Reference | All perturb subcommands and flags |
| Configuration | YAML config file format for perturb |
| Parallel Scaling | Benchmark results for multi-core scaling |
| Modules | Module-level reference |
| pyturb Comparison | Comparison with oceancascades/pyturb |
scor160 (ATOMIX benchmark)
| Document | Description |
|---|---|
| CLI Reference | All scor160-tpw subcommands and flags |
Shared
| Document | Description |
|---|---|
| Epsilon Mathematics | TKE dissipation algorithm details |
| Chi Mathematics | Thermal dissipation algorithm details |
| Mixing Efficiency | Mathematics of the dissipation ratio |
| Best Practices | Guidance for comparing turbulence measurements |
| Bibliography | Consolidated references |
| Installation | Installation options |
| Changelog | Version history |
References
This package is a Python implementation derived from the Rockland Scientific ODAS MATLAB Library (v4.5.1) and associated Technical Notes (TN-028, TN-051, TN-061).
See docs/bibliography.md for the full list of references.
Testing
python -m pytest # run all tests
python -m pytest tests/test_epsilon.py # epsilon pipeline tests only
Development
This project was developed in collaboration with Claude Code.
Citation
If you use this software in published work, please cite it. Citation metadata
lives in CITATION.cff — GitHub renders a "Cite this
repository" button from it (BibTeX/APA export). Each tagged release is
archived on Zenodo with a DOI; cite the concept (all-versions) DOI so the
reference always resolves to the latest release. The DOI badge and identifier
are added here once the first release is minted.
License
GPLv3 — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microstructure_tpw-0.3.0.tar.gz.
File metadata
- Download URL: microstructure_tpw-0.3.0.tar.gz
- Upload date:
- Size: 852.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b7ab25edd5074758b900b35313e852257c8716750aacad8d59b8461770c9f2a
|
|
| MD5 |
672f25ae4cf0d5b9a391277564515500
|
|
| BLAKE2b-256 |
c1df443f256ba1606d7713e7614c77f7828bf57dbedc48f326dbfad763a77103
|
Provenance
The following attestation bundles were made for microstructure_tpw-0.3.0.tar.gz:
Publisher:
release.yml on mousebrains/turbulence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
microstructure_tpw-0.3.0.tar.gz -
Subject digest:
0b7ab25edd5074758b900b35313e852257c8716750aacad8d59b8461770c9f2a - Sigstore transparency entry: 2171042507
- Sigstore integration time:
-
Permalink:
mousebrains/turbulence@936cc1c47bc941d7583b8d1886fcdf922eb92774 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mousebrains
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@936cc1c47bc941d7583b8d1886fcdf922eb92774 -
Trigger Event:
push
-
Statement type:
File details
Details for the file microstructure_tpw-0.3.0-py3-none-any.whl.
File metadata
- Download URL: microstructure_tpw-0.3.0-py3-none-any.whl
- Upload date:
- Size: 561.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
485d5a03db49bdf740160710f798fc287b2a71154dc8e9dec3b4ab2648a56256
|
|
| MD5 |
cdb25f14273c5b751d48a697ae4dc599
|
|
| BLAKE2b-256 |
5b3ecd050aaea8c44a55eaa424b27a98e11cc9186e79eb0f5f446f5eb6d7a034
|
Provenance
The following attestation bundles were made for microstructure_tpw-0.3.0-py3-none-any.whl:
Publisher:
release.yml on mousebrains/turbulence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
microstructure_tpw-0.3.0-py3-none-any.whl -
Subject digest:
485d5a03db49bdf740160710f798fc287b2a71154dc8e9dec3b4ab2648a56256 - Sigstore transparency entry: 2171042561
- Sigstore integration time:
-
Permalink:
mousebrains/turbulence@936cc1c47bc941d7583b8d1886fcdf922eb92774 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mousebrains
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@936cc1c47bc941d7583b8d1886fcdf922eb92774 -
Trigger Event:
push
-
Statement type: