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.0b2.tar.gz (97.3 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.0b2-py3-none-any.whl (102.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytoast_core-0.1.0b2.tar.gz
  • Upload date:
  • Size: 97.3 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.0b2.tar.gz
Algorithm Hash digest
SHA256 520e0b6caa0f12fbc91b1d26e59f7594813cd39c79774035a790907550f5cd81
MD5 f01814bcc328aebf484efbfa1667f3e6
BLAKE2b-256 998a52119b7deee5dd7c6f74b76782c019aaadb1ac940312ff7e60db80208b21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytoast_core-0.1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 102.3 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.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 90dbf00da838d19dc4e47e492c0af59308a3577ca4eaf8ba60dc0f122c0f922e
MD5 744422d4e0c5e6c42dcd21004feccb21
BLAKE2b-256 40ec1ac29955c00da1fa0b458ce86bdf7c7688a56e34d0079210c26983cc1927

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