Skip to content

Commit

Permalink
fix: MEEUS solar perigee rate to address #117 (#118)
Browse files Browse the repository at this point in the history
fix: slimmer doc build
  • Loading branch information
tsutterley authored Nov 1, 2022
1 parent 4933f72 commit 53bd988
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 33 deletions.
2 changes: 0 additions & 2 deletions doc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ dependencies:
- graphviz
- lxml
- matplotlib
- netCDF4
- notebook
- numpy
- numpydoc
- pip
- pyproj
- python>=3.6
- python-dateutil
- pyyaml
Expand Down
5 changes: 3 additions & 2 deletions pyTMD/calc_astrol_longitudes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
u"""
calc_astrol_longitudes.py (04/2022)
calc_astrol_longitudes.py (10/2022)
Modification of ASTROL fortran subroutine by Richard Ray 03/1999
Computes the basic astronomical mean longitudes: s, h, p, N and PP
Expand Down Expand Up @@ -35,6 +35,7 @@
Jean Meeus, Astronomical Algorithms, 2nd edition, 1998.
UPDATE HISTORY:
Updated 10/2022: fix MEEUS solar perigee rate
Updated 04/2022: updated docstrings to numpy documentation format
Updated 08/2020: change time variable names to not overwrite functions
Updated 07/2020: added function docstrings
Expand Down Expand Up @@ -118,7 +119,7 @@ def calc_astrol_longitudes(MJD, MEEUS=False, ASTRO5=False):
1.55628359e-12, 4.390675353e-20, -9.26940435e-27])
N = polynomial_sum(lunar_node,T)
# mean longitude of solar perigee (Simon et al., 1994)
PP = 282.94 + 1.7192 * T
PP = 282.94 + 1.7192 * T / 36525.0
elif ASTRO5:
# convert from MJD to centuries relative to 2000-01-01T12:00:00
T = (MJD - 51544.5)/36525.0
Expand Down
15 changes: 13 additions & 2 deletions pyTMD/check_tide_points.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
check_tide_points.py
Written by Tyler Sutterley (05/2022)
Written by Tyler Sutterley (11/2022)
Check if points are within a tide model domain
OTIS format tidal solutions provided by Ohio State University and ESR
Expand Down Expand Up @@ -52,6 +52,7 @@
bilinear_interp.py: bilinear interpolation of data to coordinates
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 05/2022: added ESR netCDF4 formats to list of model types
updated keyword arguments to read tide model programs
Updated 04/2022: updated docstrings to numpy documentation format
Expand All @@ -63,7 +64,7 @@
from __future__ import print_function

import os
import pyproj
import warnings
import numpy as np
import scipy.interpolate
import pyTMD.model
Expand All @@ -74,6 +75,16 @@
import pyTMD.read_FES_model
from pyTMD.bilinear_interp import bilinear_interp

# attempt imports
try:
import pyproj
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("pyproj not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: compute tides at points and times using tide model algorithms
def check_tide_points(x, y, DIRECTORY=None, MODEL=None,
ATLAS_FORMAT='netcdf', GZIP=False, DEFINITION_FILE=None,
Expand Down
15 changes: 13 additions & 2 deletions pyTMD/compute_tide_corrections.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
compute_tide_corrections.py
Written by Tyler Sutterley (05/2022)
Written by Tyler Sutterley (11/2022)
Calculates tidal elevations for correcting elevation or imagery data
Uses OTIS format tidal solutions provided by Ohio State University and ESR
Expand Down Expand Up @@ -79,6 +79,7 @@
nearest_extrap.py: nearest-neighbor extrapolation of data to coordinates
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 05/2022: added ESR netCDF4 formats to list of model types
updated keyword arguments to read tide model programs
added option to apply flexure to heights for applicable models
Expand Down Expand Up @@ -109,7 +110,7 @@
from __future__ import print_function

import os
import pyproj
import warnings
import numpy as np
import pyTMD.time
import pyTMD.model
Expand All @@ -125,6 +126,16 @@
from pyTMD.read_GOT_model import extract_GOT_constants
from pyTMD.read_FES_model import extract_FES_constants

# attempt imports
try:
import pyproj
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("pyproj not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: compute tides at points and times using tide model algorithms
def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None,
ATLAS_FORMAT='netcdf', GZIP=False, DEFINITION_FILE=None, EPSG=3031,
Expand Down
15 changes: 13 additions & 2 deletions pyTMD/convert_ll_xy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
convert_ll_xy.py
Written by Tyler Sutterley (04/2022)
Written by Tyler Sutterley (11/2022)
Wrapper function to convert lat/lon points to and from projected coordinates
CALLING SEQUENCE:
Expand Down Expand Up @@ -30,6 +30,7 @@
https://pyproj4.github.io/pyproj/
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 04/2022: updated docstrings to numpy documentation format
Updated 09/2021: added function for using custom projections
Updated 06/2021: added 3413 for new 1km Greenland model from ESR
Expand All @@ -40,8 +41,18 @@
Updated 11/2019: using pyproj for coordinate conversions
Written 09/2017
"""
import warnings
import numpy as np
import pyproj

# attempt imports
try:
import pyproj
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("pyproj not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

def convert_ll_xy(i1,i2,PROJ,BF,EPSG=4326):
"""
Expand Down
14 changes: 12 additions & 2 deletions pyTMD/read_FES_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
u"""
read_FES_model.py (05/2022)
read_FES_model.py (11/2022)
Reads files for a tidal model and makes initial calculations to run tide program
Includes functions to extract tidal harmonic constants from the
FES (Finite Element Solution) tide models for given locations
Expand Down Expand Up @@ -54,6 +54,7 @@
nearest_extrap.py: nearest-neighbor extrapolation of data to coordinates
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 05/2022: reformat arguments to extract_FES_constants definition
changed keyword arguments to camel case
Updated 04/2022: updated docstrings to numpy documentation format
Expand Down Expand Up @@ -81,13 +82,22 @@
import copy
import gzip
import uuid
import netCDF4
import warnings
import numpy as np
import scipy.interpolate
from pyTMD.bilinear_interp import bilinear_interp
from pyTMD.nearest_extrap import nearest_extrap

# attempt imports
try:
import netCDF4
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("netCDF4 not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: extract tidal harmonic constants from tide models at coordinates
def extract_FES_constants(ilon, ilat, model_files=None, **kwargs):
"""
Expand Down
14 changes: 12 additions & 2 deletions pyTMD/read_netcdf_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
u"""
read_netcdf_model.py (07/2022)
read_netcdf_model.py (11/2022)
Reads files for a tidal model and makes initial calculations to run tide program
Includes functions to extract tidal harmonic constants from OTIS tide models for
given locations
Expand Down Expand Up @@ -54,6 +54,7 @@
nearest_extrap.py: nearest-neighbor extrapolation of data to coordinates
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 07/2022: fix setting of masked array data to NaN
Updated 05/2022: reformat arguments to extract_netcdf_constants definition
changed keyword arguments to camel case
Expand Down Expand Up @@ -84,13 +85,22 @@
import copy
import gzip
import uuid
import netCDF4
import warnings
import numpy as np
import scipy.interpolate
from pyTMD.bilinear_interp import bilinear_interp
from pyTMD.nearest_extrap import nearest_extrap

# attempt imports
try:
import netCDF4
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("netCDF4 not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: extract tidal harmonic constants from tide models at coordinates
def extract_netcdf_constants(ilon, ilat,
grid_file=None,
Expand Down
14 changes: 12 additions & 2 deletions pyTMD/read_tide_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
u"""
read_tide_model.py (10/2022)
read_tide_model.py (11/2022)
Reads files for a tidal model and makes initial calculations to run tide program
Includes functions to extract tidal harmonic constants from OTIS tide models for
given locations
Expand Down Expand Up @@ -58,6 +58,7 @@
nearest_extrap.py: nearest-neighbor extrapolation of data to coordinates
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 10/2022: invert current tide masks to be True for invalid points
Updated 06/2022: unit updates in the ESR netCDF4 format
Updated 05/2022: add functions for using ESR netCDF4 format models
Expand Down Expand Up @@ -100,14 +101,23 @@
"""
import os
import copy
import netCDF4
import warnings
import numpy as np
import scipy.interpolate
from pyTMD.convert_ll_xy import convert_ll_xy
from pyTMD.bilinear_interp import bilinear_interp
from pyTMD.nearest_extrap import nearest_extrap

# attempt imports
try:
import netCDF4
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("netCDF4 not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: extract tidal harmonic constants from tide models at coordinates
def extract_tidal_constants(ilon, ilat,
grid_file=None,
Expand Down
10 changes: 8 additions & 2 deletions pyTMD/spatial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
spatial.py
Written by Tyler Sutterley (10/2022)
Written by Tyler Sutterley (11/2022)
Utilities for reading, writing and operating on spatial data
Expand All @@ -19,6 +19,7 @@
https://github.com/yaml/pyyaml
UPDATE HISTORY:
Updated 11/2022: place some imports within try/except statements
Updated 10/2022: added datetime parser for ascii time columns
Updated 06/2022: added field_mapping options to netCDF4 and HDF5 reads
added from_file wrapper function to read from particular formats
Expand Down Expand Up @@ -53,7 +54,6 @@
import uuid
import yaml
import logging
import netCDF4
import datetime
import warnings
import numpy as np
Expand All @@ -71,6 +71,12 @@
warnings.filterwarnings("always")
warnings.warn("h5py not available")
warnings.warn("Some functions will throw an exception if called")
try:
import netCDF4
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("netCDF4 not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

Expand Down
10 changes: 8 additions & 2 deletions pyTMD/tools.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
tools.py
Written by Tyler Sutterley (08/2022)
Written by Tyler Sutterley (11/2022)
Jupyter notebook, user interface and plotting tools
PYTHON DEPENDENCIES:
Expand All @@ -17,6 +17,7 @@
https://github.com/matplotlib/matplotlib
UPDATE HISTORY:
Updated 11/2022: place more imports within try/except statements
Updated 08/2022: place some imports behind try/except statements
Updated 05/2022: include world copy jump in webmercator maps
Updated 03/2022: add marker relocation routines from notebooks
Expand All @@ -27,7 +28,6 @@
import os
import copy
import base64
import pyproj
import datetime
import warnings
import numpy as np
Expand Down Expand Up @@ -60,6 +60,12 @@
warnings.filterwarnings("always")
warnings.warn("ipywidgets not available")
warnings.warn("Some functions will throw an exception if called")
try:
import pyproj
except (ImportError, ModuleNotFoundError) as e:
warnings.filterwarnings("always")
warnings.warn("pyproj not available")
warnings.warn("Some functions will throw an exception if called")
# ignore warnings
warnings.filterwarnings("ignore")

Expand Down
Loading

0 comments on commit 53bd988

Please sign in to comment.