-
Notifications
You must be signed in to change notification settings - Fork 302
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 masking in DayNightCompositor when composites have partial missing data #447
Conversation
Codecov Report
@@ Coverage Diff @@
## master #447 +/- ##
==========================================
- Coverage 73.07% 72.86% -0.22%
==========================================
Files 134 134
Lines 17662 17871 +209
==========================================
+ Hits 12907 13022 +115
- Misses 4755 4849 +94
Continue to review full report at Codecov.
|
satpy/composites/__init__.py
Outdated
nans = xu.logical_and(xu.isnan(data1), | ||
xu.logical_not(xu.isnan(data2))) | ||
attrs = data1.attrs.copy() | ||
data1 = xr.where(nans, 0, data1) |
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.
Does using data1.where(~nans, 0)
preserve the attributes?
satpy/composites/__init__.py
Outdated
xu.logical_not(xu.isnan(data2))) | ||
attrs = data1.attrs.copy() | ||
data1 = xr.where(nans, 0, data1) | ||
data1.attrs = attrs.copy() |
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.
You are copying the attributes dictionary twice.
Indeed, that |
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.
Unit test?
Don't have time for adding unit tests during this week, and next week I'm out of office. |
If one of the two composites passed to
DayNightCompositor
has partially missing data the resulting merged composite had holes at those locations. This discrepancy between the composites can be e.g. due to reflectances below zero on the night side being masked out by the reader. This behavior can be correct for other use cases, but here it creates distracting holes in the images.This PR replaces the masked ares with zeros if they are valid in the other composite.
git diff origin/master **/*py | flake8 --diff