Skip to content

Add keep_attrs to discrimination and Contingency - #456

Merged
aaronspring merged 3 commits into
xarray-contrib:mainfrom
Kkkakania:agent/keep-attrs-probabilistic
Sep 21, 2026
Merged

aaronspring merged 3 commits into
xarray-contrib:mainfrom
Kkkakania:agent/keep-attrs-probabilistic

Conversation

@Kkkakania

Copy link
Copy Markdown
Contributor

Description

Completes the remaining keep_attrs support requested in #258.

  • adds keep_attrs=False to discrimination
  • adds keep_attrs=False to Contingency
  • preserves observation attributes for DataArray and Dataset outputs when requested
  • explicitly clears output attributes when keep_attrs=False, keeping behavior stable across xarray versions
  • activates the existing reliability attribute test and covers eager, Dask, DataArray, Dataset, and multidimensional Dataset inputs

Closes #258

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • uv run --extra test pytest -q (2894 passed, 3 skipped)
  • pre-commit on all four changed files (all applicable hooks passed)

Checklist (while developing)

  • I have added documentation for the new parameters.
  • Tests added for pytest.

Pre-Merge Checklist (final steps)

  • Based on the current upstream main.
  • Contains one focused commit.

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

Thanks. Sorry for not responding

@aaronspring
aaronspring merged commit 710d373 into xarray-contrib:main Sep 21, 2026
1 of 3 checks passed
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.57%. Comparing base (e457985) to head (ab3263a).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #456   +/-   ##
=======================================
  Coverage   94.57%   94.57%           
=======================================
  Files          27       27           
  Lines        2841     2878   +37     
=======================================
+ Hits         2687     2722   +35     
- Misses        154      156    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

keep_attrs for discrimination, rank_histogram, reliability, Contingency

2 participants