PolarGeospatialCenter / imagery_utils

Other
34 stars 10 forks source link

`pgc_ortho` fails with "ERROR in stats calculation" when using non-standard filenames #9

Open 7yl4r opened 6 years ago

7yl4r commented 6 years ago

I was quite surprised to find that this error I was seeing is due to a filenaming issue.

utils.get_sensor returns vendor=None if the input filename does not match the regexes there. This causes a function to return 1 later when checking for vendor.

Ideally vendor and sensor could be passed in a CLI args, but I can see that would be a bigger refactor than I want to put in right now. At a minimum I would expect get_sensor throws an exception or a more informative error message is shown when the filename doesn't match.

7yl4r commented 1 year ago

This is still an issue and it can be easily resolved by modifying the hardcoded regex signatures:

https://github.com/PolarGeospatialCenter/imagery_utils/blob/4081ea63f5ae8427d115094c48176485f0de22d6/lib/utils.py#L115-L128

In my testing I found:

The extraction of metadata from filenames should be reworked here. As is it is non-standard, undocumented, and non-configurable.

Additionally: the sat information should probably just be read from the .xml file so we don't even need to worry about the filename.