Skip to content

added image to docs explaining drop_axis option of map_blocks()#8868

Merged
jsignell merged 1 commit intodask:mainfrom
ParticularMiner:drop_axis
Apr 1, 2022
Merged

added image to docs explaining drop_axis option of map_blocks()#8868
jsignell merged 1 commit intodask:mainfrom
ParticularMiner:drop_axis

Conversation

@ParticularMiner
Copy link
Copy Markdown
Contributor

Does this image help to clarify the docs on the drop_axis option of map_blocks()?

@github-actions github-actions bot added array documentation Improve or add to documentation labels Mar 31, 2022
@ParticularMiner ParticularMiner changed the title added image to explain drop_axis option of map_blocks() added image to docs explaining drop_axis option of map_blocks() Mar 31, 2022
@jsignell
Copy link
Copy Markdown
Member

Thanks for opening this @ParticularMiner! I actually think this behavior is undesirable, so I'm going to see if I can get it working more how I expect, but this is definitely how it works now so we should still merge this in the meantime. It looks like the docs is not rendering quite right though - probably needs some whitespace. You can see the preview here: https://dask--8868.org.readthedocs.build/en/8868/generated/dask.array.map_blocks.html

@ParticularMiner ParticularMiner force-pushed the drop_axis branch 4 times, most recently from 6433355 to 508159c Compare March 31, 2022 18:22
@github-actions github-actions bot removed the documentation Improve or add to documentation label Mar 31, 2022
@ParticularMiner
Copy link
Copy Markdown
Contributor Author

Many thanks for that link @jsignell ! Just what I was looking for!

I'm still struggling to find the correct code to embed the image in the docstring, though. Any idea on how to do that?

Regarding the expected behavior of map_blocks(..., drop_axis=x), I've just noticed the following comments in the source code of map_blocks() itself:

dask/dask/array/core.py

Lines 869 to 872 in e49880b

if drop_axis:
# We concatenate along dropped axes, so we need to treat them
# as if there is only a single chunk.
starts[i] = [

Moreover, there seem to be other functions and tests in dask that depend on or test this behavior.

@ParticularMiner ParticularMiner marked this pull request as draft March 31, 2022 18:57
@github-actions github-actions bot added the documentation Improve or add to documentation label Mar 31, 2022
@ParticularMiner ParticularMiner force-pushed the drop_axis branch 5 times, most recently from 4fe6968 to bcf865e Compare March 31, 2022 23:39
@github-actions github-actions bot removed the documentation Improve or add to documentation label Mar 31, 2022
@github-actions github-actions bot added the documentation Improve or add to documentation label Apr 1, 2022
@ParticularMiner ParticularMiner force-pushed the drop_axis branch 5 times, most recently from 5485633 to 3af9a36 Compare April 1, 2022 02:01
@ParticularMiner
Copy link
Copy Markdown
Contributor Author

I finally succeeded in embedding the image! 🎉

It turned out that I needed to use an absolute file path rather than a relative file path to the image file.

You can see the preview (same link as above) here:
https://dask--8868.org.readthedocs.build/en/8868/generated/dask.array.map_blocks.html

@ParticularMiner ParticularMiner marked this pull request as ready for review April 1, 2022 02:11
I used the absolute rather than relative path to embed the image in the
docstring.  The latter fails.
@jsignell
Copy link
Copy Markdown
Member

jsignell commented Apr 1, 2022

Thanks for persevering!

@jsignell jsignell merged commit 3f119f7 into dask:main Apr 1, 2022
@ParticularMiner ParticularMiner deleted the drop_axis branch April 4, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

array documentation Improve or add to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unwanted aggregation map_blocks

2 participants