From 71248cfb149ecd2d3b9511b87469d64bc91a984f Mon Sep 17 00:00:00 2001 From: Vadim Bertrand Date: Wed, 25 Oct 2023 18:09:59 +0200 Subject: [PATCH] fix some imports --- .gitignore | 1 + README.md | 2 +- jaxparrow/__init__.py | 6 +++--- jaxparrow/cyclogeostrophy.py | 2 +- jaxparrow/geostrophy.py | 24 ++++++++++++------------ jaxparrow/tools/__init__.py | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 904ed18..214db09 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .ipynb_checkpoints # build stuff +build dist *.egg-info junit diff --git a/README.md b/README.md index b787ca0..8f9d1a1 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ u_cyclo, v_cyclo = cyclogeostrophy(u_geos=u_geos, v_geos=v_geos, By default, the `cyclogeostrophy` function relies on our variational method. Its `method` argument provides the ability to use an iterative method instead, either the one described by [Penven *et al.*](https://doi.org/10.1016/j.dsr2.2013.10.015), or the one by [Ioannou *et al.*](https://doi.org/10.1029/2019JC015031). Additional arguments also give a finer control over the three approaches hyperparameters. \ -See [**jaxparrow** documentation](docs/_build/index.html) for more details. +See [**jaxparrow** documentation](https://meom-group.github.io/jaxparrow/) for more details. [Notebooks](notebooks/README.md) are available as step-by-step examples. diff --git a/jaxparrow/__init__.py b/jaxparrow/__init__.py index e9ac4f9..6aac5c6 100644 --- a/jaxparrow/__init__.py +++ b/jaxparrow/__init__.py @@ -1,5 +1,5 @@ -from cyclogeostrophy import cyclogeostrophy -from geostrophy import geostrophy +from .cyclogeostrophy import cyclogeostrophy +from .geostrophy import geostrophy __all__ = ["cyclogeostrophy", "geostrophy"] -__version__ = "0.0.1" +__version__ = "0.0.2" diff --git a/jaxparrow/cyclogeostrophy.py b/jaxparrow/cyclogeostrophy.py index 412914c..b0ede98 100644 --- a/jaxparrow/cyclogeostrophy.py +++ b/jaxparrow/cyclogeostrophy.py @@ -10,7 +10,7 @@ from scipy import signal from tqdm import tqdm -from tools import tools +from .tools import tools #: Default maximum number of iterations for the iterative approach N_IT_IT = 100 diff --git a/jaxparrow/geostrophy.py b/jaxparrow/geostrophy.py index c711d38..f141613 100644 --- a/jaxparrow/geostrophy.py +++ b/jaxparrow/geostrophy.py @@ -2,7 +2,7 @@ import numpy as np -from tools import tools as geo +from .tools import tools __all__ = ["geostrophy"] @@ -33,24 +33,24 @@ def geostrophy(ssh: Union[np.ndarray, np.ma.MaskedArray], :rtype: Tuple[np.ndarray, np.ndarray] """ # Computing the gradient of the ssh - grad_ssh_x, grad_ssh_y = geo.compute_gradient(ssh, dx_ssh, dy_ssh) + grad_ssh_x, grad_ssh_y = tools.compute_gradient(ssh, dx_ssh, dy_ssh) # Interpolation of the data (moving the grad into the u and v position) - grad_ssh_y = geo.interpolate(grad_ssh_y, axis=0) - grad_ssh_y = geo.interpolate(grad_ssh_y, axis=1) + grad_ssh_y = tools.interpolate(grad_ssh_y, axis=0) + grad_ssh_y = tools.interpolate(grad_ssh_y, axis=1) - grad_ssh_x = geo.interpolate(grad_ssh_x, axis=1) - grad_ssh_x = geo.interpolate(grad_ssh_x, axis=0) + grad_ssh_x = tools.interpolate(grad_ssh_x, axis=1) + grad_ssh_x = tools.interpolate(grad_ssh_x, axis=0) # Interpolating the coriolis - cu = geo.interpolate(coriolis_factor_u, axis=0) - cu = geo.interpolate(cu, axis=1) + cu = tools.interpolate(coriolis_factor_u, axis=0) + cu = tools.interpolate(cu, axis=1) - cv = geo.interpolate(coriolis_factor_v, axis=1) - cv = geo.interpolate(cv, axis=0) + cv = tools.interpolate(coriolis_factor_v, axis=1) + cv = tools.interpolate(cv, axis=0) # Computing the geostrophic velocities - u_geos = - geo.GRAVITY * grad_ssh_y / cu - v_geos = geo.GRAVITY * grad_ssh_x / cv + u_geos = - tools.GRAVITY * grad_ssh_y / cu + v_geos = tools.GRAVITY * grad_ssh_x / cv return u_geos, v_geos diff --git a/jaxparrow/tools/__init__.py b/jaxparrow/tools/__init__.py index 94f5353..4bd3277 100644 --- a/jaxparrow/tools/__init__.py +++ b/jaxparrow/tools/__init__.py @@ -1,4 +1,4 @@ -from tools.tools import compute_coriolis_factor, compute_spatial_step -from tools import tools +from .tools import compute_coriolis_factor, compute_spatial_step +from . import tools __all__ = ["compute_coriolis_factor", "compute_spatial_step", "tools"]