Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
[![Tests](https://github.com/pyCOARE/coare/actions/workflows/tests.yml/badge.svg)](https://github.com/pyCOARE/coare/actions/workflows/tests.yml)
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](ttps://github.com/pyCOARE/coare/blob/master/LICENSE.txt)
[![Code coverage](https://codecov.io/gh/pyCOARE/coare/branch/main/graph/badge.svg)](https://app.codecov.io/gh/pyCOARE/coare)
[![Tests](https://github.com/pycoare/coare/actions/workflows/tests.yml/badge.svg)](https://github.com/pycoare/coare/actions/workflows/tests.yml)
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](ttps://github.com/pycoare/coare/blob/master/LICENSE.txt)
[![Code coverage](https://codecov.io/gh/pycoare/coare/branch/main/graph/badge.svg)](https://app.codecov.io/gh/pycoare/coare)
[![Docs](https://readthedocs.org/projects/pycoare/badge/?version=latest)](https://pycoare.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://img.shields.io/pypi/v/pycoare?style=plastic)](https://pypi.org/project/pycoare/)

# pycoare

This is a beta version of an implementation of the [COARE algorithm](https://doi.org/10.1175/1520-0442(2003)016%3C0571:BPOASF%3E2.0.CO;2) that builds on the [original NOAA-PSL pycoare code](https://github.com/NOAA-PSL/COARE-algorithm). Currently only COARE v3.5 is implemented - hopefully v3.6 will come soon!
**pycoare** is a Python package for calculating various **air-sea fluxes** from **bulk variables** (e.g., wind speed, temperature, humidity),
using the COARE algorithms developed through the TOGA-COARE project ([Fairall et al., 1996a](https://agupubs.onlinelibrary.wiley.com/doi/10.1029/95JC03190), [Fairall et al., 1996b](https://agupubs.onlinelibrary.wiley.com/doi/10.1029/95JC03205), [Fairall et al., 1997](http://journals.ametsoc.org/doi/10.1175/1520-0426(1997)014%3C0338:ISMOTM%3E2.0.CO;2)).

This version makes minor updates to the code itself, refactors code to improve readability, maintability, and distribution, and creates a standardized API for calling functions. [See the changelog](https://github.com/pyCOARE/coare/blob/main/docs/changelog.md) for all mathematically relevant changes made to the original code.
Included in this package are implementations of the **COARE v3.5 and v3.6 algorithms** that builds on the [original NOAA-PSL pycoare code](https://github.com/NOAA-PSL/COARE-algorithm). This package makes very minor updates to the algorithm itself, instead focusing on improved code structure, packaging, documentation, and distribution by implementing an object oriented approach and utilizing modern Python tooling. The goal of this new version is to improve usability and reproducibility, encourage collaboration, and ease maintenance.

[See the changelog](https://github.com/pycoare/coare/blob/main/docs/changelog.md) for all mathematically relevant changes made to the algorithm itself.

**Find more details on the usage and api [in the documentation](https://pycoare.readthedocs.io).**

## Installation

The latest stable version (currently a beta) can be downloaded using Pip
The latest stable version (currently a beta) can be downloaded using pip:
```
pip install pycoare
```

You can install the most up-to-date version using
The package can also be added to projects via [uv](https://docs.astral.sh/uv/):
```
pip install git+https://github.com/pyCOARE/coare
uv add pycoare
```
You can install the most up-to-date version using:
```
pip install git+https://github.com/pycoare/coare
```

## Contribution

I welcome any contributions. Please feel free to [raise an issue](https://github.com/pyCOARE/coare/issues) or submit a [pull request](https://github.com/pyCOARE/coare/pulls).

## Origins and Credits
The international TOGA-COARE field program which took place in the western Pacific warm pool over 4 months from November 1992 to February 1993 ([Fairall et al. 1996a](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/Fairall%20et%20al.%201996a%20-%20cool%20skin%20warm%20layer.pdf), [1996b](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/Fairall%20et%20al.%201996b%20-%20bulk%20fluxes%20of%20variables.pdf) and [1997](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/Fairall%20et%20al.%201997%20-%20ship%20measurements%20MABL.pdf)) spurred the development of the COARE model. The algorithm is intended to provide estimates of `momentum, sensible heat`, and `latent heat fluxes` using inputs of bulk atmospheric variables (`wind speed, SST, air temperature, air humidity`). The algorithm contains subroutines/functions to handle near-surface gradients of temperature in the ocean.

This Python implementation of the COARE algorithm was initially translated from MATLAB by Byron Blomquist and Ludovic Bariteau. For more information on the people and publications that developed the COARE algorithm, see the references below.

## Versions
- **Version 2.5** was published in 1996.
- **Version 3.0** was published in 2003; it was a major update from Version 2.5. This update was based on new observations at higher wind speeds (10 to 20 m/s). Available in MATLAB and FORTRAN only.
- **Version 3.5** was released in 2013 following the publication of [Edson et al. 2013](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/Edson%20et%20al.%202013%20-%20momentum%20flux.pdf), which made adjustments to the wind speed dependence of the Charnock parameter based on a large database of direct covariance stress observations (principally from a buoy). This led to an increase in stress for wind speeds greater than about 18 m/s. The roughness Reynolds number formulation of the scalar roughness length was tuned slightly to give the same values of `Ch` and `Ce` as Version 3.0. The diurnal warm layer model was structured as a separate routine instead of embedded in a driver program. COARE 3.5 was based on Edson’s buoy data ([Edson et al. 2013](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/Edson%20et%20al.%202013%20-%20momentum%20flux.pdf)) and was compared to a large database (a total of 16,000 hours of observations) combining observations from NOAA, WHOI, and U. Miami ([Fairall et al. 2011](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/Fairall%20et%20al.%202011%20-%20COAREG.pdf)). It is available in Python and MATLAB.
- **Version 3.6** is slightly restructured and built around improvements in the representation of the effects of waves on fluxes. This includes improved relationships of `surface roughness`, $z_o$, and `whitecap fraction`, $W_f$, on wave parameters. More details can be found in [coare3.6\_readme\_1.pdf](https://github.com/noaa-psd/COARE-algorithm/blob/master/References/coare36_readme_1.pdf). This version is available in Python, MATLAB and FORTRAN.

pycoare contains two versions of the COARE algorithm: **COARE v3.5** and **COARE v3.6**.

## References:
Version 3.5 was released in 2013, which made adjustments to the wind speed dependence of the Charnock parameter based on a large database of direct covariance stress observations (principally from a buoy) ([Edson et al., 2013](https://doi.org/10.1175/JPO-D-12-0173.1)).
This led to an increase in stress for wind speeds greater than about 18 m/s. The roughness Reynolds number formulation of the scalar roughness length was tuned slightly to give the same values of `Ch` and `Ce` as Version 3.0. The diurnal warm layer model was structured as a separate routine instead of embedded in a driver program. COARE v3.5 was based on buoy data ([Edson et al., 2013](https://doi.org/10.1175/JPO-D-12-0173.1)) and was compared to a large database (a total of 16,000 hours of observations) combining observations from NOAA, WHOI, and U. Miami ([Fairall et al., 2011](http://doi.wiley.com/10.1029/2010JC006884)).

* Edson, J.B., J. V. S. Raju, R.A. Weller, S. Bigorre, A. Plueddemann, C.W. Fairall, S. Miller, L. Mahrt, Dean Vickers, and Hans Hersbach, 2013: On the Exchange of momentum over the open ocean. J. Phys. Oceanogr., 43, 1589–1610. doi: http://dx.doi.org/10.1175/JPO-D-12-0173.1
Version 3.6 is slightly restructured and built around improvements in the representation of the effects of waves on fluxes. This includes improved relationships of surface roughness and whitecap fraction on wave parameters ([Fairall et al., 2022](https://doi.org/10.3389/fmars.2022.826606)).

* Fairall, C.W., E.F. Bradley, J.S. Godfrey, G.A. Wick, J.B. Edson, and G.S. Young, 1996a: The cool skin and the warm layer in bulk flux calculations. J. Geophys. Res. 101, 1295-1308. https://doi.org/10.1029/95JC03190
## Contribution

* Fairall, C.W., E.F. Bradley, D.P. Rogers, J.B. Edson, G.S. Young, 1996b: Bulk parameterization of air-sea fluxes for TOGA COARE. J. Geophys. Res. 101, 3747-3764. https://doi.org/10.1029/95JC03205
I welcome any contributions - feel free to [raise an issue](https://github.com/pycoare/coare/issues) or submit a [pull request](https://github.com/pycoare/coare/pulls). Take a look at the [contribution guide](https://pycoare.readthedocs.io/en/latest/contributing.html) to get started!

* Fairall, C. W., White, A. B., Edson, J. B., and Hare, J. E.: Integrated Shipboard Measurements of the Marine Boundary Layer, J. Atmos. Ocean. Tech., 14, 338–359, 1997. https://doi.org/10.1175/1520-0426(1997)014<0338:ISMOTM>2.0.CO;2
## Credits

* Fairall, C.W., E.F. Bradley, J.E. Hare, A.A. Grachev, and J.B. Edson, 2003: Bulk parameterization of air-sea fluxes: Updates and verification for the COARE algorithm. J. Climate 16, 571-591. https://doi.org/10.1175/1520-0442(2003)016<0571:BPOASF>2.0.CO;2
This Python implementation of the COARE algorithm was initially translated from MATLAB by
Byron Blomquist, Ludovic Bariteau, with support from the NOAA Physical Sciences Laboratory ([Ludovic et al., 2021](https://zenodo.org/records/5110991)).

* Fairall, C.W., Mingxi Yang, Ludovic Bariteau, J.B. Edson, D. Helmig, W. McGillis, S. Pezoa, J.E. Hare, B. Huebert, and B. Blomquist, 2011: Implementation of the COARE flux algorithm with CO2, DMS, and O3. J. Geophys. Res., 116, C00F09, https://doi.org/10.1029/2010JC006884
The development of the COARE algorithm builds upon decades of research, for which I am extremely appreciative.
The history of the COARE algorithm and its development [can be found here](https://github.com/pyCOARE/coare/tree/main/docs/References) ([Fairall et al., 2022](https://doi.org/10.3389/fmars.2022.826606)).
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/References/Fairall et al. 2011 - COAREG.pdf
Binary file not shown.
Binary file not shown.
Binary file removed docs/References/coare36_readme_1.pdf
Binary file not shown.
28 changes: 28 additions & 0 deletions docs/c36_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
COARE v3.6
==========

.. caution::

The COARE algorithm is designed to work best when the user has time series of as many input variables as possible.
This implementation only specifically requires that the ocean surface wind speed ``u`` be provide, but it is highly recommended to use additional variables.
If any of variables are not available for the full ``u`` time series, a single, representative (e.g., mean) value can be input that will be used in place of the entire time series.
Please read the documentation carefully to understand each of the input variables to :class:`coare_36`.

.. currentmodule:: pycoare

.. autoclass:: coare_36
:members:

.. autoclass:: pycoare.coare_36.fluxes

.. autoclass:: pycoare.coare_36.transfer_coefficients

.. autoclass:: pycoare.coare_36.stability_functions

.. autoclass:: pycoare.coare_36.stability_parameters

.. autoclass:: pycoare.coare_36.velocities

.. autoclass:: pycoare.coare_36.temperatures

.. autoclass:: pycoare.coare_36.humidities
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Configuration file for the Sphinx documentation builder.

import sys
import os
import sys

sys.path.insert(0, os.path.abspath(".."))

# -- Project information

project = "pyCOARE"
project = "pycoare"
author = "Andrew Scherer"

release = "1"
version = "0.2.0"
version = "0.3.0"

# -- General configuration

Expand All @@ -22,8 +22,11 @@
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx_search.extension",
"sphinxcontrib.bibtex",
]

bibtex_bibfiles = ["references.bib"]

autodoc_typehints = "none"

autodoc_member_order = "alphabetical"
Expand Down
7 changes: 3 additions & 4 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ Please follow these guidelines for contributing to this project:
$ git clone <url_to_your_forked_repository>
$ cd coare

* Install the development requirements in a new environment
* Install the development requirements using `uv <https://docs.astral.sh/uv/>`_ and activate the virtual environment

.. code-block:: bash

$ conda create -n pycoare
$ conda activate pycoare
$ pip install -r requirements-dev.txt
$ uv sync --dev
$ .venv/bin/activate

* Create a new branch for your feature

Expand Down
49 changes: 42 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,40 +1,75 @@
pycoare
=======

**pycoare** is a Python package for calculating various air-sea fluxes from bulk variables,
using code developed through the TOGA-COARE project.
**pycoare** is a Python package for calculating various **air-sea fluxes** from **bulk variables** (e.g., wind speed, temperature, humidity),
using code developed through the TOGA-COARE project :cite:`fairall_bulk_1996,fairall_coolskin_1996,fairall_integrated_1997`.

Included in this package are implementations of the **COARE v3.5 and v3.6 algorithms** that builds on the `original NOAA-PSL pycoare code <https://github.com/NOAA-PSL/COARE-algorithm>`_.
This package makes very minor updates to the algorithm itself, instead focusing on improved code structure, packaging, documentation, and distribution by implementing an object oriented approach and utilizing modern Python tooling.
The goal of this new version is to improve usability and reproducibility, encourage collaboration, and ease maintenance.

Installation
------------

The latest stable version (currently a beta) can be downloaded using Pip::
The latest stable version (currently a beta) can be downloaded using pip::

>>> pip install pycoare

The package can also be added to projects via `uv <https://docs.astral.sh/uv/>`_::

>>> uv add pycoare

You can install the most up-to-date version using::

>>> pip install git+https://github.com/pyCOARE/coare
>>> pip install git+https://github.com/pycoare/coare

Versions
--------

pycoare contains two versions of the COARE algorithm: COARE v3.5 and COARE v3.6.

Version 3.5 was released in 2013, which made adjustments to the wind speed dependence of the Charnock parameter based on a large database of direct covariance stress observations (principally from a buoy) :cite:`edson_exchange_2013`.
This led to an increase in stress for wind speeds greater than about 18 m/s.
The roughness Reynolds number formulation of the scalar roughness length was tuned slightly to give the same values of `Ch` and `Ce` as Version 3.0.
The diurnal warm layer model was structured as a separate routine instead of embedded in a driver program.
COARE 3.5 was based on buoy data :cite:`edson_exchange_2013` and was compared to a large database (a total of 16,000 hours of observations) combining observations from NOAA, WHOI, and U. Miami :cite:`fairall_implementation_2011`.

Version 3.6 is slightly restructured and built around improvements in the representation of the effects of waves on fluxes. This includes improved relationships of surface roughness and whitecap fraction on wave parameters :cite:`fairall_air-sea_2022`.

Contribution
------------

I welcome any contributions - feel free to `raise an issue <https://github.com/pycoare/coare/issues>`_ or submit a `pull request <https://github.com/pycoare/coare/pulls>`_.
Take a look at the `contribution guide <contributing>`_ to get started!

Credits
-------

This version of the Python implementation of the COARE algorithm was `initially translated from MATLAB by Byron Blomquist and Ludovic Bariteau <https://github.com/NOAA-PSL/COARE-algorithm>`_.
For more information on the people and publications that developed the COARE algorithm, see the references at the link below.
This Python implementation of the COARE algorithm was initially translated from MATLAB by
Byron Blomquist, Ludovic Bariteau, with support from the NOAA Physical Sciences Laboratory :cite:`ludovic_python_2021`.

The development of the COARE algorithm builds upon decades of research, for which I am extremely appreciative.
The history of the COARE algorithm and its development can be found by downloading :download:`this supplementary material <References/Fairall-2022-COARE-development.pdf>` :cite:`fairall_air-sea_2022`.
See the `references <references>`_ for more information.

.. toctree::
:maxdepth: 2
:caption: Getting Started

installation
usage
References <https://github.com/pyCOARE/coare/tree/main/docs/References>

.. toctree::
:maxdepth: 2
:caption: API Reference

c35_api
c36_api
util_api

.. toctree::
:maxdepth: 2
:caption: Resources

contributing
references
33 changes: 33 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Installation
============

The latest stable version (currently a beta) can be downloaded using pip::

>>> pip install pycoare

The package can also be added to projects via `uv <https://docs.astral.sh/uv/>`_::

>>> uv add pycoare

Dependencies
------------

pycoare requires Python 3.9 or later.

Currently, the only dependency is `numpy <https://numpy.org/>`_ (v2.0 or later).

Future versions may implement support for and require `xarray <https://xarray.pydata.org/en/stable/>`_.

Development Installation
------------------------

Installing the development dependencies is simple using uv::

>>> uv sync --dev
>>> .venv/bin/activate

If you are not using uv, you can install the development dependencies using pip::

>>> pip install -r requirements.txt

See more in the `contribution guide <contributing>`_.
Loading