From c1b7c7e37c7392a9161d0915b5580d0491f20264 Mon Sep 17 00:00:00 2001 From: Tyler Sutterley Date: Fri, 12 Jan 2024 07:18:41 +1300 Subject: [PATCH] refactor: implicit import of arguments --- doc/source/api_reference/arguments.rst | 8 ++++---- pyTMD/__init__.py | 6 +----- pyTMD/predict.py | 25 +++++++++++++++++-------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/doc/source/api_reference/arguments.rst b/doc/source/api_reference/arguments.rst index cefb71e0..ac50cec2 100644 --- a/doc/source/api_reference/arguments.rst +++ b/doc/source/api_reference/arguments.rst @@ -11,18 +11,18 @@ Calling Sequence .. code-block:: python import pyTMD.arguments - pu,pf,G = pyTMD.arguments(MJD, constituents, + pu,pf,G = pyTMD.arguments.arguments(MJD, constituents, deltat=DELTAT, corrections=CORRECTIONS) `Source code`__ .. __: https://github.com/tsutterley/pyTMD/blob/main/pyTMD/arguments.py -.. autofunction:: pyTMD.arguments +.. autofunction:: pyTMD.arguments.arguments -.. autofunction:: pyTMD.minor_arguments +.. autofunction:: pyTMD.arguments.minor_arguments -.. autofunction:: pyTMD.doodson_number +.. autofunction:: pyTMD.arguments.doodson_number .. autofunction:: pyTMD.arguments._arguments_table diff --git a/pyTMD/__init__.py b/pyTMD/__init__.py index 642d9a4c..55141db0 100644 --- a/pyTMD/__init__.py +++ b/pyTMD/__init__.py @@ -11,6 +11,7 @@ Documentation is available at https://pytmd.readthedocs.io """ +import pyTMD.arguments import pyTMD.astro import pyTMD.eop import pyTMD.interpolate @@ -22,11 +23,6 @@ import pyTMD.utilities import pyTMD.version from pyTMD import io -from pyTMD.arguments import ( - arguments, - minor_arguments, - doodson_number -) from pyTMD.check_points import check_points from pyTMD.compute_tide_corrections import ( compute_corrections, diff --git a/pyTMD/predict.py b/pyTMD/predict.py index 1c23834d..b4767769 100644 --- a/pyTMD/predict.py +++ b/pyTMD/predict.py @@ -45,8 +45,8 @@ from __future__ import annotations import numpy as np +import pyTMD.arguments import pyTMD.astro -from pyTMD.arguments import arguments, minor_arguments from pyTMD.constants import constants # PURPOSE: Predict tides at single times @@ -90,8 +90,11 @@ def map(t: float | np.ndarray, npts, nc = np.shape(hc) # load the nodal corrections # convert time to Modified Julian Days (MJD) - pu, pf, G = arguments(t + 48622.0, constituents, - deltat=deltat, corrections=corrections) + pu, pf, G = pyTMD.arguments.arguments(t + 48622.0, + constituents, + deltat=deltat, + corrections=corrections + ) # allocate for output tidal elevation ht = np.ma.zeros((npts)) ht.mask = np.zeros((npts), dtype=bool) @@ -152,8 +155,11 @@ def drift(t: float | np.ndarray, nt = len(t) # load the nodal corrections # convert time to Modified Julian Days (MJD) - pu, pf, G = arguments(t + 48622.0, constituents, - deltat=deltat, corrections=corrections) + pu, pf, G = pyTMD.arguments.arguments(t + 48622.0, + constituents, + deltat=deltat, + corrections=corrections + ) # allocate for output time series ht = np.ma.zeros((nt)) ht.mask = np.zeros((nt), dtype=bool) @@ -214,8 +220,11 @@ def time_series(t: float | np.ndarray, nt = len(t) # load the nodal corrections # convert time to Modified Julian Days (MJD) - pu, pf, G = arguments(t + 48622.0, constituents, - deltat=deltat, corrections=corrections) + pu, pf, G = pyTMD.arguments.arguments(t + 48622.0, + constituents, + deltat=deltat, + corrections=corrections + ) # allocate for output time series ht = np.ma.zeros((nt)) ht.mask = np.zeros((nt), dtype=bool) @@ -354,7 +363,7 @@ def infer_minor( # load the nodal corrections for minor constituents # convert time to Modified Julian Days (MJD) - pu, pf, G = minor_arguments(t + 48622.0, + pu, pf, G = pyTMD.arguments.minor_arguments(t + 48622.0, deltat=kwargs['deltat'], corrections=kwargs['corrections'] )