Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem accessing TerraClimate: open_zarr() got unexpected keyword arguments engine #172

Closed
tomconte opened this issue Jan 26, 2023 · 3 comments

Comments

@tomconte
Copy link
Member

Hi all, since today we are getting the following error when accessing the TerraClimate dataset:

products/biodiversity/src/stac_data_loader.py:557: in load_data
    ds = xr.open_zarr(mapper, **asset.extra_fields["xarray:open_kwargs"])

[...]

        if kwargs:
>           raise TypeError(
                "open_zarr() got unexpected keyword arguments " + ",".join(kwargs.keys())
            )
E           TypeError: open_zarr() got unexpected keyword arguments engine

It looks like open_zarr() does not like the new argument engine that was added to xarray:open_kwargs?

I added the following line to fix the problem:

asset.extra_fields["xarray:open_kwargs"].pop("engine", None)
@TomAugspurger
Copy link

Hi @tomconte, yes the release today adopted a new version of the xarray-assets extension. Sorry for the churn, but you'll want to update your code to use

ds = xr.open_dataset(asset.href, **asset.extra_fields["xarray:open_kwargs"]

See https://planetarycomputer.microsoft.com/docs/overview/changelog#other-dataset-updates. Our example notebook has been updated as well.

@TomAugspurger
Copy link

This also highlights the need for something like stac-utils/pystac#846. It'd be easier for a single library to manage all the different ways of specifying these kinds of details than every needing to worry about it.

@tomconte
Copy link
Member Author

Thanks Tom!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants