diff --git a/pangeo_forge_recipes/recipes/base.py b/pangeo_forge_recipes/recipes/base.py index fca8deae..74bc9cfa 100644 --- a/pangeo_forge_recipes/recipes/base.py +++ b/pangeo_forge_recipes/recipes/base.py @@ -14,6 +14,7 @@ @dataclass class BaseRecipe(ABC): + dataset_type: ClassVar[str] _compiler: ClassVar[RecipeCompiler] _hash_exclude_ = ["storage_config"] sha256: Optional[bytes] = None diff --git a/pangeo_forge_recipes/recipes/reference_hdf_zarr.py b/pangeo_forge_recipes/recipes/reference_hdf_zarr.py index 0ec1a1db..8988b1e3 100644 --- a/pangeo_forge_recipes/recipes/reference_hdf_zarr.py +++ b/pangeo_forge_recipes/recipes/reference_hdf_zarr.py @@ -148,6 +148,7 @@ class HDFReferenceRecipe(BaseRecipe, StorageMixin, FilePatternMixin): :param postprocess: a function applied to the global combined references before write """ + dataset_type = "kerchunk" _compiler = hdf_reference_recipe_compiler # TODO: support chunked ("tree") aggregation: would entail processing each file diff --git a/pangeo_forge_recipes/recipes/xarray_zarr.py b/pangeo_forge_recipes/recipes/xarray_zarr.py index 9c80cccd..ba12c180 100644 --- a/pangeo_forge_recipes/recipes/xarray_zarr.py +++ b/pangeo_forge_recipes/recipes/xarray_zarr.py @@ -761,6 +761,7 @@ class XarrayZarrRecipe(BaseRecipe, StorageMixin, FilePatternMixin): the file with Xarray as a virtual Zarr dataset. """ + dataset_type = "zarr" _compiler = xarray_zarr_recipe_compiler inputs_per_chunk: int = 1 diff --git a/tests/recipe_tests/test_HDFReferenceRecipe.py b/tests/recipe_tests/test_HDFReferenceRecipe.py index bcf8ff97..a1ffe865 100644 --- a/tests/recipe_tests/test_HDFReferenceRecipe.py +++ b/tests/recipe_tests/test_HDFReferenceRecipe.py @@ -39,6 +39,8 @@ def test_single( execute_recipe(recipe) + assert recipe.dataset_type == "kerchunk" + assert out_target.exists("reference.json") assert out_target.exists("reference.yaml") diff --git a/tests/recipe_tests/test_XarrayZarrRecipe.py b/tests/recipe_tests/test_XarrayZarrRecipe.py index 3c3f7ff5..c430d9ce 100644 --- a/tests/recipe_tests/test_XarrayZarrRecipe.py +++ b/tests/recipe_tests/test_XarrayZarrRecipe.py @@ -138,6 +138,8 @@ def test_recipe(recipe_fixture, execute_recipe): RecipeClass, file_pattern, kwargs, ds_expected, target = recipe_fixture rec = RecipeClass(file_pattern, **kwargs) + assert isinstance(rec.dataset_type, str) + assert rec.dataset_type == "zarr" execute_recipe(rec) ds_actual = xr.open_zarr(target.get_mapper()).load() assert_identical(ds_actual, ds_expected)