Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!



def test_to_xarray_zarr_with_open_kwargs_engine(complex_zarr):
ds = to_xarray(complex_zarr)
assert ds
2 changes: 1 addition & 1 deletion xpystac/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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