Skip to content

Commit

Permalink
docs: add toctree for io subdirectory
Browse files Browse the repository at this point in the history
test: add quick test for currents wrapper function
  • Loading branch information
tsutterley committed Jan 18, 2024
1 parent 0b74d42 commit f4bee55
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 35 deletions.
9 changes: 5 additions & 4 deletions doc/source/api_reference/io/ATLAS.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
========
io.ATLAS
========
=====
ATLAS
=====

- Reads netCDF format tidal solutions provided by Ohio State University and ESR
- Spatially interpolates tidal constituents to input coordinates
Expand All @@ -12,7 +12,8 @@ Calling Sequence
import pyTMD.io
amp,ph,D,c = pyTMD.io.ATLAS.extract_constants(ilon, ilat, grid_file, model_files,
type='z', method='spline')
type='z',
method='spline')
`Source code`__

Expand Down
6 changes: 3 additions & 3 deletions doc/source/api_reference/io/FES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
======
io.FES
======
===
FES
===

- Reads files for Finite Element Solution (FES), Empirical Ocean Tide (EOT), and Hamburg direct data Assimilation Methods for Tides (HAMTIDE) models

Expand Down
8 changes: 4 additions & 4 deletions doc/source/api_reference/io/GOT.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
======
io.GOT
======
===
GOT
===

- Reads files for Richard Ray's Global Ocean Tide (GOT) models
- Spatially interpolates tidal constituents to input coordinates
Expand All @@ -11,7 +11,7 @@ Calling Sequence
.. code-block:: python
import pyTMD.io
amp,ph,c = pyTMD.io.GOT.extract_constants(ilon,i lat, model_files,
amp,ph,c = pyTMD.io.GOT.extract_constants(ilon, ilat, model_files,
method='spline')
`Source code`__
Expand Down
12 changes: 7 additions & 5 deletions doc/source/api_reference/io/OTIS.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=======
io.OTIS
=======
====
OTIS
====

- Reads OTIS format tidal solutions provided by Ohio State University and ESR

Expand All @@ -16,8 +16,10 @@ Calling Sequence
.. code-block:: python
import pyTMD.io
amp,ph,D,c = pyTMD.io.OTIS.extract_constants(ilon, ilat, grid_file, model_file,
EPSG, type='z', method='spline', grid='OTIS')
amp,ph,D,c = pyTMD.io.OTIS.extract_constants(ilon, ilat, grid_file, model_file, EPSG,
type='z',
method='spline',
grid='OTIS')
`Source code`__

Expand Down
6 changes: 3 additions & 3 deletions doc/source/api_reference/io/constituents.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===============
io.constituents
===============
============
constituents
============

Basic tide model constituent class

Expand Down
14 changes: 14 additions & 0 deletions doc/source/api_reference/io/io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
==
io
==

.. toctree::
:maxdepth: 1

ATLAS.rst
FES.rst
GOT.rst
OTIS.rst
constituents.rst
model.rst
ocean_pole_tide.rst
6 changes: 3 additions & 3 deletions doc/source/api_reference/io/model.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
========
io.model
========
=====
model
=====

Retrieves tide model parameters for named tide models and from model definition files

Expand Down
6 changes: 3 additions & 3 deletions doc/source/api_reference/io/ocean_pole_tide.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
==================
io.ocean_pole_tide
==================
===============
ocean_pole_tide
===============

- Reads ocean pole load tide coefficients provided by IERS as computed by `Desai et al. (2002) <https://doi.org/10.1029/2001JC001224>`_ and `Desai et al. (2015) <https://doi.org/10.1007/s00190-015-0848-7>`_
- See `materials from Chapter 7 of the IERS Conventions <https://webtai.bipm.org/iers/convupdt/convupdt_c7.html>`_
Expand Down
8 changes: 1 addition & 7 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ ocean, load, solid Earth and pole tides
api_reference/ellipse.rst
api_reference/eop.rst
api_reference/interpolate.rst
api_reference/io/ATLAS.rst
api_reference/io/FES.rst
api_reference/io/GOT.rst
api_reference/io/OTIS.rst
api_reference/io/constituents.rst
api_reference/io/model.rst
api_reference/io/ocean_pole_tide.rst
api_reference/io/io.rst
api_reference/predict.rst
api_reference/solve.rst
api_reference/spatial.rst
Expand Down
2 changes: 1 addition & 1 deletion pyTMD/load_constituent.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load_constituent(c):
.. __: https://doi.org/10.1175/1520-0426(2002)019<0183:EIMOBO>2.0.CO;2
"""
# raise warning for deprecated function call
warnings.warn("Deprecated. Please use pyTMD.predict instead",
warnings.warn("Deprecated. Please use pyTMD.arguments instead",
DeprecationWarning)
# call updated function to not break current workflows
return pyTMD.arguments._constituent_parameters(c)
4 changes: 2 additions & 2 deletions pyTMD/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def _generating_force(
c: str,
):
"""
Computes the astronomical tide generating force for a tidal
constituent [1]_
Computes the astronomical tide generating force (the horizontal gradient
of the tide generating potential) for a tidal constituent [1]_
Parameters
----------
Expand Down
24 changes: 24 additions & 0 deletions test/test_download_and_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import numpy as np
import pyTMD.io
import pyTMD.io.model
import pyTMD.compute
import pyTMD.predict
import pyTMD.time
import pyTMD.utilities
Expand Down Expand Up @@ -697,6 +698,29 @@ def test_Ross_Ice_Shelf(self, METHOD, EXTRAPOLATE):
EPSG=3031, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE)
assert np.any(tide)

# parameterize interpolation method
# only use fast interpolation routines
@pytest.mark.parametrize("METHOD", ['spline','nearest'])
@pytest.mark.parametrize("EXTRAPOLATE", [True])
# PURPOSE: test the tide currents wrapper function
def test_Ross_Ice_Shelf_currents(self, METHOD, EXTRAPOLATE):
# create a drift track along the Ross Ice Shelf
xlimits = np.array([-740000,520000])
ylimits = np.array([-1430000,-300000])
# x and y coordinates
x = np.linspace(xlimits[0],xlimits[1],24)
y = np.linspace(ylimits[0],ylimits[1],24)
# time dimension
delta_time = np.zeros((24))*3600
# calculate tide drift corrections
tide = pyTMD.compute.tide_currents(x, y, delta_time,
DIRECTORY=filepath, MODEL='CATS2008', GZIP=False,
EPOCH=pyTMD.time._j2000_epoch, TYPE='drift', TIME='UTC',
EPSG=3031, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE)
# iterate over zonal and meridional currents
for key,val in tide.items():
assert np.any(val)

# PURPOSE: test definition file functionality
@pytest.mark.parametrize("MODEL", ['CATS2008'])
def test_definition_file(self, MODEL):
Expand Down

0 comments on commit f4bee55

Please sign in to comment.