model
Retrieves tide model parameters for named tide models and from model definition files
General Attributes and Methods
- pyTMD.io.load_database(extra_databases: list = [])[source]
Load the JSON database of model files
- Parameters:
- extra_databases: list, default []
A list of additional databases to load, as either JSON file paths or dictionaries
- Returns:
- parameters: dict
Database of model parameters
- class pyTMD.io.model(directory: str | Path | None = None, **kwargs)[source]
Retrieves tide model parameters for named models or from a model definition file for use in the pyTMD tide prediction programs
- Attributes:
- atl03: str
HDF5 dataset string for output ATL03 tide heights
- atl06: str
HDF5 dataset string for output ATL06 tide heights
- atl07: str
HDF5 dataset string for output ATL07 tide heights
- atl10: str
HDF5 dataset string for output ATL10 tide heights
- atl11: str
HDF5 dataset string for output ATL11 tide heights
- atl12: str
HDF5 dataset string for output ATL12 tide heights
- compressed: bool
Model files are gzip compressed
- constituents: list or None
Model constituents for
FES
models- description: str
HDF5
description
attribute string for output tide heights- directory: str, pathlib.Path or None, default None
Working data directory for tide models
- extra_databases: list, default []
Additional databases for model parameters
- file_format: str
File format for model
- flexure: bool
Flexure adjustment field for tide heights is available
- format: str
Model format
OTIS
ATLAS-compact
TMD3
ATLAS-netcdf
GOT-ascii
GOT-netcdf
FES-ascii
FES-netcdf
- gla12: str
HDF5 dataset string for output GLA12 tide heights
- grid_file: pathlib.Path
Model grid file for
OTIS
,ATLAS-compact
,ATLAS-netcdf
, andTMD3
models- gzip: bool
Suffix if model is compressed
- long_name: str
HDF5
long_name
attribute string for output tide heights- minor: list or None
Minor constituents for inference
- model_file: pathlib.Path or list
Model constituent file or list of files
- name: str
Model name
- projection: str
Model projection for
OTIS
,ATLAS-compact
andTMD3
models- scale: float
Model scaling factor for converting to output units
- type: str
Model type
z
u
v
- verify: bool
Verify that all model files exist
- version: str
Tide model version
- elevation(m: str)[source]
Create a model object from known tidal elevation models
- Parameters:
- m: str
model name
- current(m: str)[source]
Create a model object from known tidal current models
- Parameters:
- m: str
model name
- property gzip: str
Returns suffix for gzip compression
- property corrections: str
Returns the corrections type for the model
- property file_format: str
Returns the file format for the model
- property atl03: str
Returns ICESat-2 ATL03 attribute string for a given variable
- property atl06: str
Returns ICESat-2 ATL06 attribute string for a given variable
- property atl07: str
Returns ICESat-2 ATL07 attribute string for a given variable
- property atl10: str
Returns ICESat-2 ATL07 attribute string for a given variable
- property atl11: str
Returns ICESat-2 ATL11 attribute string for a given variable
- property atl12: str
Returns ICESat-2 ATL12 attribute string for a given variable
- property gla12: str
Returns ICESat GLA12 attribute string for a given variable
- property long_name: str
Returns
long_name
attribute string for a given variable
- property description: str
Returns
description
attribute string for a given variable
- pathfinder(model_file: str | Path | list)[source]
Completes file paths and appends gzip suffix
- Parameters:
- model_file: str, pathlib.Path or list
model file(s) to complete
- from_file(definition_file: str | Path | IOBase, **kwargs)[source]
Create a model object from an input definition file
- Parameters:
- definition_file: str, pathlib.Path or io.IOBase
model definition file for creating model object
- from_dict(d: dict)[source]
Create a model object from a python dictionary
- Parameters:
- d: dict
Python dictionary for creating model object
- to_dict(**kwargs)[source]
Create a python dictionary from a model object
- Parameters:
- fields: list, default all
List of model attributes to output
- serialize: bool, default False
Serialize dictionary for JSON output
- serialize(d: dict)[source]
Encodes dictionary to be JSON serializable
- Parameters:
- d: dict
Python dictionary to serialize
- parse_constituents(**kwargs) list [source]
Parses tide model files for a list of model constituents
- static parse_file(model_file: str | Path, raise_error: bool = False)[source]
Parses a model file for a tidal constituent name
- Parameters:
- model_file: str or pathlib.Path
Tide model file to parse
- raise_error: bool, default False
Raise exception if constituent is not found in file name
- Returns:
- constituent: str or list
constituent name
- reduce_constituents(constituents: str | list)[source]
Reduce model files to a subset of constituents
- Parameters:
- constituents: str or list
List of constituents names
- extract_constants(lon: ndarray, lat: ndarray, **kwargs)[source]
Interpolate constants from tide models to input coordinates
- Parameters:
- lon: np.ndarray
Longitude point in degrees
- lat: np.ndarray
Latitude point in degrees
- append_node: bool, default False
Append equilibrium amplitudes for node tides
- **kwargs: dict
Keyword arguments for extracting constants
- Returns:
- amp: np.ndarray
Tidal amplitude
- ph: np.ndarray
Tidal phase in degrees
- c: list
Constituent list
- read_constants(**kwargs)[source]
Read constants from tide models
- Parameters:
- append_node: bool, default False
Append equilibrium amplitudes for node tides
- **kwargs: dict
Keyword arguments for reading constants
- interpolate_constants(lon: ndarray, lat: ndarray, **kwargs)[source]
Interpolate tidal constants to input coordinates
- Parameters:
- lon: np.ndarray
Longitude point in degrees
- lat: np.ndarray
Latitude point in degrees
- **kwargs: dict
Keyword arguments for interpolating constants
- Returns:
- amp: np.ndarray
Tidal amplitude in meters
- ph: np.ndarray
Tidal phase in degrees
- pyTMD.io.extract_constants(lon: ndarray, lat: ndarray, m, **kwargs)[source]
Interpolate constants from tide models to input coordinates
- Parameters:
- lon: np.ndarray
Longitude point in degrees
- lat: np.ndarray
Latitude point in degrees
- m: obj
model
class object- **kwargs: dict
Keyword arguments for extracting constants
- Returns:
- amp: np.ndarray
Tidal amplitude in meters
- ph: np.ndarray
Tidal phase in degrees
- c: list
Constituent list
- pyTMD.io.read_constants(m, **kwargs)[source]
Read constants from tide models
- Parameters:
- m: obj
model
class object- **kwargs: dict
Keyword arguments for reading constants
- Returns:
- c: obj
constituents
class object
- pyTMD.io.interpolate_constants(lon: ndarray, lat: ndarray, m, **kwargs)[source]
Interpolate tidal constants to input coordinates
- Parameters:
- lon: np.ndarray
Longitude point in degrees
- lat: np.ndarray
Latitude point in degrees
- m: obj
model
class object- **kwargs: dict
Keyword arguments for extracting constants
- Returns:
- amp: np.ndarray
Tidal amplitude in meters
- ph: np.ndarray
Tidal phase in degrees