Thanks for all the information and the data Ernst.
I don't have a ton of time to debug the whole process, but I have a
similar but slightly different theory. The
"night_ir_with_background_hires" consists of two sub-composites:
night_ir_alpha and _night_background_hires. The _night_background_hires,
as you know, comes from a geotiff that is downloaded. This data is
loaded as an RGB with uint8 data type. The night_ir_alpha composite is
produced as an RGBA of bands from the reader and is of type 32-bit float.
So, what this means is that the Alpha band of night_ir_alpha is in the
range of 180K to 303K in your data case. The space pixels in this alpha
band are set to NaN. So when resampling handles it and is told to use 0
or 255, it isn't that these values are 0 or 255 alpha values but
actually 0 or 255 Kelvin and are then scaled during the enhancement
phase. However, this doesn't explain why the middle of the foreground
image is transparent.
I can't think of a good or easy way to resample these dependencies in
one execution. I guess one question is, what happens to the alpha band
when the two composites are merged to make the
"night_ir_with_background_hires"? You'd think even if the background had
a fill value of 255 (the default resample fill_value for this integer
data) that the alpha band from the foreground would make these
transparent...oh unless the alpha band is explicitly ignored.
Looks like there is some alpha blending going on:
https://github.com/pytroll/satpy/blob/2779675fd72826f8df166c46a1b0d59767ba720f/satpy/composites/__init__.py#L1317-L1328
Dave
On 6/7/22 04:27,
lobsiger...@gmail.com wrote:
> Sorry,
>
> I attached the wrong *.txt. Here is the satpy script I was talking about.
>
> Cheers,
> Ernst
>
>
>
lobsiger...@gmail.com schrieb am Dienstag, 7. Juni 2022 um 11:21:55 UTC+2:
>
> Hi Dave,
> Hi core developers,
>
> I made a minimal script that produces the issues discussed in this
> thread. I attach the script as *.txt below. You can download via
> "wetransfer" a *.tgz that contains everything needed (including the
> MSG4 seviri ir-data) under the link:
>
>
https://we.tl/t-wwckA9DEPY <
https://we.tl/t-wwckA9DEPY>
> "
neo.sci.gsfc.nasa.gov <
http://neo.sci.gsfc.nasa.gov>Â IS
> > NOT
neo.gsfc.nasa.gov <
http://neo.gsfc.nasa.gov>".
> <
https://groups.google.com/d/msgid/pytroll/9fcd9477-2ae0-4737-b7ba-b16b914bb5fdn%40googlegroups.com?utm_medium=email&utm_source=footer
> <
https://groups.google.com/d/msgid/pytroll/9fcd9477-2ae0-4737-b7ba-b16b914bb5fdn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
pytroll+u...@googlegroups.com
> <mailto:
pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit
>
https://groups.google.com/d/msgid/pytroll/353a0199-207e-4df8-aaf8-a1a4b2dfc9a6n%40googlegroups.com
> <
https://groups.google.com/d/msgid/pytroll/353a0199-207e-4df8-aaf8-a1a4b2dfc9a6n%40googlegroups.com?utm_medium=email&utm_source=footer>.