NRLMMD-GEOIPS / geoips

Main Geolocated Information Processing System code base with basic functionality enabled.
https://nrlmmd-geoips.github.io/geoips/
Other
14 stars 11 forks source link

`geotiff_standard` OutputFormatter doesn't raise an error when a GDAL error occurs in `dst.write_colormap()` #545

Open jsolbrig opened 4 months ago

jsolbrig commented 4 months ago

Bug Report

This may be an issue with GDAL or rasterio rather than with GeoIPS. If so, please raise an issue on the rasterio repository to report the problem. It's a problem that might be masking other errors, too, so it's worth submitting an issue or fixing as appropriate, even if we no longer encounter this issue after fixing #544.

What happened?

In the geotiff_standard OutputFormatter, when dst.write_colormap(1, cmap_dict) is called, if GDAL raises an error (e.g. #544), the error is printed to LOG.info() rather than actually raising an exception. In the case of #544, this masked the error that was occurring and allowed processing to continue.

What should have happened?

When the GDAL error was encountered, a fatal exception should have been raised.

Suggested Solutions

Determine whether the log statement is coming from GDAL, rasterio, or geoips and:

I'm fairly sure that rasterio is the culprit here and that it is calling LOG.info when it should be raising an error in this situation.

Replicating the Issue

  1. Update pyproject.toml to require rasterio==1.3.10.
  2. Reinstall GeoIPS.
  3. Call ./tests/scripts/ahi.tc.WV.geotiff.sh > ahi.tc.WV.geotiff.sh.log.

The resulting log file should contain this line which indicates that GDAL encountered an error but the error was unhandled and inappropriately passed to LOG.info:

09_164228 geotiff_standard.py:121     INFO: GDAL signalled an error: err_no=1, msg='TIFFSetField:/home/jsolbrig/geoips/github/outdirs/preprocessed/tcwww/tc2020/SH/SH252020/tif/WV/himawari-8/20200405_000000_SH252020_ahi_himawari-8_WV_100kts_100p00_1p0.tif: Cannot modify tag "PhotometricInterpretation" while writing'

Environment

Checklist for Completion

Related Issues

lance-wilson commented 4 months ago

It appears this may have been done intentionally to mask false errors: https://github.com/rasterio/rasterio/blob/main/rasterio/_env.pyx#L91 I agree it is probably best to raise an issue with rasterio so they can determine why the colormap needs to be written first now.