Skip to content

Honor quadrature_rule and order in UxDataArray.integrate() - #1842

Merged
rajeeja merged 6 commits into
mainfrom
rajeeja/integrate-quadrature
Nov 5, 2026
Merged

rajeeja merged 6 commits into
mainfrom
rajeeja/integrate-quadrature

Conversation

@rajeeja

@rajeeja rajeeja commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1599

Overview

integrate() accepted quadrature_rule and order but ignored them: #1379 switched to the cached face_areas property, which is always triangular/order 4. Reuse the cache only for those defaults and compute fresh areas otherwise, matching calculate_total_face_area().

None keeps selecting the default for both kwargs, as it did when they were ignored.

UxDataset.integrate() now computes areas once and raises on a bad rule/order instead of skipping every variable.

PR Checklist

General

  • An issue is created and linked
  • Filled out Overview

Testing & Benchmarking

  • There is adequate test coverage of changes from this PR
  • [N/A] If this PR could affect performance, ran ASV benchmarks

Documentation and Examples

  • Docstrings updated with any function changes
  • [N/A] User (public) functions added to docs/api.rst

AI Disclosure

AI Usage: Claude Code

  • I have tested and take responsibility for all AI-generated content in my PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Dataset integration suppresses quadrature validation errors, returning an empty dataset with a misleading warning.

1 open issue
What changed in this PR

Restores quadrature selection in UxDataArray.integrate() to address #1599 while preserving cached face areas for default settings.

Changes:

  • Computes fresh face areas for non-default quadrature rules or orders.
  • Documents quadrature options and HEALPix behavior.
  • Adds tests for parameter handling, default results, and lazy integration.
File Description
uxarray/​core/​dataset.py Clarifies quadrature parameter documentation.
uxarray/​core/​dataarray.py Honors quadrature arguments and documents area selection.
test/​grid/​integrate/​test_basic.py Adds quadrature and lazy-execution regression tests.

Review effort: Balanced

Comment thread uxarray/core/dataarray.py Resolved
The kwargs were accepted but ignored after #1379 switched to the cached
face_areas property, so integrate(order=8) silently returned the default
order-4 result. Reuse the cache only for the default rule/order and
compute fresh areas otherwise, matching calculate_total_face_area().

Closes #1599
Both kwargs were typed optional and ignored, so callers passing None got
the default result. Tightening the annotations turned that into a
ValueError from the quadrature validation; map None back to the defaults
instead.
@rajeeja
rajeeja force-pushed the rajeeja/integrate-quadrature branch from ba9e5c5 to a546ed8 Compare October 27, 2026 00:16
@rajeeja
rajeeja marked this pull request as ready for review October 27, 2026 20:14
@rajeeja
rajeeja requested a review from dylannelson October 28, 2026 17:48

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling this one! Just had a few minor inline comments here.

Comment thread test/grid/integrate/test_basic.py Resolved
Comment thread test/grid/integrate/test_basic.py Resolved
Comment thread uxarray/core/dataarray.py Resolved

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All my previous comments were addressed, I ended up having two new inline comments, but aside from those everything looks good!

Comment thread test/grid/integrate/test_basic.py Resolved
Comment thread uxarray/core/dataarray.py Resolved
@Sevans711
Sevans711 self-requested a review November 4, 2026 18:26

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes look good to me now, happy to approve this one!

@dylannelson dylannelson left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is clear on my end too! Looks like 2 tests failed for some reason, so maybe just try to rerun those two and we should be good!
Edit: Manually reran them and they're passing now

@rajeeja
rajeeja merged commit a251aac into main Nov 5, 2026
25 of 27 checks passed
@Sevans711 Sevans711 added the bug Something isn't working label Nov 5, 2026
@erogluorhan
erogluorhan deleted the rajeeja/integrate-quadrature branch November 13, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UxDataArray.integrate() ignores quadrature_rule and order kwargs

4 participants