Skip to content
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

Rename map_blocks tasks. #5007

Merged
merged 5 commits into from
Mar 26, 2021
Merged

Conversation

dcherian
Copy link
Contributor

@dcherian dcherian commented Mar 7, 2021

This makes it clearer which tasks are subsetting xarray objects, vs.
actually running the user provided function.

  • Tests added
  • Passes pre-commit run --all-files
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst
import dask

import xarray as xr

da = xr.DataArray(
    dask.array.zeros((10,), chunks=(3,)),
    dims="dim_0",
    coords={"a": (("dim_0",), np.arange(10))},
    name="data"
)


def func(a):
    return a.dim_0


da.map_blocks(func).data.visualize()

before

image

after

image

This makes it clearer which tasks are subsetting xarray objects, vs.
actually running the user provided function.
@dcherian
Copy link
Contributor Author

dcherian commented Mar 8, 2021

Note users have been confused by our previous choice of names: https://stackoverflow.com/questions/65320657/resample-and-groupby-on-big-dask-array-with-xarray-using-map-blocks

Final version:
image

@@ -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>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"this-array" is misleading but attempting to fix it breaks many tests...

@dcherian
Copy link
Contributor Author

merging in a couple of days if no one has any comments.

…-tasks

* upstream/master:
  Fix regression in decoding large standard calendar times (pydata#5050)
  Fix sticky sidebar responsiveness on small screens (pydata#5039)
  Flexible indexes refactoring notes (pydata#4979)
  add a install xarray step to the upstream-dev CI (pydata#5044)
  Adds Dataset.query() method, analogous to pandas DataFrame.query() (pydata#4984)
  run tests on python 3.9 (pydata#5040)
  Add date attribute to datetime accessor (pydata#4994)
  📚 New theme & rearrangement of the docs (pydata#4835)
  upgrade ci-trigger to the most recent version (pydata#5037)
  GH5005 fix documentation on open_rasterio (pydata#5021)
  GHA for automatically canceling previous CI runs (pydata#5025)
  Implement GroupBy.__getitem__ (pydata#3691)
  conventions: decode unsigned integers to signed if _Unsigned=false (pydata#4966)
  Added support for numpy.bool_ (pydata#4986)
  Add additional str accessor methods for DataArray (pydata#4622)
  add polyval to polyfit see also (pydata#5020)
  mention map_blocks in the docstring of apply_ufunc (pydata#5011)
  Switch backend API to v2 (pydata#4989)
  WIP: add new backend api documentation (pydata#4810)
  pin netCDF4=1.5.3 in min-all-deps (pydata#4982)
@dcherian dcherian merged commit 643e89e into pydata:master Mar 26, 2021
@dcherian dcherian deleted the rename-map-blocks-tasks branch March 26, 2021 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants