diff --git a/xarray/backends/zarr.py b/xarray/backends/zarr.py index 12b6053fe55..a5c4d7a1604 100644 --- a/xarray/backends/zarr.py +++ b/xarray/backends/zarr.py @@ -892,9 +892,13 @@ def set_variables(self, variables, check_encoding_set, writer, unlimited_dims=No else: kwargs["store"] = self.zarr_group.chunk_store + # TODO: see if zarr should normalize these strings. zarr_array = zarr.open( **kwargs, - path=f"{self.zarr_group.name}/{name}", + # path=f"{self.zarr_group.name}/{name}", + path="/".join([self.zarr_group.name.rstrip("/"), name]).lstrip( + "/" + ), write_empty_chunks=self._write_empty, ) else: