diff --git a/tests/conftest.py b/tests/conftest.py index 49bd5a8..7e7e4fb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -49,3 +49,9 @@ def simple_zarr() -> pystac.Asset: catalog = pystac_client.Client.open(STAC_URLS["PLANETARY-COMPUTER"]) collection = catalog.get_collection("daymet-daily-hi") return collection.assets["zarr-abfs"] + + +@pytest.fixture(scope="module") +def complex_zarr(simple_zarr) -> pystac.Asset: + simple_zarr.extra_fields["xarray:open_kwargs"]["engine"] = "zarr" + return simple_zarr diff --git a/tests/test_core.py b/tests/test_core.py index e8c13e8..bb6559a 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -30,4 +30,9 @@ def test_to_xarray_reference_file(simple_reference_file): def test_to_xarray_zarr(simple_zarr): ds = to_xarray(simple_zarr) - ds + assert ds + + +def test_to_xarray_zarr_with_open_kwargs_engine(complex_zarr): + ds = to_xarray(complex_zarr) + assert ds diff --git a/xpystac/core.py b/xpystac/core.py index f825b44..4d5a18c 100644 --- a/xpystac/core.py +++ b/xpystac/core.py @@ -64,5 +64,5 @@ def _(obj: pystac.Asset, **kwargs) -> xarray.Dataset: else: default_kwargs = {} - ds = xarray.open_dataset(obj.href, **default_kwargs, **open_kwargs, **kwargs) + ds = xarray.open_dataset(obj.href, **{**default_kwargs, **open_kwargs, **kwargs}) return ds