Skip to content

Update XRImage to create missing 'bands' coordinate when dimension is present#197

Merged
djhoese merged 5 commits into
pytroll:mainfrom
djhoese:bugfix-no-bands-coord
Jun 19, 2025
Merged

Update XRImage to create missing 'bands' coordinate when dimension is present#197
djhoese merged 5 commits into
pytroll:mainfrom
djhoese:bugfix-no-bands-coord

Conversation

@djhoese
Copy link
Copy Markdown
Member

@djhoese djhoese commented Jun 6, 2025

This was created due to a conversation with @gerritholl about some test datasets in Satpy. The summary is that the test datasets had a "bands" dimension but no data_arr.coords["bands"] entry. Once a call to .squeeze was removed (it had been masking this issue), the enhancement/stretch methods in XRImage were breaking because xarray was defaulting data_arr.coords["bands"] to an integer array of 0. XRImage expects a list of strings (ex. ["R", "G", "B"].

  • Closes #xxxx (remove if there is no corresponding issue, which should only be the case for minor changes)
  • Tests added (for all bug fixes or enhancements)
  • Tests passed (for all non-documentation changes)
  • Passes git diff origin/master **/*py | flake8 --diff (remove if you did not edit any Python files)
  • Fully documented (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later)

@djhoese djhoese requested a review from gerritholl June 6, 2025 16:16
@djhoese djhoese self-assigned this Jun 6, 2025
@djhoese djhoese added the bug label Jun 6, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.77%. Comparing base (d5b3e23) to head (2b4c10d).
⚠️ Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
+ Coverage   91.63%   91.77%   +0.13%     
==========================================
  Files          11       12       +1     
  Lines        4114     4135      +21     
==========================================
+ Hits         3770     3795      +25     
+ Misses        344      340       -4     
Flag Coverage Δ
unittests 91.77% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@coveralls
Copy link
Copy Markdown

coveralls commented Jun 6, 2025

Coverage Status

coverage: 92.021% (+0.1%) from 91.881%
when pulling 2b4c10d on djhoese:bugfix-no-bands-coord
into a54a9b2 on pytroll:main.

Copy link
Copy Markdown
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM. I just have one request: update the title of the PR, as I got wrong expectations when reading it vs what is implemented. Proposal for a new title:
"Update XRImage to create missing 'bands' coordinate when dimension is present"

@djhoese djhoese changed the title Update XRImage to require 'bands' coordinate when dimension is present Update XRImage to create missing 'bands' coordinate when dimension is present Jun 19, 2025
@djhoese djhoese merged commit f944b7f into pytroll:main Jun 19, 2025
26 checks passed
@djhoese djhoese deleted the bugfix-no-bands-coord branch June 19, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants