Interpolation

class kadlu.geospatial.interpolation.BaseGeospatialInterpolator(value, name='GeospatialInterpolator', origin=None, **coors)[source]

Bases: object

Parent class for all interpolators.

Child classes must implement the _eval method.

Interpolators accept the following coordinates,

  • lat: latitude in degrees

  • lon: longitudes in degrees

  • depth: depth in meters below the sea surface

  • epoch: time in hours since 2000-01-01 00:00:00

Args:
value: array-like

Data values

lat: array-like

Latitudes in degrees.

lon: array-like

Longitudes in degrees.

depth: array-like

Depths in meters below the sea surface.

epoch: array-like

Time in hours since 2000-01-01 00:00:00.

name: str

Name used to identify the interpolator.

origin: tuple(float,float)

Reference location used as the origo of XY coordinate system. If not specified, the center point of the lat,lon coordinates will be used.

Attrs:
value: numpy array

Data values

coordinates: dict

Coordinates arrays

class kadlu.geospatial.interpolation.IrregularGridGeospatialInterpolator(value, name='IrregularGridGeospatialInterpolator', origin=None, method='cubic', **coors)[source]

Bases: BaseGeospatialInterpolator

Attrs:
dims: list(str)

Names of the dimensions that are being interpolated

property method
class kadlu.geospatial.interpolation.RegularGridGeospatialInterpolator(value, name='RegularGridGeospatialInterpolator', origin=None, method=None, **coors)[source]

Bases: BaseGeospatialInterpolator

Args:
method: str

For interpolation of data on a 2d lat-lon grid, it is recommended to leave method unspecified (i.e. method=None)

property method
kadlu.geospatial.interpolation.get_interpolator(value, **kwargs)[source]

Convenience function for initialising a interpolator for a given set of data.

Args:
value: array-like

Data values

Keyword args:
lat: array-like

Latitudes in degrees.

lon: array-like

Longitudes in degrees.

depth: array-like

Depths in meters below the sea surface.

epoch: array-like

Time in hours since 2000-01-01 00:00:00.

origin: tuple(float,float)

Reference location used as the origo of XY coordinate system. If not specified, the center point of the lat,lon coordinates will be used.

method: str

Preferred interpolation method. Allowed values are: nearest, linear, slinear, cubic. For high-dimensional data with large numbers of nodes (> 1E6), it is recommended to use one of the two simpler interpolation methods (nearest or linear) to reduce memory usage. For data that require interpolation in latitude and longitude only (e.g. bathymetry) the default interpolation method is a bivariate spline method adapted specifically to spherical coordinates with proper handling of the poles and anti-meridian discontinuity.

name: str

Name used to identify the interpolator. Optional.

max_size: int

Maximum size (no. bins) along any of the axes of the regular interpolation grid. Optional. Only relevant if input data is on an irregular grid.

grid_shape: dict()

Shape of the regular interpolation grid. Optional. Only relevant if input data is on an irregular grid.

bin_size: dict()

Bin sizes of the regular interpolation grid. Optional. Overwrites grid_shape. Only relevant if input data is on an irregular grid.

irreg_method: str

Interpolation method used for mapping data from an irregular to a regular grid. Options are nearest and linear. Default is nearest.

Returns:
interp: RegularGridGeospatialInterpolator

Interpolator