Skip to content

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

Open
rajeeja wants to merge 3 commits into
mainfrom
rajeeja/integrate-quadrature
Open

rajeeja wants to merge 3 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 Outdated
Comment on lines +693 to +695
face_areas = self.uxgrid.compute_face_areas(
quadrature_rule=quadrature_rule, order=order, as_uxarray=True
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — DataCenteringError and DimensionError both inherit from ValueError, so the broad handler also swallowed quadrature validation failures. Narrowed the catch to those two expected skip cases and added a dataset-level regression test asserting that an invalid order propagates. Fixed in ba9e5c5; the focused integration tests pass.

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

UxDataArray.integrate() ignores quadrature_rule and order kwargs

2 participants