ssec / sift

A visualization application for satellite imagery
http://sift.ssec.wisc.edu/
GNU General Public License v3.0
46 stars 13 forks source link

"Export image"-functionality does not know how to deal with .jpg/.png formats? #372

Open ConnieEsTe opened 1 year ago

ConnieEsTe commented 1 year ago

Version and setting information

I used the Linux self-contained package provided for the EUMETSAT Webinar of 31st May 2023. This contains SIFT 2.0.0b0.

System: Linux, OpenSuse 15.2

Steps to reproduce

Expected behaviour

Generate an image under the given path.

Current behaviour

ValueError message in terminal. No file is generated.

Relevant logs and/or media

Error reported in the terminal:

Traceback (most recent call last):
  File "/data/cstrube/sift/SIFT_2.0.0b0/lib/python3.11/site-packages/uwsift/view/export_image.py", line 427, in _save_screenshot
    raise ValueError("Not sure how to handle file with format: {}".format(filenames[0]))
ValueError: Not sure how to handle file with format: /home/cstrube/sift_screenshot.png
djhoese commented 1 year ago

Thanks for filing this. I'll try to look at this today since this suggests that we're missing a dependency in the tarball. For my own future reference here's the bit of code that does the check that is causing this error:

https://github.com/ssec/sift/blob/f5e584c1cb51e8efba2796014f72489aedc645ce/uwsift/view/export_image.py#L421-L427

djhoese commented 1 year ago

Looks like there is a warning that is being suppressed:

<stdin>:1: DeprecationWarning: ImageIO now uses a v3 plugin when writing this format. Please migrate to the v3 API (preferred) or use imageio.v2.
djhoese commented 1 year ago

The change was introduced in imageio v2.28.0 in this PR:

https://github.com/imageio/imageio/pull/824

We could limit the version of imageio used, but I'd like to find a way to use the v3 API mentioned there. I'll wait for a comment from the imageio maintainer if possible.

djhoese commented 1 year ago

FYI I have a way forward to fix this, but I just want to point out to @ameraner that this is a classic case of over mocking in tests. Export image is one of the few parts of SIFT that has decent coverage and testing, but there was way too much mocking and so imageio was completely mocked away. I'll see if I can fix the tests and the code.