pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.62k stars 1.09k forks source link

Docstring of `open_zarr` fails to mention that `decode_coords` could be a string too #6405

Open gcaria opened 2 years ago

gcaria commented 2 years ago

What is your issue?

The docstring of open_zarr fails to mention that decode_coords could be a string too (and what the accepted string values mean)

https://github.com/pydata/xarray/blob/fed852073eee883c0ed1e13e28e508ff0cf9d5c1/xarray/backends/zarr.py#L687-L689

bastien-k commented 3 months ago

Additionally, because open_zarr default to decode_coords = True, decode_coords is interpreted as a boolean by static type checkers and type check will fail if we pass a string.

We should have:

decode_coords: Literal["coordinates", "all"] | bool | None = None,

as in: https://github.com/pydata/xarray/blob/d0048ef8e5c07b5290e9d2c4c144d23a45ab91f7/xarray/backends/api.py#L394-L413