-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DataArrays to/from Zarr Arrays #2660
Comments
Take a look at |
We created https://github.com/carbonplan/xrefcoord to generate coordinates from GeoTiff metadata using kerchunk reference files and xarray without needing to store the coordinates. As discussed in fsspec/kerchunk#313, the ability to open Zarr arrays in xarray would allow using kerchunk on a broader set of GeoTIFFs but would require experience with the backend code and/or non-trivial amounts of time. Do you think using xarray's flexible backends with zarrita could provide a way to both solve this problem and experiment with the most recent v3 spec in xarray without requiring as much experience with xarray's current backend code? |
The functionality to call |
They primary functionality we found missing in fsspec/kerchunk#313 was the ability to open Zarr arrays as xarray DataArrays. afaik #7692 allows dataarrays to be written to Zarr groups, and Zarr groups can be read as datasets, but Zarr arrays still cannot be read by Xarray. The ability to directly read Zarr arrays would be extremely helpful for reading data objects created outside Xarray. |
Hi, is there any update on this? |
For everyone interested in this feature: we would welcome a PR! It should be a straightforward extension of open_dataaaray. The xarray core dev team would be happy to provide support and advice along the way. To get started, check out the contributing guide. |
Hi @rabernat, import xarray as xr
ds = xr.open_zarr(path)
array = ds.to_array(dim='extra').squeeze('extra') That seems to work easily enough. |
Right now,
open_zarr
andDataset.to_zarr
only work with Zarr groups. Zarr Groups can contain multiple Array objects.It would be nice if we could open Zarr Arrays directly as xarray DataArrays and write xarray DataArrays directly to Zarr Arrays.
However, this might not make sense, because, unlike xarray DataArrays, zarr Arrays can't hold any coordinates.
Just raising this idea for discussion.
The text was updated successfully, but these errors were encountered: