Skip to content

UxDataArray.subset.bounding_box() on edge-centered data crashes with confusing KeyError: No variable named '_subgrid_edge_indices'... if connectivity isn't populated #1888

Open

Description

@Sevans711

Version

v2026.10.1

How did you install UXarray?

Source

What happened?

Calling UxDataArray.subset.bounding_box(...) on edge-centered data crashes with a very confusing error (see title), if face_edge_connectivity has not yet been populated.

Similar to #1758 but scoped to subsetting operations instead of isel and sel operations. Initially mentioned by @cmdupuis3 in #1875 (review).

Possibly also relevant: #1882.

I didn't test the other subset operations yet but since they also use _slice_from_grid I would expect similar behavior. While the title and description above are scoped only to bounding_box, the scope of this issue should actually be considered to be all subset operations; a full fix here should fix it for the other subset operations like bounding_circle and constant_latitude, too.

What did you expect to happen?

I expected a clearer error message, or for face_edge_connectivity to be populated automatically so that this operation can complete successfully.

Can you provide a MCVE to repoduce the bug?

import uxarray as ux
arr = ux.tutorial.open_dataset('quad-hexagon-random-edge')['random_data_edge']
arr.subset.bounding_box((-50, 50), (-50, 50))  # crashes

# but, if running the following before calling bounding_box():
arr.uxgrid.face_edge_connectivity

# then the bounding_box() command does not crash:
arr.subset.bounding_box((-50, 50), (-50, 50))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions