Better resilience on NetCDF SPI.canDecode

Description

ImageIO SPI.canDecode input checks whether a provided input can be decoded and then handled by that specific SPI.

The NetCDFReaderSPI.canDecode input does a check on magicNumbers.
In case they are associated to NetCDF files, NCML, GRIB files (if the related library is available) it will proceed with an additional check, by trying to get a NetCDFFile from the NetCDF Library.

There are cases where the input grib file or NetCDF has some weird trailing bytes which prevent a proper magic number check. This result into discarding the files.
We should allow to handle these files anyway.
A solution will be to support a System property which allows to try to open a NetCDF file on the provided input.

Please, use this solution only when really needed (As an instance, when there is no way to fix potential issues in the original file).
As you know, all SPIs are scan while looking for a proper SPI to be used to open a file.
Forcing that check could result in trying to get a NetCDFfile from a GeoTIFF, PNGs, MrSID, ecc which returns nothing and skip to the next SPI in the list.

Environment

None

Assignee

Daniele Romagnoli

Reporter

Daniele Romagnoli

Triage

None

Components

Fix versions

Affects versions

Priority

Medium
Configure