-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🩹 Fix deprecation warning for using xr.Dataset.dim #267
Conversation
🧙 Sourcery is reviewing your pull request! Tips
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
Historically we've always selected the first wavelength if not explicitly provided. |
917c125
to
751a859
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #267 +/- ##
=======================================
Coverage 44.77% 44.77%
=======================================
Files 27 27
Lines 1043 1043
Branches 162 162
=======================================
Hits 467 467
Misses 568 568
Partials 8 8 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to get rid of those spammy deprecations warnings.
Later we'll figure out other improvements.
This change fixes the deprecation warning:
When
center_λ
has its default value ofNone
.However, when fixing this I found that we have a bug.
First of all:
will always return
round(res.sizes["spectral"] / 2)
sinceres.sizes["spectral"]
is the length of the spectral coordinate (same goes for the current and past behavior ofres.dims["spectral"]
)But since this value is later used with
xr.DataArray.sel
it leads to a wrong behavior since nowcenter_λ
isn't a spectral value but the index of it, resulting in the first wavelength being selected.Example plot for the 4TT case study
Current behavior with omitted
center_λ
Current behavior with set
center_λ
So I think we should change the fallback to:
or
to take none equidistant spectral axes into account.
Change summary
Checklist