add example and a test on using specific chunk sizes in from_array()#7330
add example and a test on using specific chunk sizes in from_array()#7330jsignell merged 2 commits intodask:masterfrom jameslamb:custom-chunk-size-test
Conversation
jsignell
left a comment
There was a problem hiding this comment.
Thanks for opening this @jameslamb! I think the docstring change is definitely an improvement, but the test case is already covered, most of the tests for arrays are nested within the array dir. You can persuade yourself that the error case is being tested (this is what I just did) by changing ValueError to KeyError here
Line 2761 in fb54414
pytest -k array -n auto to see the failures.
oh! I did not realize that that tests were spread across multiple directories so I only checked with removed in c1dcb56 |
* upstream/main: Change default branch from master to main (dask#7198) Add Xarray to CI software environment (dask#7338) Update repartition argument name in error text (dask#7336) Run upstream tests based on commit message (dask#7329) Use pytest.register_assert_rewrite on util modules (dask#7278) add example on using specific chunk sizes in from_array() (dask#7330) Move numpy skip into test (dask#7247)
black dask/flake8 daskI recently found a need to convert a
numpy2D array into a 2-chunk Dask Array with exactly-specified, different sized chunks. I consulted the documentation at https://docs.dask.org/en/latest/array-api.html#dask.array.from_array but couldn't understand how to do this correctly, which led to me opening #7310. The way this works was explained to me in #7310 and that issue was closed.Based on my experience with this feature of Dask Array, in this PR I'd like to propose two small changes:
from_array()that shows how to explicitly control chunk sizesgit grep from_array dask/tests)Thanks for your time and consideration.