oceanum.datamesh package — oceanum 0.1.0 documentation

# oceanum.datamesh package

## Submodules

## oceanum.datamesh.catalog module

class oceanum.datamesh.catalog.Catalog(json)

  Bases: `object`

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

  property ids

    Return a list of datasource ids

  keys()

    Return a list of datasource ids

  load(id)

    Load datasource

    Parameters

      id – Datasource id

    Returns

      The datasource container

    Return type

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

  async load_async(id)

    Load datasource asynchronously

    Parameters

      id – Datasource id

    Returns

      The datasource container

    Return type

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

  query(query)

    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)

    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)

  Bases: `object`

  Datamesh connector class.

  All datamesh operations are methods of this class

  get_catalog(filter={})

    Get datamesh catalog

    Parameters

      filter (dict, optional) – Set of filters to apply. Defaults to {}.

    Returns

      A datamesh catalog instance

    Return type

      `oceanum.datamesh.Catalog`

  async get_catalog_async(filter={})

    Get datamesh catalog asynchronously

    Parameters

      - filter (dict, optional) – Set of filters to apply. Defaults to {}.

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

      - executor – `concurrent.futures.Executor` instance. default=None will use the default executor

    Returns

      A datamesh catalog instance

    Return type

      Coroutine<`oceanum.datamesh.Catalog`>

  get_datasource(datasource_id)

    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)

    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()`

      - executor – `concurrent.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, use_dask=True)

    Load a datasource 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 True.

    Returns

      The datasource container

    Return type

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

  async load_datasource_async(datasource_id, use_dask=True)

    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 True.

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

      - executor – `concurrent.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)

    Make a datamesh query

    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`]

  async query_async(query)

    Make a datamesh query asynchronously

    Parameters

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

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

      - executor – `concurrent.futures.Executor` instance. default=None will use the default executor

    Returns

      The datasource container

    Return type

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

exception oceanum.datamesh.connection.DatameshConnectError

  Bases: `Exception`

exception oceanum.datamesh.connection.DatameshQueryError

  Bases: `Exception`

oceanum.datamesh.connection.asyncwrapper(func)

## oceanum.datamesh.datasource module

class oceanum.datamesh.datasource.Datasource(datasource_id, geometry=None, name=None, description=None, tstart=None, tend=None, parchive=None, schema={}, coordinates={}, tags=[], links=[], info={}, details=None, last_modified=None, **extra_kwargs)

  Bases: `object`

  Datasource class

  property attributes

    Datasource global attributes

  property bounds

    Bounding box of datasource geographical extent

    Type

      list[float]

  property container

    Container type for datasource Is one of:

    > - `xarray.Dataset`

    > - `pandas.DataFrame`

    > - `geopandas.GeoDataFrame`

    Type

      str

  property description

    Datasource description

    Type

      str

  property geometry

    Geometry of datasource extent or location

    Type

      `shapely.geometry.Geometry`

  load()

    Load the datasource into an in memory container or open zarr dataset

    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.

  property name

    Human readable name of datasource

    Type

      str

  property tend

    `datetime` Latest time in datasource

  property tstart

    `datetime` Earliest time in datasource

  property variables

    Datasource variables (or properties)

exception oceanum.datamesh.datasource.DatasourceException

  Bases: `Exception`

oceanum.datamesh.datasource.parse_period(self, period)

## oceanum.datamesh.query module

pydantic model oceanum.datamesh.query.DatasourceGeom

  Bases: `pydantic.main.BaseModel`

  Show JSON schema

      {
         "title": "DatasourceGeom",
         "type": "object",
         "properties": {
            "id": {
               "title": "Datasource ID",
               "type": "string"
            },
            "parameters": {
               "title": "Optional parameters to access datasource",
               "default": {},
               "type": "object"
            }
         },
         "required": [
            "id"
         ]
      }

  Fields

    - `id (str)`

    - `parameters (Optional[Dict])`

  field id: str [Required]
  field parameters: Optional[Dict] = {}

pydantic model oceanum.datamesh.query.GeoFilter

  Bases: `pydantic.main.BaseModel`

  GeoFilter class Describes a spatial subset or interpolation

  Show JSON schema

      {
         "title": "GeoFilter",
         "description": "GeoFilter class\nDescribes a spatial subset or interpolation",
         "type": "object",
         "properties": {
            "type": {
               "title": "Geofilter type",
               "description": "\n        Type of the geofilter. Can be one of:\n            - 'feature': Select with a geojson feature\n            - 'bbox': Select with a bounding box\n            - 'radius': Select within radius of point\n        ",
               "default": "bbox",
               "allOf": [
                  {
                     "$ref": "#/definitions/GeoFilterType"
                  }
               ]
            },
            "geom": {
               "title": "Selection geometry",
               "description": "\n            - For type='feature', geojson feature.\n            - For type='bbox', list[x_min,y_min,x_max,y_max] in CRS units.\n            - For type='radius', list[x0,y0,radius] in CRS units.\n        ",
               "anyOf": [
                  {
                     "type": "array",
                     "items": {}
                  },
                  {
                     "$ref": "#/definitions/Feature"
                  }
               ]
            },
            "resolution": {
               "title": "Maximum spatial resolution of data",
               "description": "Maximum resolution of the data for downsampling in CRS units",
               "default": 0.0,
               "type": "number"
            }
         },
         "required": [
            "geom"
         ],
         "definitions": {
            "GeoFilterType": {
               "title": "GeoFilterType",
               "description": "An enumeration.",
               "enum": [
                  "feature",
                  "radius",
                  "bbox"
               ]
            },
            "Point": {
               "title": "Point",
               "description": "Point Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "anyOf": [
                        {
                           "type": "array",
                           "minItems": 2,
                           "maxItems": 2,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "type": "array",
                           "minItems": 3,
                           "maxItems": 3,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  },
                  "type": {
                     "title": "Type",
                     "const": "Point",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "MultiPoint": {
               "title": "MultiPoint",
               "description": "MultiPoint Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "anyOf": [
                           {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           },
                           {
                              "type": "array",
                              "minItems": 3,
                              "maxItems": 3,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           }
                        ]
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "MultiPoint",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "LineString": {
               "title": "LineString",
               "description": "LineString Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "minItems": 2,
                     "type": "array",
                     "items": {
                        "anyOf": [
                           {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           },
                           {
                              "type": "array",
                              "minItems": 3,
                              "maxItems": 3,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           }
                        ]
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "LineString",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "MultiLineString": {
               "title": "MultiLineString",
               "description": "MultiLineString Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "type": "array",
                        "items": {
                           "anyOf": [
                              {
                                 "type": "array",
                                 "minItems": 2,
                                 "maxItems": 2,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              },
                              {
                                 "type": "array",
                                 "minItems": 3,
                                 "maxItems": 3,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "MultiLineString",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "Polygon": {
               "title": "Polygon",
               "description": "Polygon Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "type": "array",
                        "items": {
                           "anyOf": [
                              {
                                 "type": "array",
                                 "minItems": 2,
                                 "maxItems": 2,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              },
                              {
                                 "type": "array",
                                 "minItems": 3,
                                 "maxItems": 3,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "Polygon",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "MultiPolygon": {
               "title": "MultiPolygon",
               "description": "MultiPolygon Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "type": "array",
                        "items": {
                           "type": "array",
                           "items": {
                              "anyOf": [
                                 {
                                    "type": "array",
                                    "minItems": 2,
                                    "maxItems": 2,
                                    "items": [
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       },
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       }
                                    ]
                                 },
                                 {
                                    "type": "array",
                                    "minItems": 3,
                                    "maxItems": 3,
                                    "items": [
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       },
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       },
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       }
                                    ]
                                 }
                              ]
                           }
                        }
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "MultiPolygon",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "Feature": {
               "title": "Feature",
               "description": "Feature Model",
               "type": "object",
               "properties": {
                  "type": {
                     "title": "Type",
                     "const": "Feature",
                     "type": "string"
                  },
                  "geometry": {
                     "title": "Geometry",
                     "anyOf": [
                        {
                           "$ref": "#/definitions/Point"
                        },
                        {
                           "$ref": "#/definitions/MultiPoint"
                        },
                        {
                           "$ref": "#/definitions/LineString"
                        },
                        {
                           "$ref": "#/definitions/MultiLineString"
                        },
                        {
                           "$ref": "#/definitions/Polygon"
                        },
                        {
                           "$ref": "#/definitions/MultiPolygon"
                        }
                     ]
                  },
                  "properties": {
                     "title": "Properties",
                     "type": "object"
                  },
                  "id": {
                     "title": "Id",
                     "type": "string"
                  },
                  "bbox": {
                     "title": "Bbox",
                     "anyOf": [
                        {
                           "type": "array",
                           "minItems": 4,
                           "maxItems": 4,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "type": "array",
                           "minItems": 6,
                           "maxItems": 6,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  }
               },
               "required": [
                  "geometry"
               ]
            }
         }
      }

  Fields

    - `geom (Union[List, geojson_pydantic.features.Feature])`

    - `resolution (Optional[float])`

    - `type (oceanum.datamesh.query.GeoFilterType)`

  field geom: Union[List, geojson_pydantic.features.Feature] [Required]

    - For type=’feature’, geojson feature.

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

    - For type=’radius’, list[x0,y0,radius] in CRS units.

  field resolution: Optional[float] = 0.0

    Maximum resolution of the data for downsampling in CRS units

  field type: oceanum.datamesh.query.GeoFilterType = <GeoFilterType.bbox: 'bbox'>
    Type of the geofilter. Can be one of:

      - ‘feature’: Select with a geojson feature

      - ‘bbox’: Select with a bounding box

      - ‘radius’: Select within radius of point

class oceanum.datamesh.query.GeoFilterType(value)

  Bases: `enum.Enum`

  An enumeration.

  bbox = 'bbox'
  feature = 'feature'
  radius = 'radius'

pydantic model oceanum.datamesh.query.Query

  Bases: `pydantic.main.BaseModel`

  Datamesh query

  Show JSON schema

      {
         "title": "Query",
         "description": "Datamesh query",
         "type": "object",
         "properties": {
            "datasource": {
               "title": "The id of the datasource",
               "description": "Datasource ID",
               "type": "string"
            },
            "parameters": {
               "title": "Datasource parameters",
               "description": "Dictionary of driver parameters to pass to datasource",
               "default": {},
               "type": "object"
            },
            "description": {
               "title": "Optional description of this query",
               "description": "Human readable description of this query",
               "type": "string"
            },
            "variables": {
               "title": "List of selected variables",
               "description": "List of requested variables.",
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "timefilter": {
               "title": "Time filter",
               "description": "Temporal filter or interplator",
               "allOf": [
                  {
                     "$ref": "#/definitions/TimeFilter"
                  }
               ]
            },
            "geofilter": {
               "title": "Spatial filter or interpolator",
               "allOf": [
                  {
                     "$ref": "#/definitions/GeoFilter"
                  }
               ]
            },
            "crs": {
               "title": "Spatial reference for filter and output",
               "description": "Valid CRS string for returned data",
               "default": "EPSG:4326",
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "integer"
                  }
               ]
            }
         },
         "required": [
            "datasource"
         ],
         "definitions": {
            "TimeFilterType": {
               "title": "TimeFilterType",
               "description": "An enumeration.",
               "enum": [
                  "range"
               ],
               "type": "string"
            },
            "ResampleType": {
               "title": "ResampleType",
               "description": "An enumeration.",
               "enum": [
                  "mean"
               ],
               "type": "string"
            },
            "TimeFilter": {
               "title": "TimeFilter",
               "description": "TimeFilter class\nDescribes a temporal subset or interpolation",
               "type": "object",
               "properties": {
                  "type": {
                     "title": "Timefilter type",
                     "description": "\n        Type of the timefilter. Can be one of:\n            - 'range': Select times within a range\n        ",
                     "default": "range",
                     "allOf": [
                        {
                           "$ref": "#/definitions/TimeFilterType"
                        }
                     ]
                  },
                  "times": {
                     "title": "Selection times",
                     "description": "\n            - For type='range', [timestart, tend].\n        ",
                     "type": "array",
                     "items": {
                        "type": "string",
                        "format": "date-time"
                     }
                  },
                  "resolution": {
                     "title": "Temporal resolution of data",
                     "description": "Maximum resolution of the data for temporal downsampling. Only valid with range type",
                     "default": "native",
                     "type": "string"
                  },
                  "resample": {
                     "title": "Temporal resampling method",
                     "description": "Resampling method applied when reducing tempral resolution. Only valid with range type",
                     "default": "mean",
                     "allOf": [
                        {
                           "$ref": "#/definitions/ResampleType"
                        }
                     ]
                  }
               },
               "required": [
                  "times"
               ]
            },
            "GeoFilterType": {
               "title": "GeoFilterType",
               "description": "An enumeration.",
               "enum": [
                  "feature",
                  "radius",
                  "bbox"
               ]
            },
            "Point": {
               "title": "Point",
               "description": "Point Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "anyOf": [
                        {
                           "type": "array",
                           "minItems": 2,
                           "maxItems": 2,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "type": "array",
                           "minItems": 3,
                           "maxItems": 3,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  },
                  "type": {
                     "title": "Type",
                     "const": "Point",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "MultiPoint": {
               "title": "MultiPoint",
               "description": "MultiPoint Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "anyOf": [
                           {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           },
                           {
                              "type": "array",
                              "minItems": 3,
                              "maxItems": 3,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           }
                        ]
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "MultiPoint",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "LineString": {
               "title": "LineString",
               "description": "LineString Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "minItems": 2,
                     "type": "array",
                     "items": {
                        "anyOf": [
                           {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           },
                           {
                              "type": "array",
                              "minItems": 3,
                              "maxItems": 3,
                              "items": [
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 },
                                 {
                                    "anyOf": [
                                       {
                                          "type": "number"
                                       },
                                       {
                                          "type": "integer"
                                       }
                                    ]
                                 }
                              ]
                           }
                        ]
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "LineString",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "MultiLineString": {
               "title": "MultiLineString",
               "description": "MultiLineString Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "type": "array",
                        "items": {
                           "anyOf": [
                              {
                                 "type": "array",
                                 "minItems": 2,
                                 "maxItems": 2,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              },
                              {
                                 "type": "array",
                                 "minItems": 3,
                                 "maxItems": 3,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "MultiLineString",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "Polygon": {
               "title": "Polygon",
               "description": "Polygon Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "type": "array",
                        "items": {
                           "anyOf": [
                              {
                                 "type": "array",
                                 "minItems": 2,
                                 "maxItems": 2,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              },
                              {
                                 "type": "array",
                                 "minItems": 3,
                                 "maxItems": 3,
                                 "items": [
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    },
                                    {
                                       "anyOf": [
                                          {
                                             "type": "number"
                                          },
                                          {
                                             "type": "integer"
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "Polygon",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "MultiPolygon": {
               "title": "MultiPolygon",
               "description": "MultiPolygon Model",
               "type": "object",
               "properties": {
                  "coordinates": {
                     "title": "Coordinates",
                     "type": "array",
                     "items": {
                        "type": "array",
                        "items": {
                           "type": "array",
                           "items": {
                              "anyOf": [
                                 {
                                    "type": "array",
                                    "minItems": 2,
                                    "maxItems": 2,
                                    "items": [
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       },
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       }
                                    ]
                                 },
                                 {
                                    "type": "array",
                                    "minItems": 3,
                                    "maxItems": 3,
                                    "items": [
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       },
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       },
                                       {
                                          "anyOf": [
                                             {
                                                "type": "number"
                                             },
                                             {
                                                "type": "integer"
                                             }
                                          ]
                                       }
                                    ]
                                 }
                              ]
                           }
                        }
                     }
                  },
                  "type": {
                     "title": "Type",
                     "const": "MultiPolygon",
                     "type": "string"
                  }
               },
               "required": [
                  "coordinates"
               ]
            },
            "Feature": {
               "title": "Feature",
               "description": "Feature Model",
               "type": "object",
               "properties": {
                  "type": {
                     "title": "Type",
                     "const": "Feature",
                     "type": "string"
                  },
                  "geometry": {
                     "title": "Geometry",
                     "anyOf": [
                        {
                           "$ref": "#/definitions/Point"
                        },
                        {
                           "$ref": "#/definitions/MultiPoint"
                        },
                        {
                           "$ref": "#/definitions/LineString"
                        },
                        {
                           "$ref": "#/definitions/MultiLineString"
                        },
                        {
                           "$ref": "#/definitions/Polygon"
                        },
                        {
                           "$ref": "#/definitions/MultiPolygon"
                        }
                     ]
                  },
                  "properties": {
                     "title": "Properties",
                     "type": "object"
                  },
                  "id": {
                     "title": "Id",
                     "type": "string"
                  },
                  "bbox": {
                     "title": "Bbox",
                     "anyOf": [
                        {
                           "type": "array",
                           "minItems": 4,
                           "maxItems": 4,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "type": "array",
                           "minItems": 6,
                           "maxItems": 6,
                           "items": [
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              },
                              {
                                 "anyOf": [
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "integer"
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  }
               },
               "required": [
                  "geometry"
               ]
            },
            "GeoFilter": {
               "title": "GeoFilter",
               "description": "GeoFilter class\nDescribes a spatial subset or interpolation",
               "type": "object",
               "properties": {
                  "type": {
                     "title": "Geofilter type",
                     "description": "\n        Type of the geofilter. Can be one of:\n            - 'feature': Select with a geojson feature\n            - 'bbox': Select with a bounding box\n            - 'radius': Select within radius of point\n        ",
                     "default": "bbox",
                     "allOf": [
                        {
                           "$ref": "#/definitions/GeoFilterType"
                        }
                     ]
                  },
                  "geom": {
                     "title": "Selection geometry",
                     "description": "\n            - For type='feature', geojson feature.\n            - For type='bbox', list[x_min,y_min,x_max,y_max] in CRS units.\n            - For type='radius', list[x0,y0,radius] in CRS units.\n        ",
                     "anyOf": [
                        {
                           "type": "array",
                           "items": {}
                        },
                        {
                           "$ref": "#/definitions/Feature"
                        }
                     ]
                  },
                  "resolution": {
                     "title": "Maximum spatial resolution of data",
                     "description": "Maximum resolution of the data for downsampling in CRS units",
                     "default": 0.0,
                     "type": "number"
                  }
               },
               "required": [
                  "geom"
               ]
            }
         }
      }

  Config

    - json_dumps: function = <function _orjson_dumps at 0x7f2e7574e3a0>

    - json_encoders: dict = {<class ‘numpy.datetime64’>: <class ‘str’>}

    - json_loads: builtin_function_or_method = <built-in function loads>

  Fields

    - `crs (Optional[Union[str, int]])`

    - `datasource (str)`

    - `description (Optional[str])`

    - `geofilter (Optional[oceanum.datamesh.query.GeoFilter])`

    - `parameters (Optional[Dict])`

    - `timefilter (Optional[oceanum.datamesh.query.TimeFilter])`

    - `variables (Optional[List[str]])`

  field crs: Optional[Union[str, int]] = 'EPSG:4326'

    Valid CRS string for returned data

  field datasource: str [Required]

    Datasource ID

  field description: Optional[str] = None

    Human readable description of this query

  field geofilter: Optional[oceanum.datamesh.query.GeoFilter] = None
  field parameters: Optional[Dict] = {}

    Dictionary of driver parameters to pass to datasource

  field timefilter: Optional[oceanum.datamesh.query.TimeFilter] = None

    Temporal filter or interplator

  field variables: Optional[List[str]] = None

    List of requested variables.

exception oceanum.datamesh.query.QueryError

  Bases: `Exception`

class oceanum.datamesh.query.ResampleType(value)

  Bases: `str`, `enum.Enum`

  An enumeration.

  mean = 'mean'

pydantic model oceanum.datamesh.query.TimeFilter

  Bases: `pydantic.main.BaseModel`

  TimeFilter class Describes a temporal subset or interpolation

  Show JSON schema

      {
         "title": "TimeFilter",
         "description": "TimeFilter class\nDescribes a temporal subset or interpolation",
         "type": "object",
         "properties": {
            "type": {
               "title": "Timefilter type",
               "description": "\n        Type of the timefilter. Can be one of:\n            - 'range': Select times within a range\n        ",
               "default": "range",
               "allOf": [
                  {
                     "$ref": "#/definitions/TimeFilterType"
                  }
               ]
            },
            "times": {
               "title": "Selection times",
               "description": "\n            - For type='range', [timestart, tend].\n        ",
               "type": "array",
               "items": {
                  "type": "string",
                  "format": "date-time"
               }
            },
            "resolution": {
               "title": "Temporal resolution of data",
               "description": "Maximum resolution of the data for temporal downsampling. Only valid with range type",
               "default": "native",
               "type": "string"
            },
            "resample": {
               "title": "Temporal resampling method",
               "description": "Resampling method applied when reducing tempral resolution. Only valid with range type",
               "default": "mean",
               "allOf": [
                  {
                     "$ref": "#/definitions/ResampleType"
                  }
               ]
            }
         },
         "required": [
            "times"
         ],
         "definitions": {
            "TimeFilterType": {
               "title": "TimeFilterType",
               "description": "An enumeration.",
               "enum": [
                  "range"
               ],
               "type": "string"
            },
            "ResampleType": {
               "title": "ResampleType",
               "description": "An enumeration.",
               "enum": [
                  "mean"
               ],
               "type": "string"
            }
         }
      }

  Fields

    - `resample (Optional[oceanum.datamesh.query.ResampleType])`

    - `resolution (Optional[str])`

    - `times (List[Optional[oceanum.datamesh.query.Timestamp]])`

    - `type (oceanum.datamesh.query.TimeFilterType)`

  field resample: Optional[oceanum.datamesh.query.ResampleType] = <ResampleType.mean: 'mean'>

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

  field resolution: Optional[str] = 'native'

    Maximum resolution of the data for temporal downsampling. Only valid with range type

  field times: List[Optional[oceanum.datamesh.query.Timestamp]] [Required]

    - For type=’range’, [timestart, tend].

  field type: oceanum.datamesh.query.TimeFilterType = <TimeFilterType.range: 'range'>
    Type of the timefilter. Can be one of:

      - ‘range’: Select times within a range

class oceanum.datamesh.query.TimeFilterType(value)

  Bases: `str`, `enum.Enum`

  An enumeration.

  range = 'range'

class oceanum.datamesh.query.Timestamp(ts_input=<object object>, freq=None, tz=None, unit=None, year=None, month=None, day=None, hour=None, minute=None, second=None, microsecond=None, nanosecond=None, tzinfo=None, *, fold=None)

  Bases: `pandas._libs.tslibs.timestamps.Timestamp`

  classmethod validate(v)

## Module contents