Skip to content

Refuse a subset that selected nothing - #122

Merged
rajeeja merged 1 commit into
mainfrom
rajeeja/subset-coverage
Sep 6, 2026
Merged

Refuse a subset that selected nothing#122
rajeeja merged 1 commit into
mainfrom
rajeeja/subset-coverage

Conversation

@rajeeja

@rajeeja rajeeja commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

An off-mesh bounding box returned outcome: complete with a subset_grid of n_face: 0, a variable_summary of shape: [0], a persisted artifact and a next-steps list telling the caller to plot it; subset_polygon did the same with selected_face_count: 0. All three selection operations now report subset_coverage and refuse when nothing was kept, with a repair that names the caller's own argument and quotes the longitude and latitude the mesh actually spans. There is no partial code on purpose, since keeping fewer faces is what a subset is for; 18 new tests, full suite 840 passed / 18 skipped, pre-commit green.

A bounding box at 160-170W / 70-80S applied to a mesh covering 0-40E / 0-40N
returned outcome: complete, status: complete, no warning codes, a subset_grid
of n_face: 0, a variable_summary of shape: [0], a persisted artifact and a
next-steps list telling the caller to plot it. subset_polygon did the same with
selected_face_count: 0.

All three selection operations now report subset_coverage with n_face_source,
n_face_retained and the source mesh extent, and refuse when nothing was kept.
There is deliberately no partial code: keeping fewer faces is what a subset is
for, and a code that fires on every successful call teaches callers to ignore
it. The refusal names the argument the caller controls and quotes the longitude
and latitude the mesh spans, because "nothing selected" does not say where to
put the box and the -180..180 against 0..360 mix-up is the likeliest way to
arrive here.

cross_section was the one case UXarray already caught, raising "No
intersections found at lat=...". That is not silent, but it says the line found
nothing without saying where a line would find something, so it becomes the
same refusal with the extent attached. Any other ValueError still propagates.
@rajeeja
rajeeja merged commit c5bf9bb into main Sep 6, 2026
12 checks passed
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

Successfully merging this pull request may close these issues.

1 participant