Closed
Description
import xarray as xr
import numpy as np
def make_da():
return xr.DataArray(
np.ones((10, 20)),
dims=["x", "y"],
coords={"x": np.arange(10), "y": np.arange(100, 120),},
name="a",
).chunk({"x": 4, "y": 5})
map_da = make_da()
map_ds = xr.Dataset()
map_ds["a"] = make_da()
map_ds["c"] = map_ds.x + 20
map_ds = map_ds.chunk({"x": 4, "y": 5})
<xarray.Dataset>
Dimensions: (x: 10, y: 20)
Coordinates:
* x (x) int64 0 1 2 3 4 5 6 7 8 9
* y (y) int64 100 101 102 103 104 105 106 ... 114 115 116 117 118 119
Data variables:
a (x, y) float64 dask.array<chunksize=(4, 5), meta=np.ndarray>
c (x) int64 dask.array<chunksize=(4,), meta=np.ndarray>
(map_ds + map_ds.y)
gives y
chunksize of 20 for c
and 5 for a
(map_ds + map_ds.y)
<xarray.Dataset>
Dimensions: (x: 10, y: 20)
Coordinates:
* x (x) int64 0 1 2 3 4 5 6 7 8 9
* y (y) int64 100 101 102 103 104 105 106 ... 114 115 116 117 118 119
Data variables:
a (x, y) float64 dask.array<chunksize=(4, 5), meta=np.ndarray>
c (x, y) int64 dask.array<chunksize=(4, 20), meta=np.ndarray>
This seems reasonable except (map_ds + map_ds.y).chunks)
raises an "Inconsistent chunks" error.
I ran into this writing tests for map_blocks.
Metadata
Metadata
Assignees
Labels
No labels