diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index f35db00..630692e 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -66,4 +66,4 @@ jobs: - name: Test with pytest shell: bash -l {0} - run: poetry run pytest --verbose tests/ + run: poetry run pytest --verbose deepicedrain/ diff --git a/deepicedrain/__init__.py b/deepicedrain/__init__.py index 7133c2a..8711e68 100644 --- a/deepicedrain/__init__.py +++ b/deepicedrain/__init__.py @@ -1,10 +1,18 @@ +import importlib.resources +import logging + import intake + +import deepicedrain from deepicedrain.deltamath import calculate_delta from deepicedrain.spatiotemporal import Region __version__: str = "0.1.0" # Loads the ICESat-2 ATLAS intake data catalog -catalog: intake.catalog.local.YAMLFileCatalog = intake.open_catalog( - uri="atlas_catalog.yaml" +_catalog_path = importlib.resources.path( + package=deepicedrain, resource="atlas_catalog.yaml" ) +with _catalog_path as uri: + logging.info(f"Loading intake catalog from {uri}") + catalog: intake.catalog.local.YAMLFileCatalog = intake.open_catalog(uri=str(uri)) diff --git a/atlas_catalog.yaml b/deepicedrain/atlas_catalog.yaml similarity index 98% rename from atlas_catalog.yaml rename to deepicedrain/atlas_catalog.yaml index 865841f..ea16697 100644 --- a/atlas_catalog.yaml +++ b/deepicedrain/atlas_catalog.yaml @@ -105,7 +105,7 @@ sources: coastline: True test_data: args: - path: tests/test_catalog.yaml + path: '{{ CATALOG_DIR }}/tests/test_catalog.yaml' description: 'Sample ICESat-2 datasets for testing purposes' driver: intake.catalog.local.YAMLFileCatalog metadata: {} diff --git a/tests/__init__.py b/deepicedrain/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to deepicedrain/tests/__init__.py diff --git a/tests/test_calculate_delta.py b/deepicedrain/tests/test_calculate_delta.py similarity index 100% rename from tests/test_calculate_delta.py rename to deepicedrain/tests/test_calculate_delta.py diff --git a/tests/test_catalog.yaml b/deepicedrain/tests/test_catalog.yaml similarity index 100% rename from tests/test_catalog.yaml rename to deepicedrain/tests/test_catalog.yaml diff --git a/tests/test_deepicedrain.py b/deepicedrain/tests/test_deepicedrain.py similarity index 100% rename from tests/test_deepicedrain.py rename to deepicedrain/tests/test_deepicedrain.py diff --git a/tests/test_region.py b/deepicedrain/tests/test_region.py similarity index 100% rename from tests/test_region.py rename to deepicedrain/tests/test_region.py diff --git a/pyproject.toml b/pyproject.toml index e7040e9..24bcbf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,9 @@ black = "^19.10b0" jupytext = "^1.4.2" pytest = "^5.4.2" +[tool.poetry.plugins."intake.catalogs"] +"atlas_cat" = "deepicedrain:catalog" + [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api"