-
Notifications
You must be signed in to change notification settings - Fork 295
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
generic_image reader returns data as float64 for PNG images #2897
Comments
If you run |
Ah it looks like this is intentional for fill/mask handling: satpy/satpy/readers/generic_image.py Lines 138 to 157 in 7261b14
|
See #1560 |
I see, so then this is expected. However, is there a way to avoid broken output when saving to PNG and failing writing when trying to save to tif? I.e. can I provide some argument to For my application it's easy enough to change the data type to |
What happens if you set I think having the kwarg @djhoese suggested above to keep the dtype intact for the input image makes a lot of sense. I'm not sure why the image date were converted to |
Yes, with |
The next workaround to test: enhancements:
default:
operations: [] to override the default enhancement in |
I'll have a look at fixing the |
With this I get the same corrupt output as with |
Sorry, I was unclear there. With the null enhancement use |
That's what I did. So |
Oh, silly me 🙈 How about doing a crude stretch from |
While looking into #2923 I went through the Maybe the |
But even if that workaround works, I would vote for a fix in the generic_image reader, probably something like what you suggest in #2897 (comment). |
For some reason I can't create a new linked issue from that comment. @strandgren could you try it? Just swap the topic to |
Yes, thanks! I'll add some more stuff next Monday. |
Describe the bug
The
generic_image
reader returns the image data asfloat64
for PNG images. This leads to corrupt images with the PNG and JPEG writers when trying to save the image back to a file again, while the geotiff writer falls over completely when trying to save the image back to a TIF file.To Reproduce
Expected behavior
and one copy each of the input images.
Actual results
and a corrupt output.png image as shown in the screenshot below.
Environment Info:
Additional context
When trying to save
input.png
asoutput.tif
the geotiff writer fails with the following traceback:The text was updated successfully, but these errors were encountered: