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

Pass chunks as a parameter to save_array #2823

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcfaracco
Copy link

I'm having issues to save a Numpy array with chunks and load them as a Dask Array with different chunks.

Some example (current behavior):

import dask.array as da
import numpy as np
import zarr

array = np.random.random(10000)
zarr.save_array("/tmp/data.zarr", data)
darray = da.from_zarr("/tmp/data.zarr/")

print(ddata.chunks)     # Output ((10000,),)

Whis this change, users should be able to define the chunk to save.

import dask.array as da
import numpy as np
import zarr

array = np.random.random(10000)
zarr.save_array("/tmp/data.zarr", data, chunks=(100))
darray = da.from_zarr("/tmp/data.zarr/")

print(ddata.chunks)     # Output ((100,),)

This PR does not have a unit test because the unit tests for save_array are with comments.

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Feb 13, 2025
Some Numpy arrays-like does not have chunks attribute. We should be able
to save chunks of the array somehow. One suggestion is passing the
argument to the function.

Signed-off-by: Julio Faracco <jfaracco@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs release notes Automatically applied to PRs which haven't added release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant