Tidal Models#
Tidal models store the harmonic constants (amplitude and phase) on a
computational grid. A model is loaded once at startup and then passed to
evaluate_tide() for interpolation at arbitrary coordinates.
Three grid types are available, each templated on the value precision:
Cartesian - regular latitude/longitude grids (e.g. individual FES constituent NetCDF files).
LGP1 - unstructured triangular meshes with first-order (P1) elements.
LGP2 - unstructured triangular meshes with second-order (P2) elements, the native format of the FES2022 ocean-tide model.
The Complex128 variants use double-precision complex numbers
(complex128); Complex64 variants use single-precision (complex64).
Axis#
- class pyfes.core.Axis#
A coordinate axis a variable that specifies one of the coordinates of a variable’s values.
- end(self: pyfes.core.Axis) float#
Return the last value of the axis.
- find_index(self: pyfes.core.Axis, value: SupportsFloat, bounded: bool = True) int#
Find the index of the axis point closest to the given value.
- Parameters:
value – The value to find the index for.
bounded – If true, the index will be bounded by the axis domain.
- Returns:
The index of the axis point closest to the given value.
- find_indices(self: pyfes.core.Axis, values: SupportsFloat) tuple[int, int] | None#
Find the indices of the axis points closest to the given values.
- Parameters:
values – The values to find the indices for.
- Returns:
The indices of the axis points closest to the given values.
- property is_ascending#
Return true if the axis is ascending.
- property is_periodic#
Return true if the axis is periodic
- max_value(self: pyfes.core.Axis) float#
Return the maximum value of the axis.
- min_value(self: pyfes.core.Axis) float#
Return the minimum value of the axis.
- property start#
Return the first value of the axis.
- property step#
Return the step of the axis.
Cartesian#
- class pyfes.core.tidal_model.CartesianComplex128#
A tidal model that uses a Cartesian grid to store the wave models.
- lat(self: pyfes.core.tidal_model.CartesianComplex128) pyfes.core.Axis#
Get the latitude axis.
- Returns:
The latitude axis.
- lon(self: pyfes.core.tidal_model.CartesianComplex128) pyfes.core.Axis#
Get the longitude axis.
- Returns:
The longitude axis.
- resample(self: pyfes.core.tidal_model.CartesianComplex128, origin_lon: pyfes.core.Axis, origin_lat: pyfes.core.Axis, wave: Annotated[numpy.typing.ArrayLike, numpy.complex128, '[m, 1]'], row_major: bool = True, num_threads: SupportsInt = 0) Annotated[numpy.typing.NDArray[numpy.complex128], '[m, 1]']#
Resample a tidal constituent wave to this model’s grid using bilinear interpolation.
- Parameters:
origin_lon – The longitude axis of the original grid.
origin_lat – The latitude axis of the original grid.
wave – The wave to resample.
row_major – Whether the input wave is stored in longitude-major order.
num_threads – The number of threads to use. If 0, the number of threads is determined by the number of cores.
- Returns:
A vector containing the resampled wave on this model’s grid.
- class pyfes.core.tidal_model.CartesianComplex64#
A tidal model that uses a Cartesian grid to store the wave models.
- lat(self: pyfes.core.tidal_model.CartesianComplex64) pyfes.core.Axis#
Get the latitude axis.
- Returns:
The latitude axis.
- lon(self: pyfes.core.tidal_model.CartesianComplex64) pyfes.core.Axis#
Get the longitude axis.
- Returns:
The longitude axis.
- resample(self: pyfes.core.tidal_model.CartesianComplex64, origin_lon: pyfes.core.Axis, origin_lat: pyfes.core.Axis, wave: Annotated[numpy.typing.ArrayLike, numpy.complex64, '[m, 1]'], row_major: bool = True, num_threads: SupportsInt = 0) Annotated[numpy.typing.NDArray[numpy.complex64], '[m, 1]']#
Resample a tidal constituent wave to this model’s grid using bilinear interpolation.
- Parameters:
origin_lon – The longitude axis of the original grid.
origin_lat – The latitude axis of the original grid.
wave – The wave to resample.
row_major – Whether the input wave is stored in longitude-major order.
num_threads – The number of threads to use. If 0, the number of threads is determined by the number of cores.
- Returns:
A vector containing the resampled wave on this model’s grid.
LGP1#
- class pyfes.core.tidal_model.LGP1Complex128#
Handle the wave models loaded from finite elements using LGP1 discretization.
- index(self: pyfes.core.tidal_model.LGP1Complex128) pyfes.core.mesh.Index#
Get the index of the finite elements.
- Returns:
The index of the finite elements.
- selected_indices(self: pyfes.core.tidal_model.LGP1Complex128) Annotated[numpy.typing.NDArray[numpy.int64], '[m, 1]']#
Retrieve the indices for wave model values that intersect the specified bounding box.
- Returns:
A vector containing the selected indices. If no bounding box is set, an empty vector is returned.
- class pyfes.core.tidal_model.LGP1Complex64#
Handle the wave models loaded from finite elements using LGP1 discretization.
- index(self: pyfes.core.tidal_model.LGP1Complex64) pyfes.core.mesh.Index#
Get the index of the finite elements.
- Returns:
The index of the finite elements.
- selected_indices(self: pyfes.core.tidal_model.LGP1Complex64) Annotated[numpy.typing.NDArray[numpy.int64], '[m, 1]']#
Retrieve the indices for wave model values that intersect the specified bounding box.
- Returns:
A vector containing the selected indices. If no bounding box is set, an empty vector is returned.
LGP2#
- class pyfes.core.tidal_model.LGP2Complex128#
Handle the wave models loaded from finite elements using LGP2 discretization.
- index(self: pyfes.core.tidal_model.LGP2Complex128) pyfes.core.mesh.Index#
Get the index of the finite elements.
- Returns:
The index of the finite elements.
- selected_indices(self: pyfes.core.tidal_model.LGP2Complex128) Annotated[numpy.typing.NDArray[numpy.int64], '[m, 1]']#
Retrieve the indices for wave model values that intersect the specified bounding box.
- Returns:
A vector containing the selected indices. If no bounding box is set, an empty vector is returned.
- class pyfes.core.tidal_model.LGP2Complex64#
Handle the wave models loaded from finite elements using LGP2 discretization.
- index(self: pyfes.core.tidal_model.LGP2Complex64) pyfes.core.mesh.Index#
Get the index of the finite elements.
- Returns:
The index of the finite elements.
- selected_indices(self: pyfes.core.tidal_model.LGP2Complex64) Annotated[numpy.typing.NDArray[numpy.int64], '[m, 1]']#
Retrieve the indices for wave model values that intersect the specified bounding box.
- Returns:
A vector containing the selected indices. If no bounding box is set, an empty vector is returned.