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

ENH: Sign storage_options in xarray:open_kwargs #36

Merged
merged 2 commits into from
Mar 27, 2022

Conversation

TomAugspurger
Copy link

Recent-ish versions of xarray natively support expanding fsspec URLs
and forwarding storage options. This enables

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

rather than the wordier

>>> store = fsspec.get_mapper(asset.href, **asset.extra_fields["xarray:storage_options"])
>>> ds = xr.open_dataset(store, **asset.extra_fields["xarray:open_kwargs])

This PR supports signing the version of assets where storage_options are nested under xarray:open_kwargs or xarray:open_kwargs.backend_kwargs.

Tom Augspurger added 2 commits March 27, 2022 11:56
Recent-ish versions of xarray natively support expanding fsspec URLs
and forwarding storage options. This enables

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

rather than the wordier

```python
>>> store = fsspec.get_mapper(asset.href, **asset.extra_fields["xarray:storage_options"])
>>> ds = xr.open_dataset(store, **asset.extra_fields["xarray:open_kwargs])
```
@TomAugspurger TomAugspurger merged commit ff8ba6c into main Mar 27, 2022
@TomAugspurger TomAugspurger deleted the feature/sign-open-kwargs branch March 27, 2022 17:04
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

Successfully merging this pull request may close these issues.

1 participant