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
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
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
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
def test_init_catalog_with_bad_url_raises(): with pytest.raises(satstac.STACError): StacCatalog('foo.bar')
def cat(stac_cat_url): return StacCatalog.from_url(stac_cat_url)
def test_init_catalog_with_bad_url_raises(): # json.decoder.JSONDecodeError or FileNotFoundError with pytest.raises(Exception): StacCatalog('https://raw.githubusercontent.com/')
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