Skip to content

Commit

Permalink
Rename map_blocks tasks. (#5007)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Mar 26, 2021
1 parent 8452120 commit 643e89e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3714,7 +3714,7 @@ def map_blocks(
... calculate_anomaly, kwargs={"groupby_type": "time.year"}, template=array
... ) # doctest: +ELLIPSIS
<xarray.DataArray (time: 24)>
dask.array<calculate_anomaly-...-<this, shape=(24,), dtype=float64, chunksize=(24,), chunktype=numpy.ndarray>
dask.array<<this-array>-calculate_anomaly, shape=(24,), dtype=float64, chunksize=(24,), chunktype=numpy.ndarray>
Coordinates:
* time (time) object 1990-01-31 00:00:00 ... 1991-12-31 00:00:00
month (time) int64 dask.array<chunksize=(24,), meta=np.ndarray>
Expand Down
12 changes: 6 additions & 6 deletions xarray/core/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def make_meta(obj):
"""
if isinstance(obj, DataArray):
obj_array = obj
obj = obj._to_temp_dataset()
obj = dataarray_to_dataset(obj)
elif isinstance(obj, Dataset):
obj_array = None
else:
Expand All @@ -116,7 +116,7 @@ def make_meta(obj):
meta = meta.set_coords(obj.coords)

if obj_array is not None:
return obj_array._from_temp_dataset(meta)
return dataset_to_dataarray(meta)
return meta


Expand Down Expand Up @@ -258,7 +258,7 @@ def map_blocks(
... template=array,
... ) # doctest: +ELLIPSIS
<xarray.DataArray (time: 24)>
dask.array<calculate_anomaly-...-<this, shape=(24,), dtype=float64, chunksize=(24,), chunktype=numpy.ndarray>
dask.array<<this-array>-calculate_anomaly, shape=(24,), dtype=float64, chunksize=(24,), chunktype=numpy.ndarray>
Coordinates:
* time (time) object 1990-01-31 00:00:00 ... 1991-12-31 00:00:00
month (time) int64 dask.array<chunksize=(24,), meta=np.ndarray>
Expand Down Expand Up @@ -448,7 +448,7 @@ def subset_dataset_to_block(
for dim in variable.dims:
chunk = chunk[chunk_index[dim]]

chunk_variable_task = (f"{gname}-{name}-{chunk[0]}",) + chunk_tuple
chunk_variable_task = (f"{name}-{gname}-{chunk[0]}",) + chunk_tuple
graph[chunk_variable_task] = (
tuple,
[variable.dims, chunk, variable.attrs],
Expand All @@ -462,7 +462,7 @@ def subset_dataset_to_block(
}
subset = variable.isel(subsetter)
chunk_variable_task = (
"{}-{}".format(gname, dask.base.tokenize(subset)),
f"{name}-{gname}-{dask.base.tokenize(subset)}",
) + chunk_tuple
graph[chunk_variable_task] = (
tuple,
Expand Down Expand Up @@ -512,7 +512,7 @@ def subset_dataset_to_block(
for name, variable in template.variables.items():
if name in indexes:
continue
gname_l = f"{gname}-{name}"
gname_l = f"{name}-{gname}"
var_key_map[name] = gname_l

key: Tuple[Any, ...] = (gname_l,)
Expand Down

0 comments on commit 643e89e

Please sign in to comment.