Exemplo n.º 1
0
def test_rangetype(config):
    p = XarrayProvider(config)
    rangetype = p.get_coverage_rangetype()

    assert isinstance(rangetype, dict)
    assert len(rangetype['field']) == 4
    assert rangetype['field'][0]['name'] == 'SEA SURFACE TEMPERATURE'
Exemplo n.º 2
0
def test_rangetype(config):
    p = XarrayProvider(config)
    rangetype = p.get_coverage_rangetype()

    assert isinstance(rangetype, dict)
    assert len(rangetype['field']) == 4
    assert rangetype['field'][0]['name'] == 'analysed sea surface temperature'
Exemplo n.º 3
0
def test_query(config):
    p = XarrayProvider(config)

    data = p.query()
    assert isinstance(data, dict)

    data = p.query(format_='zarr')
    assert isinstance(data, bytes)
Exemplo n.º 4
0
def test_domainset(config):
    p = XarrayProvider(config)
    domainset = p.get_coverage_domainset()

    assert isinstance(domainset, dict)
    assert domainset['generalGrid']['axisLabels'] == ['lon', 'lat']
    assert domainset['generalGrid']['gridLimits']['axisLabels'] == ['i', 'j']
    assert domainset['generalGrid']['gridLimits']['axis'][0][
        'upperBound'] == 101  # noqa
    assert domainset['generalGrid']['gridLimits']['axis'][1][
        'upperBound'] == 101  # noqa
Exemplo n.º 5
0
    def __init__(self, provider_def):
        """
        Initialize object

        :param provider_def: provider definition

        :returns: pygeoapi.provider.rasterio_.RasterioProvider
        """

        BaseEDRProvider.__init__(self, provider_def)
        XarrayProvider.__init__(self, provider_def)
Exemplo n.º 6
0
def test_domainset(config):
    p = XarrayProvider(config)
    domainset = p.get_coverage_domainset()

    assert isinstance(domainset, dict)
    assert domainset['generalGrid']['axisLabels'] == [
        'COADSX', 'COADSY', 'TIME'
    ]  # noqa
    assert domainset['generalGrid']['gridLimits']['axisLabels'] == ['i', 'j']
    assert domainset['generalGrid']['gridLimits']['axis'][0][
        'upperBound'] == 180  # noqa
    assert domainset['generalGrid']['gridLimits']['axis'][1][
        'upperBound'] == 90  # noqa
Exemplo n.º 7
0
def test_query(config):
    p = XarrayProvider(config)

    data = p.query()
    assert isinstance(data, dict)

    data = p.query(format_='NetCDF')
    assert isinstance(data, bytes)

    data = p.query(datetime_='2000-01-16')
    assert isinstance(data, dict)

    data = p.query(datetime_='2000-01-16/2000-04-16')
    assert isinstance(data, dict)

    with pytest.raises(ProviderQueryError):
        data = p.query(datetime_='2010-01-16')
Exemplo n.º 8
0
def test_provider(config):
    p = XarrayProvider(config)

    assert len(p.fields) == 4
    assert len(p.axes) == 3
    assert p.axes == ['lon', 'lat', 'time']
Exemplo n.º 9
0
def test_provider(config):
    p = XarrayProvider(config)

    assert len(p.fields) == 4
    assert len(p.axes) == 3
    assert p.axes == ['COADSX', 'COADSY', 'TIME']
Exemplo n.º 10
0
def test_query(config):
    p = XarrayProvider(config)

    data = p.query()
    assert isinstance(data, dict)