oceanum.datamesh package#

Submodules#

oceanum.datamesh.catalog module#

class oceanum.datamesh.catalog.Catalog(json)[source]#

Datamesh catalog This class behaves like an immutable dictionary with the datasource ids as keys

property ids#

Return a list of datasource ids

keys()[source]#

Return a list of datasource ids

load(id)[source]#

Load datasource

Parameters:

id – Datasource id

Returns:

The datasource container

Return type:

Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]

async load_async(id)[source]#

Load datasource asynchronously

Parameters:

id – Datasource id

Returns:

The datasource container

Return type:

Couroutine<Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]>

query(query)[source]#

Make a query on the catalog

Parameters:

query (Union[oceanum.datamesh.Query, dict]) – Datamesh query as a query object or a valid query dictionary

Returns:

The datasource container

Return type:

Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]

Raises:

IndexError – Datasource not in catalog

async query_async(query)[source]#

Make an asynchronous query on the catalog

Parameters:

query (Union[oceanum.datamesh.Query, dict]) – Datamesh query as a query object or a valid query dictionary

Returns:

The datasource container

Return type:

Coroutine<Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]>

Raises:

IndexError – Datasource not in catalog

oceanum.datamesh.connection module#

class oceanum.datamesh.connection.Connector(token=None, service='https://datamesh.oceanum.io', _gateway=None, user=None, session_duration=None, verify=True)[source]#

Bases: object

Datamesh connector class.

All datamesh operations are methods of this class

delete_datasource(datasource_id)[source]#

Delete a datasource from datamesh. This will delete the datamesh registration and any stored data.

Parameters:

datasource_id (string) – Unique datasource id

Returns:

Return True for successfully deleted datasource

Return type:

boolean

async delete_datasource_async(datasource_id)[source]#

Asynchronously delete a datasource from datamesh. This will delete the datamesh registration and any stored data.

Parameters:

datasource_id (string) – Unique datasource id

Returns:

Return True for successfully deleted datasource

Return type:

boolean

get_catalog(search=None, timefilter=None, geofilter=None, limit=None)[source]#

Get datamesh catalog

Parameters:
  • search (string, optional) – Search string for filtering datasources

  • timefilter (Union[oceanum.datamesh.query.TimeFilter, list], Optional) – Time filter as valid Query TimeFilter or list of [start,end]

  • geofilter (Union[oceanum.datamesh.query.GeoFilter, dict, shapely.geometry], Optional) – Spatial filter as valid Query Geofilter or geojson geometry as dict or shapely Geometry

  • limit (int, optional) – Limit the number of datasources returned. Defaults to None.

Returns:

A datamesh catalog instance

Return type:

oceanum.datamesh.Catalog

async get_catalog_async(search=None, timefilter=None, geofilter=None)[source]#

Get datamesh catalog asynchronously

Parameters:
  • search (string, optional) – Search string for filtering datasources

  • timefilter (Union[oceanum.datamesh.query.TimeFilter, list], Optional) – Time filter as valid Query TimeFilter or list of [start,end]

  • geofilter (Union[oceanum.datamesh.query.GeoFilter, dict, shapely.geometry], Optional) – Spatial filter as valid Query Geofilter or geojson geometry as dict or shapely Geometry

Returns:

A datamesh catalog instance

Return type:

Coroutine<oceanum.datamesh.Catalog>

get_datasource(datasource_id)[source]#

Get a Datasource instance from the datamesh. This does not load the actual data.

Parameters:

datasource_id (string) – Unique datasource id

Returns:

A datasource instance

Return type:

oceanum.datamesh.Datasource

Raises:

DatameshConnectError – Datasource cannot be found or is not authorized for the datamesh key

async get_datasource_async(datasource_id)[source]#

Get a Datasource instance from the datamesh asynchronously. This does not load the actual data.

Parameters:
  • datasource_id (string) – Unique datasource id

  • loop – event loop. default=None will use asyncio.get_running_loop()

  • executorconcurrent.futures.Executor instance. default=None will use the default executor

Returns:

A datasource instance

Return type:

Coroutine<oceanum.datamesh.Datasource>

Raises:

DatameshConnectError – Datasource cannot be found or is not authorized for the datamesh key

property host#

Datamesh host

Returns:

Datamesh server host

Return type:

string

load_datasource(datasource_id, parameters={}, use_dask=False)[source]#

Load a datasource into the work environment. For datasources which load into DataFrames or GeoDataFrames, this returns an in memory instance of the DataFrame. For datasources which load into an xarray Dataset, an open zarr backed dataset is returned.

Parameters:
  • datasource_id (string) – Unique datasource id

  • parameters (dict) – Additional datasource parameters

  • use_dask (bool, optional) – Load datasource as a dask enabled datasource if possible. Defaults to False.

Returns:

The datasource container

Return type:

Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]

async load_datasource_async(datasource_id, parameters={}, use_dask=False)[source]#

Load a datasource asynchronously into the work environment

Parameters:
  • datasource_id (string) – Unique datasource id

  • use_dask (bool, optional) – Load datasource as a dask enabled datasource if possible. Defaults to False.

  • loop – event loop. default=None will use asyncio.get_running_loop()

  • executorconcurrent.futures.Executor instance. default=None will use the default executor

Returns:

The datasource container

Return type:

coroutine<Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]>

query(query=None, *, use_dask=False, cache_timeout=0, **query_keys)[source]#

Make a datamesh query

Parameters:

query (Union[oceanum.datamesh.Query, dict]) – Datamesh query as a query object or a valid query dictionary

Kwargs:

use_dask (bool, optional): Load datasource as a dask enabled datasource if possible. Defaults to False. cache_timeout (int, optional): Local cache timeout in seconds. Defaults to 0 (no local cache). Only applies if use_dask=False. Will return an identical query from a local cache if available with an age of less than cache_timeout seconds. Does not check for more recent data on the server. **query_keys: Keywords form of query, for example datamesh.query(datasource=”my_datasource”)

Returns:

The datasource container

Return type:

Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]

async query_async(query, *, use_dask=False, cache_timeout=0, **query_keys)[source]#

Make a datamesh query asynchronously

Parameters:

query (Union[oceanum.datamesh.Query, dict]) – Datamesh query as a query object or a valid query dictionary

Kwargs:

use_dask (bool, optional): Load datasource as a dask enabled datasource if possible. Defaults to False. cache_timeout (int, optional): Local cache timeout in seconds. Defaults to 0 (no local cache). Only applies if use_dask=False. Will return an identical query from a local cache if available with an age of less than cache_timeout seconds. Does not check for more recent data on the server. loop: event loop. default=None will use asyncio.get_running_loop() executor: concurrent.futures.Executor instance. default=None will use the default executor **query_keys: Keywords form of query, for example datamesh.query(datasource=”my_datasource”)

Returns:

The datasource container

Return type:

Coroutine<Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset]>

update_metadata(datasource_id, **properties)[source]#

Update the metadata of a datasource in datamesh

Parameters:
  • datasource_id (string) – Unique datasource id

  • **properties – Additional properties for the datasource - see oceanum.datamesh.Datasource constructor

Returns:

The datasource instance that was updated

Return type:

oceanum.datamesh.Datasource

async update_metadata_async(datasource_id, **properties)[source]#

Update the metadata of a datasource in datamesh asynchronously

Parameters:
  • datasource_id (string) – Unique datasource id

  • **properties – Additional properties for the datasource - see oceanum.datamesh.Datasource constructor

Returns:

The datasource instance that was updated

Return type:

Coroutine<oceanum.datamesh.Datasource>

write_datasource(datasource_id, data, geometry=None, geom=None, append=None, overwrite=False, index=None, crs=None, **properties)[source]#

Write a datasource to datamesh from the work environment

Parameters:
  • datasource_id (string) – Unique datasource id

  • data (Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset, None]) – The data to be written to datamesh. If data is None, just update metadata properties.

  • geom (oceanum.datasource.Geometry, optional) – GeoJSON geometry of the datasource in WGS84 if crs=None else in the specified crs. If not provided the geometry will be infered from the data if possible. default=None

  • coordinates (Dict[oceanum.datasource.Coordinates,str], optional) – Coordinate mapping for xarray datasets. default=None

  • append (string, optional) – Coordinate to append on. default=None

  • overwrite (bool, optional) – Overwrite existing datasource. default=False

  • crs (Union[string,int], optional) – Coordinate reference system for the datasource if not WGS84. The geom argument is also assumed to be in this CRS. default=None

  • **properties – Additional properties for the datasource - see oceanum.datamesh.Datasource

Returns:

The datasource instance that was written to

Return type:

oceanum.datamesh.Datasource

async write_datasource_async(datasource_id, data, append=None, overwrite=False, **properties)[source]#

Write a datasource to datamesh from the work environment asynchronously

Parameters:
  • datasource_id (string) – Unique datasource id

  • data (Union[pandas.DataFrame, geopandas.GeoDataFrame, xarray.Dataset, None]) – The data to be written to datamesh. If data is None, just update metadata properties.

  • geom (oceanum.datasource.Geometry) – GeoJSON geometry of the datasource

  • append (string, optional) – Coordinate to append on. default=None

  • overwrite (bool, optional) – Overwrite existing datasource. default=False

  • **properties – Additional properties for the datasource - see oceanum.datamesh.Datasource constructor

Returns:

The datasource instance that was written to

Return type:

Coroutine<oceanum.datamesh.Datasource>

oceanum.datamesh.connection.asyncwrapper(func)[source]#
oceanum.datamesh.connection.tempFile(mode='wb')[source]#

oceanum.datamesh.datasource module#

pydantic model oceanum.datamesh.datasource.Datasource[source]#

Datasource

Show JSON schema
{
   "title": "Datasource",
   "description": "Datasource",
   "type": "object",
   "properties": {
      "id": {
         "description": "Unique ID for the datasource",
         "maxLength": 80,
         "minLength": 3,
         "pattern": "^[a-z0-9-_]+$",
         "title": "Datasource ID",
         "type": "string"
      },
      "name": {
         "description": "Human readable name for the datasource",
         "maxLength": 128,
         "title": "Datasource name",
         "type": "string"
      },
      "description": {
         "anyOf": [
            {
               "maxLength": 1500,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "",
         "description": "Description of datasource",
         "title": "Datasource description"
      },
      "parameters": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": {},
         "description": "Additional parameters for accessing datasource",
         "title": "Datasource parameters"
      },
      "geom": {
         "anyOf": [
            {
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Valid shapely or geoJSON geometry describing the spatial extent of the datasource",
         "title": "Datasource geometry"
      },
      "tstart": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Earliest time in datasource. Must be a valid ISO8601 datetime string",
         "title": "Start time of datasource"
      },
      "tend": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Latest time in datasource. Must be a valid ISO8601 datetime string",
         "title": "End time of datasource"
      },
      "pforecast": {
         "anyOf": [
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Duration of a forecast horizon (time after present). Must be a valid ISO8601 interval string or None.",
         "title": "Datasource forecast horizon period"
      },
      "parchive": {
         "anyOf": [
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Duration of a rolling archive (time before present). Must be a valid ISO8601 interval string or None.",
         "title": "Datasource rolling archive period"
      },
      "tags": {
         "anyOf": [
            {
               "items": {},
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": [],
         "description": "Metadata keyword tags related to the datasource",
         "title": "Datasource tags"
      },
      "labels": {
         "anyOf": [
            {
               "items": {},
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": [],
         "description": "Metadata labels related to the datasource. A given label can only be owned by one organisation.",
         "title": "Datasource labels"
      },
      "info": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": {},
         "description": "Additional datasource descriptive metadata",
         "title": "Datasource metadata"
      },
      "schema": {
         "anyOf": [
            {
               "$ref": "#/$defs/Schema"
            },
            {
               "type": "null"
            }
         ],
         "default": {
            "attrs": {},
            "dims": {},
            "coords": {},
            "data_vars": {}
         },
         "description": "Datasource schema",
         "title": "Schema"
      },
      "coordinates": {
         "additionalProperties": {
            "type": "string"
         },
         "default": {},
         "description": "\n        Coordinates in datasource, referenced by standard coordinate keys. The dictionary keys map to coordinates variables in the datasource.\n            - Ensemble: \"e\"\n            - Rasterband: \"b\"\n            - Category: \"c\"\n            - Quantile: \"q\"\n            - Season: \"s\"\n            - Month: \"m\"\n            - Time: \"t\"\n            - Vertical: \"z\"\n            - Northing: \"y\"\n            - Easting: \"x\"\n            - Station: \"s\"  (Locations assumed stationary, datasource with a multigeometry indexed by station coordinate)\n            - Geometry: \"g\"  (Abstract coordinate - a 2 or 3D geometry that defines a feature location)\n            - Frequency: \"f\"\n            - Direction: \"d\"\n            - Other 1: \"i\" (any other arbitrary coordinate)\n            - Other 2: \"j\" (any other arbitrary coordinate)\n            - Other 3: \"k\" (any other arbitrary coordinate)\n\n        Example {\"t\":\"time\",\"x\":\"longitude\",\"y\":\"latitude\"}\n        ",
         "propertyNames": {
            "$ref": "#/$defs/Coordinates"
         },
         "title": "Coordinate keys",
         "type": "object"
      },
      "details": {
         "anyOf": [
            {
               "format": "uri",
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "URL to further details about the datasource",
         "title": "Details"
      },
      "modified": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "2026-04-23T19:21:08.358351Z",
         "description": "Last time datasource was modified",
         "title": "Last modified time"
      },
      "created": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "2026-04-23T19:21:08.358383Z",
         "description": "Time when the datasource was first created",
         "title": "Time of creation"
      },
      "expires": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Time when the datasource expires and should get automatically deleted",
         "title": "Expiry time"
      },
      "args": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": {},
         "description": "Driver arguments for datasource. These are driver dependent.",
         "title": "Driver arguments"
      },
      "driver": {
         "title": "Driver",
         "type": "string"
      }
   },
   "$defs": {
      "Coordinates": {
         "description": "Coordinate keys",
         "enum": [
            "e",
            "b",
            "c",
            "q",
            "s",
            "m",
            "t",
            "z",
            "y",
            "x",
            "s",
            "g",
            "f",
            "d",
            "i",
            "j",
            "k"
         ],
         "title": "Coordinates",
         "type": "string"
      },
      "Schema": {
         "properties": {
            "attrs": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Global attributes"
            },
            "dims": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Dimensions"
            },
            "coords": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Coordinates"
            },
            "data_vars": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Data variables"
            }
         },
         "title": "Schema",
         "type": "object"
      }
   },
   "required": [
      "id",
      "name",
      "driver"
   ]
}

Fields:
Validators:
field coordinates: Dict[Coordinates, str] = {}#
Coordinates in datasource, referenced by standard coordinate keys. The dictionary keys map to coordinates variables in the datasource.
  • Ensemble: “e”

  • Rasterband: “b”

  • Category: “c”

  • Quantile: “q”

  • Season: “s”

  • Month: “m”

  • Time: “t”

  • Vertical: “z”

  • Northing: “y”

  • Easting: “x”

  • Station: “s” (Locations assumed stationary, datasource with a multigeometry indexed by station coordinate)

  • Geometry: “g” (Abstract coordinate - a 2 or 3D geometry that defines a feature location)

  • Frequency: “f”

  • Direction: “d”

  • Other 1: “i” (any other arbitrary coordinate)

  • Other 2: “j” (any other arbitrary coordinate)

  • Other 3: “k” (any other arbitrary coordinate)

Example {“t”:”time”,”x”:”longitude”,”y”:”latitude”}

field created: datetime | None = datetime.datetime(2026, 4, 23, 19, 21, 8, 358383, tzinfo=datetime.timezone.utc)#

Time when the datasource was first created

field dataschema: Schema | None = Schema(attrs={}, dims={}, coords={}, data_vars={}) (alias 'schema')#

Datasource schema

field description: str | None = ''#

Description of datasource

Constraints:
  • max_length = 1500

field details: AnyHttpUrl | None = None#

URL to further details about the datasource

field driver: str [Required]#
field driver_args: dict | None = {} (alias 'args')#

Driver arguments for datasource. These are driver dependent.

field expires: datetime | None = None#

Time when the datasource expires and should get automatically deleted

field geom: Annotated[Point | MultiPoint | Polygon, _GeometryAnnotation] | None = None#

Valid shapely or geoJSON geometry describing the spatial extent of the datasource

field id: str [Required]#

Unique ID for the datasource

Constraints:
  • min_length = 3

  • max_length = 80

  • pattern = ^[a-z0-9-_]+$

Validated by:
field info: dict | None = {}#

Additional datasource descriptive metadata

field labels: list | None = []#

Metadata labels related to the datasource. A given label can only be owned by one organisation.

field modified: datetime | None = datetime.datetime(2026, 4, 23, 19, 21, 8, 358351, tzinfo=datetime.timezone.utc)#

Last time datasource was modified

field name: str [Required]#

Human readable name for the datasource

Constraints:
  • max_length = 128

field parameters: dict | None = {}#

Additional parameters for accessing datasource

field parchive: Annotated[timedelta, BeforeValidator(func=parse_period, json_schema_input_type=PydanticUndefined)] | None = None#

Duration of a rolling archive (time before present). Must be a valid ISO8601 interval string or None.

field pforecast: Annotated[timedelta, BeforeValidator(func=parse_period, json_schema_input_type=PydanticUndefined)] | None = None#

Duration of a forecast horizon (time after present). Must be a valid ISO8601 interval string or None.

field tags: list | None = []#

Metadata keyword tags related to the datasource

field tend: datetime | None = None#

Latest time in datasource. Must be a valid ISO8601 datetime string

field tstart: datetime | None = None#

Earliest time in datasource. Must be a valid ISO8601 datetime string

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

validator validate_id  »  id[source]#
property attributes#

Datasource global attributes. Note that these are None (undefined) for a summary dataset.

property bounds#

Bounding box of datasource geographical extent

Type:

list[float]

property geometry#
property variables#

Datasource variables. Note that these are None (undefined) for a summary dataset.

oceanum.datamesh.query module#

pydantic model oceanum.datamesh.query.Aggregate[source]#

Bases: BaseModel

Fields:
field operations: List[AggregateOps] = [AggregateOps.mean]#

List of aggregation operators to apply, from mean,min,max,std,sum

field spatial: bool | None = True#

Aggregate over spatial dimensions (default True)

field temporal: bool | None = True#

Aggregate over temporal dimension (default True)

class oceanum.datamesh.query.AggregateOps(value)[source]#

Bases: str, Enum

An enumeration.

max = 'max'#
mean = 'mean'#
min = 'min'#
std = 'std'#
sum = 'sum'#
class oceanum.datamesh.query.Container(value)[source]#

Bases: str, Enum

An enumeration.

DataFrame = 'dataframe'#
Dataset = 'dataset'#
GeoDataFrame = 'geodataframe'#
pydantic model oceanum.datamesh.query.CoordSelector[source]#

Bases: BaseModel

Fields:
field coord: str [Required]#
field values: List[str | int | float] [Required]#
pydantic model oceanum.datamesh.query.FilterGeometry[source]#

Bases: BaseModel

Fields:
field id: str [Required]#
field parameters: Dict | None = {}#
pydantic model oceanum.datamesh.query.Function[source]#

Bases: BaseModel

Fields:
field args: Dict[str, Any] [Required]#
field id: str [Required]#
field replace: bool | None = False#
field vselect: List[str] | None = None#
pydantic model oceanum.datamesh.query.GeoFilter[source]#

Bases: BaseModel

GeoFilter class Describes a spatial subset or interpolation

Fields:
Validators:
field alltouched: bool | None = None#
field geom: List[float] | Feature [Required]#
  • For type=’feature’, geojson feature as dict or shapely Geometry.

  • For type=’bbox’, list[x_min,y_min,x_max,y_max] in CRS units.

Validated by:
field interp: GeoFilterInterp | None = GeoFilterInterp.linear#

Interpolation method to use for feature filters

field resolution: float | None = 0.0#

Maximum resolution of the data for downsampling in CRS units. Only works for feature datasources.

field type: GeoFilterType = GeoFilterType.bbox#
Type of the geofilter. Can be one of:
  • ‘feature’: Select with a geojson feature

  • ‘bbox’: Select with a bounding box

validator validate_geom  »  geom[source]#
class oceanum.datamesh.query.GeoFilterInterp(value)[source]#

Bases: str, Enum

Interpolation method for geofilter. Can be one of: - ‘nearest’: Nearest neighbor - ‘linear’: Linear interpolation

linear = 'linear'#
nearest = 'nearest'#
class oceanum.datamesh.query.GeoFilterType(value)[source]#

Bases: str, Enum

An enumeration.

bbox = 'bbox'#
feature = 'feature'#
pydantic model oceanum.datamesh.query.LevelFilter[source]#

Bases: BaseModel

LevelFilter class Describes a vertical subset or interpolation

Fields:
field interp: LevelFilterInterp | None = LevelFilterInterp.linear#

Interpolation method to use for series type level filters

field levels: List[float | None] [Required]#
  • For type=’range’, [levelstart, levelend].

field type: LevelFilterType = LevelFilterType.range#
Type of the levelfilter. Can be one of:
  • ‘range’: Select levels within a range, levels are a list of [levelstart, levelend]

  • ‘series’: Select levels in a series, levels are a list of levels

  • ‘trajectory’: Select levels along a trajectory, levels are a list of levels corresponding to subfeatures in a feature filter

class oceanum.datamesh.query.LevelFilterInterp(value)[source]#

Bases: str, Enum

Interpolation method for levelfilter. Can be one of: - ‘nearest’: Nearest neighbor - ‘linear’: Linear interpolation

Linear interpolation does not extrapolate outside the bounds of the level coordinate.

linear = 'linear'#
nearest = 'nearest'#
class oceanum.datamesh.query.LevelFilterType(value)[source]#

Bases: str, Enum

Level filter type range: Select levels within a range - levels parameter must have 2 values series: Select levels in a series - levels parameter must have 1 or more value(s) trajectory: Select levels along a trajectory - levels parameter must have same number of values as subfeatures in a feature filter. For example same number of points as in a multipoints feature.

range = 'range'#
series = 'series'#
trajectory = 'trajectory'#
pydantic model oceanum.datamesh.query.Query[source]#

Bases: BaseModel

Datamesh query

Fields:
field aggregate: Aggregate | None = None#

Optional aggregation operators to apply to query after filtering

field coordfilter: List[CoordSelector] | None = None#
field crs: str | int | None = None#

Valid CRS string for returned data

field datasource: str [Required]#

Datasource ID

Constraints:
  • min_length = 3

  • max_length = 80

field description: str | None = None#

Human readable description of this query

field functions: List[Function] | None = []#
field geofilter: GeoFilter | None = None#
field id: str | None = None#
field levelfilter: LevelFilter | None = None#
field limit: int | None = None#
field parameters: Dict | None = {}#

Dictionary of driver parameters to pass to datasource

field timefilter: TimeFilter | None = None#

Temporal filter or interplator

field variables: List[str] | None = None#

List of requested variables.

exception oceanum.datamesh.query.QueryError[source]#

Bases: Exception

class oceanum.datamesh.query.ResampleType(value)[source]#

Bases: str, Enum

An enumeration.

mean = 'mean'#
nearest = 'nearest'#
slinear = 'linear'#
pydantic model oceanum.datamesh.query.Stage[source]#

Bases: BaseModel

Fields:
field container: Container [Required]#
field coordkeys: dict [Required]#
field coordmap: dict [Required]#
field dlen: int [Required]#
field formats: List[str] [Required]#
field qhash: str [Required]#
field query: Query [Required]#
field sig: str [Required]#
field size: int [Required]#
pydantic model oceanum.datamesh.query.TimeFilter[source]#

Bases: BaseModel

TimeFilter class Describes a temporal subset or interpolation

Fields:
Validators:
field resample: ResampleType | None = ResampleType.slinear#

Resampling method applied when reducing tempral resolution. Only valid with range type

field resolution: str | None = 'native'#

” Maximum resolution of the data for temporal downsampling. Must be a valid pandas [DateOffset.freqstr](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.tseries.offsets.DateOffset.freqstr.html#pandas.tseries.offsets.DateOffset.freqstr). Only valid with range type

field times: WithJsonSchema(json_schema={'type': 'string', 'format': 'time-period'}, mode=None)] | None] [Required]#
  • For type=’range’, [timestart, tend].

Validated by:
field type: TimeFilterType = TimeFilterType.range#
Type of the timefilter. Can be one of:
  • ‘range’: Select times within a range, times are a list of [timestart, tend]

  • ‘series’: Select times in a series, times are a list of times

  • ‘trajectory’: Select times along a trajectory, times are a list of times corresponding to subfeatures in a feature filter

validator validate_times  »  times[source]#
class oceanum.datamesh.query.TimeFilterType(value)[source]#

Bases: str, Enum

Time filter type range: Select times within a range - times parameter must have 2 values series: Select times in a series - times parameter must have 1 or more value(s) trajectory: Select times along a trajectory - times parameter must have same number of values as subfeatures in a feature filter. For example same number of points as in a multipoints feature.

range = 'range'#
series = 'series'#
trajectory = 'trajectory'#
pydantic model oceanum.datamesh.query.Workspace[source]#

Bases: BaseModel

Fields:
field data: List[Query] [Required]#
field description: str | None = ''#
field id: str | None = None#
field name: str | None = 'OceanQL package'#
oceanum.datamesh.query.parse_time(v)[source]#
oceanum.datamesh.query.parse_timedelta(v)[source]#

Module contents#