Skip to content

Commit

Permalink
fix: remove default bounds being None for #356 (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutterley authored Oct 30, 2024
1 parent 2276154 commit 5c4bca1
Showing 1 changed file with 9 additions and 36 deletions.
45 changes: 9 additions & 36 deletions pyTMD/io/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
UPDATE HISTORY:
Updated 10/2024: add wrapper functions to read and interpolate constants
add functions to append node tide equilibrium values to amplitudes
remove redundant default keyword arguments to readers and interpolators
Updated 09/2024: use JSON database for known model parameters
drop support for the ascii definition file format
add file_format and nodal correction attributes
Expand Down Expand Up @@ -997,12 +998,7 @@ def extract_constants(self,
# set default keyword arguments
kwargs.setdefault('type', self.type)
kwargs.setdefault('append_node', False)
kwargs.setdefault('crop', False)
kwargs.setdefault('bounds', None)
kwargs.setdefault('method', 'spline')
kwargs.setdefault('extrapolate', False)
kwargs.setdefault('cutoff', None)
kwargs.setdefault('apply_flexure', False)
kwargs.setdefault('scale', self.scale)
# read tidal constants and interpolate to grid points
if self.format in ('OTIS', 'ATLAS-compact', 'TMD3'):
# extract model file in case of currents
Expand All @@ -1023,14 +1019,13 @@ def extract_constants(self,
model_file = self.model_file
# extract tidal constants for model type
amp,ph,D,c = ATLAS.extract_constants(lon, lat,
self.grid_file, model_file, scale=self.scale,
self.grid_file, model_file,
compressed=self.compressed, **kwargs)
elif self.format in ('GOT-ascii', 'GOT-netcdf'):
# extract tidal constants for model type
amp,ph,c = GOT.extract_constants(lon, lat,
self.model_file, grid=self.file_format,
scale=self.scale, compressed=self.compressed,
**kwargs)
compressed=self.compressed, **kwargs)
elif self.format in ('FES-ascii', 'FES-netcdf'):
# extract model file in case of currents
if isinstance(self.model_file, dict):
Expand All @@ -1041,8 +1036,7 @@ def extract_constants(self,
# extract tidal constants for model type
amp,ph = FES.extract_constants(lon, lat,
self.model_file, version=self.version,
scale=self.scale, compressed=self.compressed,
**kwargs)
compressed=self.compressed, **kwargs)
# available model constituents
c = self.constituents
# append node equilibrium tide if not in constituents list
Expand Down Expand Up @@ -1073,9 +1067,6 @@ def read_constants(self, **kwargs):
# set default keyword arguments
kwargs.setdefault('type', self.type)
kwargs.setdefault('append_node', False)
kwargs.setdefault('crop', False)
kwargs.setdefault('bounds', None)
kwargs.setdefault('apply_flexure', False)
# read tidal constants
if self.format in ('OTIS','ATLAS-compact','TMD3'):
# extract model file in case of currents
Expand Down Expand Up @@ -1159,9 +1150,7 @@ def interpolate_constants(self,
from pyTMD.io import OTIS, ATLAS, GOT, FES
# set default keyword arguments
kwargs.setdefault('type', self.type)
kwargs.setdefault('method', 'spline')
kwargs.setdefault('extrapolate', False)
kwargs.setdefault('cutoff', 10.0)
kwargs.setdefault('scale', self.scale)
# verify constituents have been read
if not hasattr(self, '_constituents'):
self.read_constants(**kwargs)
Expand All @@ -1171,16 +1160,13 @@ def interpolate_constants(self,
self._constituents, **kwargs)
elif self.format in ('ATLAS-netcdf',):
amp,ph,D = ATLAS.interpolate_constants(lon, lat,
self._constituents, scale=self.scale,
**kwargs)
self._constituents, **kwargs)
elif self.format in ('GOT-ascii','GOT-netcdf'):
amp,ph = GOT.interpolate_constants(lon, lat,
self._constituents, scale=self.scale,
**kwargs)
self._constituents, **kwargs)
elif self.format in ('FES-ascii','FES-netcdf'):
amp,ph = FES.interpolate_constants(lon, lat,
self._constituents, scale=self.scale,
**kwargs)
self._constituents, **kwargs)
# return the amplitude and phase
return (amp, ph)

Expand Down Expand Up @@ -1272,12 +1258,6 @@ def extract_constants(lon: np.ndarray, lat: np.ndarray, m, **kwargs):
assert isinstance(m, model)
# set default keyword arguments
kwargs.setdefault('type', m.type)
kwargs.setdefault('crop', False)
kwargs.setdefault('bounds', None)
kwargs.setdefault('method', 'spline')
kwargs.setdefault('extrapolate', False)
kwargs.setdefault('cutoff', None)
kwargs.setdefault('apply_flexure', False)
# extract tidal constants
amp, ph, c = m.extract_constants(lon, lat, **kwargs)
# return the amplitude, phase, and constituents
Expand All @@ -1303,9 +1283,6 @@ def read_constants(m, **kwargs):
assert isinstance(m, model)
# set default keyword arguments
kwargs.setdefault('type', m.type)
kwargs.setdefault('crop', False)
kwargs.setdefault('bounds', None)
kwargs.setdefault('apply_flexure', False)
# read tidal constants
m.read_constants(**kwargs)
# return the tidal constituents
Expand Down Expand Up @@ -1333,10 +1310,6 @@ def interpolate_constants(lon: np.ndarray, lat: np.ndarray, m, **kwargs):
ph: np.ndarray
Tidal phase in degrees
"""
# set default keyword arguments
kwargs.setdefault('method', 'spline')
kwargs.setdefault('extrapolate', False)
kwargs.setdefault('cutoff', None)
# extract tidal constants
amp, ph = m.interpolate_constants(lon, lat, **kwargs)
# return the amplitude and phase
Expand Down

0 comments on commit 5c4bca1

Please sign in to comment.