implement base EDR provider
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
# =================================================================
|
||||
#
|
||||
# Authors: Tom Kralidis <tomkralidis@gmail.com>
|
||||
#
|
||||
# Copyright (c) 2021 Tom Kralidis
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
# files (the "Software"), to deal in the Software without
|
||||
# restriction, including without limitation the rights to use,
|
||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following
|
||||
# conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# =================================================================
|
||||
|
||||
import logging
|
||||
|
||||
from pygeoapi.provider.base import BaseProvider
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BaseEDRProvider(BaseProvider):
|
||||
"""Base EDR Provider"""
|
||||
|
||||
def __init__(self, provider_def):
|
||||
"""
|
||||
Initialize object
|
||||
|
||||
:param provider_def: provider definition
|
||||
|
||||
:returns: pygeoapi.provider.base_edr.BaseEDRProvider
|
||||
"""
|
||||
|
||||
super().__init__(provider_def)
|
||||
|
||||
self.instances = []
|
||||
|
||||
def get_instance(self, instance):
|
||||
"""
|
||||
Validate instance identifier
|
||||
|
||||
:returns: `bool` of whether instance is valid
|
||||
"""
|
||||
|
||||
return NotImplementedError()
|
||||
|
||||
def get_query_types(self):
|
||||
"""
|
||||
Provide supported query types
|
||||
|
||||
:returns: `list` of EDR query types
|
||||
"""
|
||||
|
||||
return NotImplementedError()
|
||||
|
||||
def query(self, **kwargs):
|
||||
"""
|
||||
Extract data from collection collection
|
||||
|
||||
:param query_type: query type
|
||||
:param wkt: `shapely.geometry` WKT geometry
|
||||
:param datetime_: temporal (datestamp or extent)
|
||||
:param select_properties: list of parameters
|
||||
:param z: vertical level(s)
|
||||
:param format_: data format of output
|
||||
|
||||
:returns: coverage data as `dict` of CoverageJSON or native format
|
||||
"""
|
||||
|
||||
return NotImplementedError()
|
||||
@@ -30,12 +30,13 @@
|
||||
import logging
|
||||
|
||||
from pygeoapi.provider.base import ProviderNoDataError
|
||||
from pygeoapi.provider.base_edr import BaseEDRProvider
|
||||
from pygeoapi.provider.xarray_ import _to_datetime_string, XarrayProvider
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class XarrayEDRProvider(XarrayProvider):
|
||||
class XarrayEDRProvider(BaseEDRProvider, XarrayProvider):
|
||||
"""EDR Provider"""
|
||||
|
||||
def __init__(self, provider_def):
|
||||
@@ -47,8 +48,8 @@ class XarrayEDRProvider(XarrayProvider):
|
||||
:returns: pygeoapi.provider.rasterio_.RasterioProvider
|
||||
"""
|
||||
|
||||
BaseEDRProvider.__init__(self, provider_def)
|
||||
XarrayProvider.__init__(self, provider_def)
|
||||
self.instances = []
|
||||
|
||||
def get_fields(self):
|
||||
"""
|
||||
@@ -59,15 +60,6 @@ class XarrayEDRProvider(XarrayProvider):
|
||||
|
||||
return self.get_coverage_rangetype()
|
||||
|
||||
def get_instance(self, instance):
|
||||
"""
|
||||
Validate instance identifier
|
||||
|
||||
:returns: `bool` of whether instance is valid
|
||||
"""
|
||||
|
||||
return NotImplementedError()
|
||||
|
||||
def get_query_types(self):
|
||||
"""
|
||||
Provide supported query types
|
||||
|
||||
Reference in New Issue
Block a user