Skip to content

Commit c4d3eb6

Browse files
authored
Merge pull request #93 from vadmbertr/meth-naming
Rename cyclogeostrophic methods for consistency with the paper
2 parents cb8a78d + b49102f commit c4d3eb6

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![Python](https://img.shields.io/badge/dynamic/yaml?url=https://raw.githubusercontent.com/meom-group/jaxparrow/master/.github/workflows/python-package.yml&label=Python&query=$.jobs.build.strategy.matrix["python-version"])
44
[![PyPi](https://img.shields.io/badge/dynamic/xml?url=https://pypi.org/rss/project/jaxparrow/releases.xml&label=PyPi&query=/rss/channel/item[1]/title)](https://pypi.org/project/jaxparrow/)
55
![Tests](https://github.com/meom-group/jaxparrow/actions/workflows/python-package.yml/badge.svg)
6-
[![Docs](https://github.com/meom-group/jaxparrow/actions/workflows/python-documentation.yml/badge.svg)](https://jaxparrow.readthedocs.io/)
6+
[![Docs](https://app.readthedocs.org/projects/jaxparrow/badge/)](https://jaxparrow.readthedocs.io/)
77
[![DOI](https://zenodo.org/badge/702998298.svg)](https://zenodo.org/badge/latestdoi/702998298)
88

99
`jaxparrow` implements a novel approach based on a minimization-based formulation to compute the inversion of the cyclogeostrophic balance.
@@ -21,7 +21,7 @@ A comprehensive documenation is available: [https://jaxparrow.readthedocs.io/en/
2121
pip install jaxparrow
2222
```
2323

24-
**<ins>However</ins>**, users with access to GPUs or TPUs should first install `JAX` separately in order to fully benefit from its high-performance computing capacities.
24+
**<ins>However</ins>**, users with access to GPUs or TPUs should first install `JAX` separately in order to fully benefit from its high-performance computing capacities.
2525
See [JAX instructions](https://jax.readthedocs.io/en/latest/installation.html).
2626
By default, `jaxparrow` will install a CPU-only version of JAX if no other version is already present in the Python environment.
2727

docs/examples/duacs.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
"id": "d89919cd",
269269
"metadata": {},
270270
"source": [
271-
"Below we animate the cyclogeostrophic currents magnitude over the year 2019."
271+
"Below we animate the cyclogeostrophic currents magnitude over the month of June 2019."
272272
]
273273
},
274274
{
@@ -24016,7 +24016,7 @@
2401624016
],
2401724017
"metadata": {
2401824018
"kernelspec": {
24019-
"display_name": "Python 3 (ipykernel)",
24019+
"display_name": "jaxparrow",
2402024020
"language": "python",
2402124021
"name": "python3"
2402224022
},
@@ -24030,7 +24030,7 @@
2403024030
"name": "python",
2403124031
"nbconvert_exporter": "python",
2403224032
"pygments_lexer": "ipython3",
24033-
"version": "3.9.23"
24033+
"version": "3.11.14"
2403424034
},
2403524035
"tags": [
2403624036
"toggle-input"

docs/examples/gradient_wind.ipynb

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

docs/examples/swot-enatl60.ipynb

Lines changed: 10 additions & 10 deletions
Large diffs are not rendered by default.

jaxparrow/cyclogeostrophy.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def cyclogeostrophy(
5656
lat_t: Float[Array, "lat lon"],
5757
lon_t: Float[Array, "lat lon"],
5858
mask: Float[Array, "lat lon"] = None,
59-
method: Literal["minimization", "fixed-point"] = "minimization",
59+
method: Literal["minimization-based", "fixed-point"] = "minimization-based",
6060
n_it: int = None,
6161
optim: Union[optax.GradientTransformation, str] = "sgd",
6262
optim_kwargs: dict = None,
@@ -85,9 +85,9 @@ def cyclogeostrophy(
8585
Mask defining the marine area of the spatial domain; `1` or `True` stands for masked (i.e. land)
8686
8787
If not provided, inferred from ``ssh_t`` `nan` values
88-
method : Literal["minimization", "fixed-point"], optional
88+
method : Literal["minimization-based", "fixed-point"], optional
8989
Estimation method to use.
90-
If ``method="minimization"``, then use our minimization-based formulation.
90+
If ``method="minimization-based"``, then use our minimization-based formulation.
9191
If ``method="fixed-point"``, then use the fixed-point approach [Penven et al. (2014)](https://doi.org/10.1002/2013JC009528).
9292
9393
Defaults to `minimization`
@@ -164,10 +164,10 @@ def cyclogeostrophy(
164164
coriolis_factor_v = geometry.compute_coriolis_factor(lat_v)
165165

166166
# Handle spurious and masked data
167-
u_geos_u = sanitize.sanitize_data(u_geos_u, 0, is_land)
168-
v_geos_v = sanitize.sanitize_data(v_geos_v, 0, is_land)
167+
u_geos_u = sanitize.sanitize_data(u_geos_u, jnp.nan, is_land)
168+
v_geos_v = sanitize.sanitize_data(v_geos_v, jnp.nan, is_land)
169169

170-
if method == "minimization":
170+
if method == "minimization-based":
171171
if n_it is None:
172172
n_it = N_IT_MB
173173
if isinstance(optim, str):
@@ -179,13 +179,13 @@ def cyclogeostrophy(
179179
"an optimizer.")
180180
res = _minimization_based(u_geos_u, v_geos_v, dx_u, dx_v, dy_u, dy_v, coriolis_factor_u, coriolis_factor_v,
181181
is_land, n_it, optim)
182-
elif method == "fixed_point":
182+
elif method == "fixed-point":
183183
if n_it is None:
184184
n_it = N_IT_FP
185185
res = _fixed_point(u_geos_u, v_geos_v, dx_u, dx_v, dy_u, dy_v, coriolis_factor_u, coriolis_factor_v, is_land,
186186
n_it, res_eps, use_res_filter, res_filter_size, return_losses)
187187
else:
188-
raise ValueError("method should be one of [\"minimization\", \"fixed_point\"]")
188+
raise ValueError("method should be one of [\"minimization-based\", \"fixed-point\"]")
189189

190190
# Handle masked data
191191
u_cyclo_u, v_cyclo_v, losses = res

0 commit comments

Comments
 (0)