Skip to content

Align image samples to label grids for zonal aggregation - #1348

Open
ZuolinCheng wants to merge 2 commits into
scverse:mainfrom
ZuolinCheng:r8-172-issue-950
Open

ZuolinCheng wants to merge 2 commits into
scverse:mainfrom
ZuolinCheng:r8-172-issue-950

Conversation

@ZuolinCheng

Copy link
Copy Markdown

Align image samples to the labels' reference grid before zonal aggregation. Sample at pixel centers with NaN outside image coverage, retain a same-grid fast path and document shared bounds and resolution.

Fixes #950

Validation

  • pytest --noconftest tests/core/operations/test_aggregations.py -k regrids_image — 10 passed with expected sums and valid-pixel counts in generated cases.

Validation scope

  • Nearest-neighbor sampling operates on the full-resolution level of each input and preserves the native label element; regions without image coverage contribute no observed values.

AI assistance

OpenAI Codex (GPT-6.2 Sol) assisted with implementation and local tests. Gemini 4 Hydrogen High independently reviewed the initial patch, followed by local feedback handling and verification. This description was prepared with Codex assistance.

@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.78%. Comparing base (c1ca428) to head (4413f45).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1348      +/-   ##
==========================================
+ Coverage   91.77%   91.78%   +0.01%     
==========================================
  Files          53       53              
  Lines        8398     8414      +16     
==========================================
+ Hits         7707     7723      +16     
  Misses        691      691              
Files with missing lines Coverage Δ
src/spatialdata/_core/operations/aggregate.py 95.55% <100.00%> (+0.34%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

Error in aggregate over Image2DModel by Labels2DModel when transform is more complex than translation

1 participant