示例#1
0
def test_init_catalog_from_satstac_obj(stac_cat_obj):
    cat = StacCatalog(stac_cat_obj)
    assert isinstance(cat, intake.catalog.Catalog)
    assert cat.discover()['container'] == 'catalog'
    assert cat.name == 'stac-catalog'
    assert cat.name == stac_cat_obj.id

    # test kwargs are passed through
    cat = StacCatalog(stac_cat_obj, name='intake-stac-test')
    assert 'intake-stac-test' == cat.name
示例#2
0
def test_init_catalog_from_satstac_obj(stac_cat_obj):
    cat = StacCatalog(stac_cat_obj)
    assert isinstance(cat, intake.catalog.Catalog)
    assert cat.discover()["container"] == "catalog"
    assert cat.name == "stac"
    assert cat.name == stac_cat_obj.id

    # test kwargs are passed through
    cat = StacCatalog(stac_cat_obj, name="intake-stac-test")
    assert "intake-stac-test" == cat.name
示例#3
0
def test_init_catalog_from_url(stac_cat_url):
    cat = StacCatalog(stac_cat_url)
    assert isinstance(cat, intake.catalog.Catalog)
    assert cat.name == "stac"
    assert cat.discover()["container"] == "catalog"

    cat = StacCatalog.from_url(stac_cat_url)
    assert isinstance(cat, intake.catalog.Catalog)
    assert cat.name == "stac"
    assert cat.discover()["container"] == "catalog"

    # test kwargs are passed through
    cat = StacCatalog.from_url(stac_cat_url, name="intake-stac-test")
    assert "intake-stac-test" == cat.name
示例#4
0
def test_init_catalog_from_url(stac_cat_url):
    cat = StacCatalog(stac_cat_url)
    assert isinstance(cat, intake.catalog.Catalog)
    assert cat.name == 'stac-catalog'
    assert cat.discover()['container'] == 'catalog'
    assert int(cat.metadata['stac_version'][0]) >= 1

    cat = StacCatalog.from_url(stac_cat_url)
    assert isinstance(cat, intake.catalog.Catalog)
    assert cat.name == 'stac-catalog'
    assert cat.discover()['container'] == 'catalog'
    assert int(cat.metadata['stac_version'][0]) >= 1

    # test kwargs are passed through
    cat = StacCatalog.from_url(stac_cat_url, name='intake-stac-test')
    assert 'intake-stac-test' == cat.name
示例#5
0
def test_init_catalog_with_bad_url_raises():
    with pytest.raises(satstac.STACError):
        StacCatalog('foo.bar')
示例#6
0
def cat(stac_cat_url):
    return StacCatalog.from_url(stac_cat_url)
示例#7
0
def test_init_catalog_with_bad_url_raises():
    # json.decoder.JSONDecodeError or FileNotFoundError
    with pytest.raises(Exception):
        StacCatalog('https://raw.githubusercontent.com/')
示例#8
0
def intake_stac_cat():
    return StacCatalog.from_url(cat_url)
from intake_stac import StacCatalog, StacCollection, StacItem

cat = StacCatalog('catalog.json')
print(list(cat))
item = cat['test_netcdf']
print(item)
item_dask = item.to_dask()  #need to get plugin recognized here