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), **loadvars)[source]
Bases:
object
class for handling ocean data requests
data will be loaded using the given data sources and boundaries from arguments. an interpolation for each variable will be computed in parallel
data will be averaged over time frames for interpolation. for finer temporal resolution, define smaller time boundaries
any of the below load_args may also accept a callback function instead of a string or array value if you wish to write your own data loading function. the boundary arguments supplied here will be passed to the callable, i.e. north, south, west, east, top, bottom, start, end
callables or array arguments must be ordered by [val, lat, lon] for 2D data, or [val, lat, lon, depth] for 3D data
- args:
- north, south:
latitude boundaries (float)
- west, east:
longitude boundaries (float)
- top, bottom:
depth range in metres (float) only applies to salinity and temperature
- start, end:
time range for data load query (datetime) if multiple times exist within range, they will be averaged before computing interpolation
- **loadvars:
keyword args supplied as ‘load_{v}’ where v is either an integer, float, array of [val, lat, lon[, time[, depth]]], or string source as described by the source_map
- attrs:
- interps: dict
Dictionary of data interpolators
- 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
- kadlu.geospatial.ocean.worker(interpfcn, reshapefcn, cols, var, q)[source]
compute interpolation in parallel worker process
- interpfcn:
callback function for interpolation
- reshapefcn:
callback function for reshaping row data into matrix format for interpolation
- cols:
data as returned from load function
- var:
variable type. used as key in Ocean().interps dictionary
- q:
shared queue object to pass interpolation back to parent