-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add chunks argument to {zeros/ones/empty}_like. #5144
Comments
If #8251 were solved, we could do: xr.DataArray().chunk(42).broadcast_like(ds) In the place of that, we can do a hack: xr.DataArray([1]).chunk(2).broadcast_like(ds).squeeze('dim_0') (where I would have a preference for using orthogonal methods like Do you think that works for your case @nbren12 ? |
I think these array creation functions are almost always going to be messy if we want to support all the array types in them. It just happens that there is a dask-specific method. Like we might want to pass We could accept a |
+1 |
Wait this was added at some point: https://docs.xarray.dev/en/stable/generated/xarray.zeros_like.html
|
Ha! OK, well, ask and ye shall receive... (I certainly don't feel strongly enough to suggest removing it...) |
Describe the solution you'd like
We have started using xarray objects as "schema" for initializing zarrs that will be written to using the
region
argument ofto_zarr
. For example,Currently, xarray's tools for computing the
output_schema
Dataset are a lacking since rechunking existing datasets can be slow.dask.array.zeros_like
takes a chunks argument, can we add one here too?Describe alternatives you've considered
.chunk
The text was updated successfully, but these errors were encountered: