Ocean

The ocean module provides an interface to fetching, loading and interpolating ocean variables.

class kadlu.geospatial.ocean.Ocean(south=44.25, west=-64.5, north=44.7, east=-63.33, bottom=5000, top=0, start=datetime.datetime(2015, 3, 1, 0, 0), end=datetime.datetime(2015, 3, 1, 12, 0), drop=None, interp_args=None, **loadvars)[source]

Bases: object

Class for retrieving ocean data variables.

Data will be loaded using the given data sources and geographic, depth, and temporal boundaries.

It is also possible to write your own data loading function.

The boundary arguments supplied to the Ocean class will be passed to the the data loading function, i.e., north, south, west, east, top, bottom, start, end.

TODO:
  • [ ] Implement averaging across degenerate data points for irregular grids

  • [ ] Re-implement interpolation of precipitation type

  • [ ] Modify data loading classes so they return the data as a dict with keys lat,lon,epoch,depth instead of a numpy array.

Args:
north, south: float

Latitude boundaries, in degrees

west, east: float

Longitude boundaries, in degrees

top, bottom: float

Depth range, in metres

start, end: datetime

UTC time range

drop: list(str)

Dimensions to be dropped. If dropping a dimension leads to degeneracy (multiple data points with same coordinates) the average value is used. NOT YET IMPLEMENTED

interp_args: dict

Used for passing keyword arguments to the interpolator. See kadlu.geospatial.interpolation.get_interpolator for allowed arguments.

**loadvars:

Keyword args supplied as ‘load_{v}’ where v is either an integer, float, array of shape [val, lat, lon[, epoch[, depth]]], dict with keys value, lat, lon, epoch, depth, or a string source identifier (e.g. era5) as described in the source_map

Attrs:
origin: tuple(float, float)

Latitude and longitude coordinates of the centre point of the geographic bounding box. This point serves as the origin of the planar x-y coordinate system.

boundaries: dict

Bounding box for the ocean volume in space and time

interpolators: dict

Dictionary of data interpolators