Skip to content

Commit 07f6d88

Browse files
authored
Update xarray_container.py
1 parent 963a5be commit 07f6d88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

intake_xarray/xarray_container.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ def _persist(source, path, **kwargs):
155155
http://xarray.pydata.org/en/stable/generated/xarray.Dataset.to_zarr.html
156156
"""
157157
from intake_xarray import ZarrSource
158-
source.to_dask().to_zarr(path, **kwargs)
158+
ds = source.to_dask()
159+
if isinstance(ds, xr.DataArray):
160+
ds = ds.to_dataset(name=ds.name if ds.name else "variable")
161+
ds.to_zarr(path, **kwargs)
159162
return ZarrSource(path)
160163

0 commit comments

Comments
 (0)