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
Add more flexible masking #1175
Conversation
I'm not sure what causes the weird pattern on the right of the image. It's not visible when I open the original GeoTIFF image in GIMP, but it is visible when viewed with |
Codecov Report
@@ Coverage Diff @@
## master #1175 +/- ##
==========================================
+ Coverage 89.60% 89.67% +0.07%
==========================================
Files 200 200
Lines 29487 29738 +251
==========================================
+ Hits 26422 26669 +247
- Misses 3065 3069 +4
Continue to review full report at Codecov.
|
As a side note: if I save directly to PNG or omit the |
Would it be more clear to have - method: greater_equal
value: 260
transparency: 50 instead of - [greater_equal, 260, 50] ? |
The composite configuration is now like this: ir_test:
compositor: !!python/name:satpy.composites.MaskingCompositor
conditions:
# the below makes everything above 270 K completely transparent, and values between 250 ... 270 K 50 % transparent
- method: greater_equal
value: 260
transparency: 50
- method: greater_equal
value: 270
transparency: 100
prerequisites:
# this is the data that will be shown
- name: IR_108
# this is used for masking with conditions shown above
- name: IR_108
standard_name: ir_test |
In the end I'll be merging this to the existing |
Now also the existing composites that were using |
I added one new composite that uses this feature: |
I can't make Codebeat any happier. The |
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.
LGTM, just one nitpick
satpy/composites/__init__.py
Outdated
|
||
""" | ||
try: | ||
func = getattr(np, method) |
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.
So in principle this means any numpy method can be called. Just for security reasons, would you mind adding a check that method
is not outside what we expect ?
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.
I added a list of accepted methods, and an unit test for trying to use something else. I hope I listed all the currently relevant methods.
This PR adds a more flexible way to apply masking to composites.
flake8 satpy