Skip to main content

Python Toolkit for Ocean, Atmospheric, and Surface-wave Turbulence

Project description

pyTOAST: Python Toolkit for Ocean, Atmospheric, and Surface-wave Turbulence

A pure-Python toolkit for analyzing observations of ocean and atmospheric turbulence and related bulk variables.


Overview

pytoast is a library for physical oceanographers and meteorologists processing field observations, with a focus on turbulence statistics. It provides classes for common ocean and atmospheric sensors -- Acoustic Doppler Velocimeters (ADV), Acoustic Doppler Current Profilers (ADCP), sonic anemometers, CTDs, and bulk meteorological instruments -- along with a shared preprocessing pipeline (despiking, coordinate rotations) and derived calculations. These include TKE dissipation, Reynolds stresses with wave-turbulence decomposition, directional wave statistics, seawater and air thermodynamics (TEOS-10), and boundary-layer flux parameterizations (both air-sea and bottom boundary layer).


Installation

pip install pytoast-core

For development:

git clone git@github.com:galenegan/pytoast.git
cd pytoast
pip install -e ".[dev]"

Requirements

  • Python >= 3.11
  • Core dependencies (numpy, scipy, pandas, xarray, matplotlib, h5py, netCDF4, mat73) are installed automatically.

Quick start

The notebooks/ folder contains Jupyter notebooks demonstrating initialization of each main instrument class, along with example calculations. Each notebook shows slight variations on initialization and processing procedures:

  • adcp.ipynb: Traversing nested keys in source files, coordinate transformations, plotting output of two different stress estimation methods
  • adv.ipynb: Specifying instrument deployment depths, rotating and despiking during preprocessing, adding turbulent stresses, directional wave statistics, and dissipation to an xarray dataset for netCDF export
  • ctd.ipynb: Loading a single data file with (multidimensional) data from two deployment depths, calling CTD.derive for seawater thermodynamics calculations
  • met.ipynb: Loading a single data file with instruments at different heights stored under different keys, calling Met.derive for atmospheric thermodynamics calculations
  • sonic.ipynb: Forwarding arguments to pd.read_csv for non-standard data loading, alternate despiking method, calculation of dissipation and buoyancy flux.

In the simplest cases, these will look something like:

from pytoast.ocean.adv import ADV

name_map = {
    "u1": "u", "u2": "v", "u3": "w",
    "p": "pressure", "time": "time",
}

adv = ADV(files="burst.mat", name_map=name_map, fs=16, z=[1.0])

adv.set_preprocess_opts({
    "despike": {"method": "goring_nikora"},
    "rotate":  {"flow_rotation": "align_streamwise"},
})

burst = adv.load_burst(0)
diss  = adv.dissipation(burst, f_low=1.0, f_high=4.0)
print(diss["eps"])     # TKE dissipation rate (m^2/s^3) at each height

See the documentation for the full API reference.


Running tests

pytest
pytest --cov=src    # with coverage report

Contributing

  1. Fork & clone the repo.
  2. Create a feature branch: git checkout -b feature/my-improvement
  3. Install dev dependencies: pip install -e ".[dev]"
  4. Run tests before pushing: pytest
  5. Open a pull request.

Citation

If you use this software in published work, please cite:

@software{pytoast,
  author  = {Galen Egan},
  title   = {pyTOAST: Python Toolkit for Ocean, Atmospheric, and Surface-wave Turbulence},
  year    = {2026},
  url     = {https://github.com/galenegan/pytoast},
}

License

This project is licensed under the MIT License -- see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytoast_core-0.1.0b3.tar.gz (99.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytoast_core-0.1.0b3-py3-none-any.whl (104.0 kB view details)

Uploaded Python 3

File details

Details for the file pytoast_core-0.1.0b3.tar.gz.

File metadata

  • Download URL: pytoast_core-0.1.0b3.tar.gz
  • Upload date:
  • Size: 99.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for pytoast_core-0.1.0b3.tar.gz
Algorithm Hash digest
SHA256 c11d81aa94b412f36f569ef58ebc37fe233a807156449ff077d743cba1fdda26
MD5 5d74da2211731d064f50842baa9b75d4
BLAKE2b-256 33d9a1c6a534672a183ec24c7666df58bf078951e0c6d21a64c274e731a40d8d

See more details on using hashes here.

File details

Details for the file pytoast_core-0.1.0b3-py3-none-any.whl.

File metadata

  • Download URL: pytoast_core-0.1.0b3-py3-none-any.whl
  • Upload date:
  • Size: 104.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for pytoast_core-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 1d0b4301c5c9a778178f0b3ea3822bfbf71386433d632920fd80798e1daf10a1
MD5 dbc4399799b1f0d9ba450f4c48105ccb
BLAKE2b-256 be22944ac7fe2f3a0f99f344d488968b5f9b7d842715018edb2a8bd3f9f67951

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page