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
2 changes: 1 addition & 1 deletion doc/source/getting_started/Citations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Problem Reports
###############
If you have found a problem in these programs, or you would like to suggest
an improvement or modification, please submit a
`GitHub issue <https://github.com/tsutterley/read-GRACE-harhmonics/issues>`_
`GitHub issue <https://github.com/tsutterley/gravity-toolkit/issues>`_
and we will get back to you.

Dependencies
Expand Down
23 changes: 15 additions & 8 deletions doc/source/getting_started/Install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,35 @@ Installation
============

``gravity-toolkit`` is available for download from the `GitHub repository <https://github.com/tsutterley/gravity-toolkit>`_,
and the `Python Package Index (pypi) <https://pypi.org/project/gravity-toolkit/>`_,
The contents of the repository can be downloaded as a `zipped file <https://github.com/tsutterley/gravity-toolkit/archive/main.zip>`_ or cloned.
the `Python Package Index (pypi) <https://pypi.org/project/gravity-toolkit/>`_,
and from `conda-forge <https://anaconda.org/conda-forge/gravity-toolkit>`_.

To use this repository, please fork into your own account and then clone onto your system:

The simplest installation for most users will likely be using ``conda`` or ``mamba``:

.. code-block:: bash

git clone https://github.com/tsutterley/gravity-toolkit.git
conda install -c conda-forge gravity-toolkit

Can then install using ``setuptools``:
``conda`` installed versions of ``gravity-toolkit`` can be upgraded to the latest stable release:

.. code-block:: bash

python3 setup.py install
conda update gravity-toolkit

To use the development repository, please fork ``gravity-toolkit`` into your own account and then clone onto your system:

.. code-block:: bash

git clone https://github.com/tsutterley/gravity-toolkit.git

or ``pip``
``gravity-toolkit`` can then be installed within the package directory using ``pip``:

.. code-block:: bash

python3 -m pip install --user .

Alternatively can install the ``gravity_toolkit`` utilities directly from GitHub with ``pip``:
The development version of ``gravity-toolkit`` can also be installed directly from GitHub using ``pip``:

.. code-block:: bash

Expand Down
7 changes: 5 additions & 2 deletions gravity_toolkit/gen_stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
and filters the GRACE/GRACE-FO coefficients for striping errors

UPDATE HISTORY:
Updated 06/2025: copy latitude and longitude as float64 for numpy 2.0 stability
Updated 04/2023: allow love numbers to be None for custom units case
Updated 03/2023: improve typing for variables in docstrings
Updated 02/2023: set custom units as top option in if/else statements
Expand Down Expand Up @@ -136,11 +137,13 @@ def gen_stokes(data, lon, lat, LMIN=0, LMAX=60, MMAX=None, UNITS=1,
# colatitude degree spacing in radians
dth = dlat*np.pi/180.0

# convert latitude and longitude to float if integers
lon = lon.astype(np.float64)
lat = lat.astype(np.float64)
# reformatting longitudes to range 0:360 (if previously -180:180)
lon = np.squeeze(lon.copy())
if np.any(lon < 0):
lon_ind, = np.nonzero(lon < 0)
lon[lon_ind] += 360.0
lon[lon < 0] += 360.0
# Longitude in radians
phi = lon[np.newaxis,:]*np.pi/180.0
# Colatitude in radians
Expand Down
13 changes: 9 additions & 4 deletions gravity_toolkit/sea_level_equation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
u"""
sea_level_equation.py (03/2023)
sea_level_equation.py (06/2025)
Solves the sea level equation with the option of including polar motion feedback
Uses a Clenshaw summation to calculate the spherical harmonic summation

Expand Down Expand Up @@ -32,6 +32,7 @@
2: Munk and MacDonald (1960) fluid love number
3: Lambeck (1980) fluid love number
list or tuple: custom value (klf)
DENSITY: Density of water [g/cm^3]
POLAR: Include polar feedback
ITERATIONS: maximum number of iterations for the solver
PLM: input Legendre polynomials
Expand Down Expand Up @@ -90,6 +91,7 @@
https://doi.org/10.1029/JB090iB11p09363

UPDATE HISTORY:
Updated 06/2025: added option to set the density of sea water (g/cm^3)
Updated 03/2023: improve typing for variables in docstrings
Updated 01/2023: refactored associated legendre polynomials
Updated 11/2022: use f-strings for formatting verbose or ascii output
Expand Down Expand Up @@ -128,8 +130,9 @@

# PURPOSE: Computes Sea Level Fingerprints including polar motion feedback
def sea_level_equation(loadClm, loadSlm, glon, glat, land_function, LMAX=0,
LOVE=None, BODY_TIDE_LOVE=0, FLUID_LOVE=0, POLAR=True, ITERATIONS=6,
PLM=None, FILL_VALUE=0, ASTYPE=np.longdouble, SCALE=1e-280, **kwargs):
LOVE=None, BODY_TIDE_LOVE=0, FLUID_LOVE=0, DENSITY=1.0, POLAR=True,
ITERATIONS=6, PLM=None, FILL_VALUE=0, ASTYPE=np.longdouble, SCALE=1e-280,
**kwargs):
"""
Solves the sea level equation with the option of including
polar motion feedback :cite:p:`Farrell:1976hm,Kendall:2005ds,Mitrovica:2003cq`
Expand Down Expand Up @@ -167,6 +170,8 @@ def sea_level_equation(loadClm, loadSlm, glon, glat, land_function, LMAX=0,
- ``2``: :cite:p:`Munk:1960uk` fluid love number
- ``3``: :cite:p:`Lambeck:1980um` fluid love number
- list or tuple: custom value ``(klf)``
DENSITY: float, default 1.0
Density of water [g/cm\ :sup:`3`]
POLAR: bool, default True
Include polar feedback
ITERATIONS: int, default 6
Expand Down Expand Up @@ -199,7 +204,7 @@ def sea_level_equation(loadClm, loadSlm, glon, glat, land_function, LMAX=0,
# extract arrays of kl, hl, and ll Love Numbers
hl,kl,ll = LOVE
# density of water [g/cm^3]
rho_water = 1.0
rho_water = np.float64(DENSITY)
# Earth Parameters
factors = units(lmax=LMAX)
# Average Density of the Earth [g/cm^3]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ boto3
future
lxml
matplotlib
netCDF4
numpy
python-dateutil
pyyaml
Expand Down
9 changes: 6 additions & 3 deletions scripts/convert_harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,17 @@ def arguments():
parser.add_argument('--reference',
type=str.upper, default='CF', choices=['CF','CM','CE'],
help='Reference frame for load Love numbers')
# output units
# input units
# 1: cm of water thickness (cmwe)
# 2: Gigatonnes (Gt)
# 3: mm of water thickness kg/m^2
parser.add_argument('--units','-U',
type=int, default=1, choices=[1,2,3],
help='Output units')
help='Input units of spatial fields')
# output grid parameters
parser.add_argument('--spacing','-S',
type=float, nargs='+', default=[0.5,0.5], metavar=('dlon','dlat'),
help='Spatial resolution of output data')
help='Spatial resolution of input data')
parser.add_argument('--interval','-I',
type=int, default=2, choices=[1,2],
help='Input grid interval (1: global, 2: centered global)')
Expand Down
Loading
Loading