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

wrong chunk sizes in html repr with nonuniform chunks #4376

Open
dcherian opened this issue Aug 25, 2020 · 3 comments
Open

wrong chunk sizes in html repr with nonuniform chunks #4376

dcherian opened this issue Aug 25, 2020 · 3 comments

Comments

@dcherian
Copy link
Contributor

dcherian commented Aug 25, 2020

What happened:

The HTML repr is using the first element in a chunks tuple;

What you expected to happen:

it should be using whatever dask does in this case

Minimal Complete Verifiable Example:

import xarray as xr
import dask


test = xr.DataArray(
    dask.array.zeros(
        (12, 901, 1001),
        chunks=(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
            (1, 899, 1),
            (1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1),
        ),
    )
)
test.to_dataset(name="a")

image

EDIT: The text repr has the same issue

<xarray.Dataset>
Dimensions:  (dim_0: 12, dim_1: 901, dim_2: 1001)
Dimensions without coordinates: dim_0, dim_1, dim_2
Data variables:
    a        (dim_0, dim_1, dim_2) float64 dask.array<chunksize=(1, 1, 1), meta=np.ndarray>
@keewis
Copy link
Collaborator

keewis commented Aug 25, 2020

that's because we're actively picking the first element of each chunk:

chunksize = tuple(c[0] for c in array.chunks)

Maybe it's time to finalize _repr_inline_ and try to get dask to implement it? Or, if that doesn't work, we could also monkeypatch it onto dask arrays, similar to what pint-xarray is doing with pint quantities.

@dcherian
Copy link
Contributor Author

dcherian commented Oct 6, 2020

I agree. We should outsource this to dask

@keewis
Copy link
Collaborator

keewis commented Oct 7, 2020

for that to work I guess we first have to improve the documentation on _repr_inline_ (see #4248 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants