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

Issue with chunks when combining #7

Open
SammyAgrawal opened this issue Jun 27, 2024 · 2 comments
Open

Issue with chunks when combining #7

SammyAgrawal opened this issue Jun 27, 2024 · 2 comments

Comments

@SammyAgrawal
Copy link
Contributor

pangeo_forge_recipes/rechunking.py

raise ValueError("Cannot combine fragments because they do not form a regular hypercube.")

ValueError: Cannot combine fragments because they do not form a regular hypercube. [while running 'Create|OpenURLWithFSSpec|OpenWithXarray|Preprocess|StoreToZarr/StoreToZarr/Rechunk/MapTuple(combine_fragments)']

@SammyAgrawal
Copy link
Contributor Author

SammyAgrawal commented Jun 27, 2024

Source Code raising the error in pangeo forge:

    # now we need to unstack the 1D concat dims into an ND nested data structure
    # first step is figuring out the shape
    dims_starts_sizes = [(
            dim.name,
            [index[dim].value for index in all_indexes],
            [ds.sizes[dim.name] for ds in all_dsets],
        )
        for dim in concat_dims]
[...]
    
starts_cube = [np.array(item[1]).reshape(shape) for item in dims_starts_sizes]
    sizes_cube = [np.array(item[2]).reshape(shape) for item in dims_starts_sizes]
    try:
        # reversing order is necessary here because _sort_by_speed_of_varying puts the
        # arrays into the opposite order as wanted by np.meshgrid
        starts = _invert_meshgrid(*starts_cube[::-1])[::-1]
        sizes = _invert_meshgrid(*sizes_cube[::-1])[::-1]
    except AssertionError:
        raise ValueError("Cannot combine fragments because they do not form a regular hypercube.")

@jbusecke
Copy link
Contributor

jbusecke commented Jul 9, 2024

I suspect that there is an issue with a scalar dimension. Did you try to drop/squeeze all coords as part of the preprocessing?

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

No branches or pull requests

2 participants