Closed yukaribbba closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.94%. Comparing base (
87d072d
) to head (1c242a0
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Totals | |
---|---|
Change from base Build 8781051256: | 0.0% |
Covered Lines: | 0 |
Relevant Lines: | 0 |
Could you explain more why/when this is needed? Normally writers or other compositors are supposed to handle these cases for you.
My fault. Didn't realize that. Closing now
If you have a use case where this isn't true let me know. There is very likely a case where things won't work, I just didn't know what that situation would be.
Well some image viewing software can't display LA images correctly, such as Photo Viewer in Windows. That's why I start this. But your words remind me that I can build something with GenericCompositor
like
compositor: !!python/name:satpy.composites.GenericCompositor
prerequisites:
- name: C14
- name: C14
- compositor: !!python/name:satpy.composites.CloudCompositor
prerequisites:
- name: C14
But there are still some errors I'm trying to figure out.
So GenericCompositor
isn't helpful since CloudCompositor
will add a "band" dimension which is not present in the first two. Therefore triggers the "incompatible areas". So I turn to MaskingCompositor and BackgroundCompositor.
masking:
compositor: !!python/name:satpy.composites.MaskingCompositor
prerequisites:
- name: C14
- name: C14
conditions:
- method: less_equal
value: 0
transparency: 100
- method: greater
value: 0
transparency: 100
- method: isnan
transparency: 100
mode: RGBA
standard_name: no_enhancement_spec
ir_cloud_day_default_2000:
compositor: !!python/name:satpy.composites.BackgroundCompositor
prerequisites:
- name: masking
- compositor: !!python/name:satpy.composites.CloudCompositor
prerequisites:
- name: C14
standard_name: ir_cloud_day_default
The logic is: lay a completely transparent RGBA image upon the LA image(day cloud) then you get the RGBA result because BackgroundCompositor
will do that add_bands
job. It's kinda magical but anyway I got what I want and no changes needed.
Why is C14 being used here? Is the final result you want just a geotiff with the cloud compositor output as RGBA? And you need that so more image viewers will show the image correctly?
Yes I want a geotiff in RGBA mode so that my image viewer can show it properly. C14 is used just for convenience since cloudcompositor will also use that band. Actually it can be any bands since all I need from that is just a transparent image . I'm not sure if other image viewers have such problems but in my Windows pc that is certain. Could just be a rare case, who knows...
I think this is a good feature, but should maybe not be added to just the CloudCompositor. I wonder if there is a way to do this with enhancements. @pnuu @simonrp84 or @mraspaud any ideas how to take the output of a composite that is LA and produce an RGBA without modifying Satpy or trollimage?
The first option that comes to mind is to create a composite that has C14 on all 3 channels and then use that with CloudCompositor
.
@pnuu Unfortunately CloudCompositor
can only accept a single band otherwise it'll end it up like this:
<xarray.DataArray 'bands' (bands: 6)> Size: 24B
array(['R', 'G', 'B', 'R', 'G', 'B'], dtype='<U1')
Coordinates:
crs object 8B PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown...
* bands (bands) <U1 24B 'R' 'G' 'B' 'R' 'G' 'B'
Usually
CloudCompositor
produces an LA mode image. But sometimes you may want RGBA result. So this PR will add "mode" kwarg just likeMaskingCompositor
.