Skip to main content

jaxparrow

Python PyPi Tests codecov Docs DOI

jaxparrow implements a novel approach based on a minimization-based formulation to compute the inversion of the cyclogeostrophic balance.

It leverages the power of JAX, to efficiently solve the inversion as a minimization problem. Given the Sea Surface Height (SSH) field of an ocean system, jaxparrow estimates the velocity field that best satisfies the cyclogeostrophic balance.

A comprehensive documenation is available: https://jaxparrow.readthedocs.io/en/latest/!

Installation

jaxparrow is Pip-installable:

pip install jaxparrow

However, users with access to GPUs or TPUs should first install JAX separately in order to fully benefit from its high-performance computing capacities. See JAX instructions. By default, jaxparrow will install a CPU-only version of JAX if no other version is already present in the Python environment.

Usage

Estimating the cyclogeostrophic currents from a given Sea Surface Height field can be achieved using any of the following methods:

Taking as inputs:

  • a SSH field (a 2d jax.Array),
  • the latitude and longitude grids at the T points (two 2d jax.Array).

They return a result objects holding the cyclogeostrophic velocity $u$ and $v$ components.

In a Python script estimating the cyclogeostrophic currents for a single timestamp would resort to:

from jaxparrow import minimization_based  # or gradient_wind or fixed_point

mb_result = minimization_based(lat_t=lat_2d, lon_t=lon_2d, ssh_t=ssh_2d)

ucg_2d = mb_result.ucg  # 2d jax.Array
vcg_2d = mb_result.vcg  # 2d jax.Array

Note that it is also possible to directly pass as inputs the geostrophic velocity $u$ and $v$ components, rather than the SSH:

mb_result = minimization_based(lat_t=lat_2d, lon_t=lon_2d, ug_t=ug_2d, vg_t=vg_2d)

To vectorise the estimation of the cyclogeostrophy along a first time dimension, one aims to use jax.vmap.

import jax

vmap_cyclogeostrophy = jax.vmap(lambda _ssh_2d: cyclogeostrophy(lat_t=lat_2d, lon_t=lon_2d, ssh_t=_ssh_2d))
mb_result = vmap_cyclogeostrophy(ssh_3d)

ucg_3d = mb_result.ucg  # 3d jax.Array
vcg_3d = mb_result.vcg  # 3d jax.Array

jaxparrow also notably allows to:

Explore jaxparrow documentation for more details, including the API description and step-by-step examples in the form of notebooks.

Contributing

Contributions are welcomed! See CONTRIBUTING.md and CONDUCT.md to get started.

How to cite

If you use this software, please cite it: CITATION.cff. Thank you!

Metadata

Release files for jaxparrow 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jaxparrow 1.1.1
File Size Uploaded
jaxparrow-1.1.1.tar.gz 30.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jaxparrow 1.1.1
File Interpreter ABI Platform
jaxparrow-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 69.9 kB

Release files / jaxparrow-1.1.1.tar.gz

Download URL jaxparrow-1.1.1.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ff884cf60b678a81e66dde0336ccb31cfbc3de915b4de4890cc644660a88ff43
BLAKE2b-256 checksum
How to use checksums
a90f27a1d40c11836381815c3a9ab152c316d4e921841445fb38b80b49e80d38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / jaxparrow-1.1.1-py3-none-any.whl

Download URL jaxparrow-1.1.1-py3-none-any.whl
Size 39.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac16ea3124f9433aa55cc2b35ba4443ee04ee655bd2995f5e36e67f117c506f5
BLAKE2b-256 checksum
How to use checksums
c85b4303bb78bd002b0998074be8324bed58870994c261d796ac6f746010d309
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page