Feature request: workaround regular gridded OISST NetCDF files with no SRS-info
These NetCDF files don't provide a compliant SRS, the OISST files have no “grid_mapping” variable, so GDAL can't auto-determine the coordinate system used by the sst, ice, anom, and err subdatasets.
https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/
I obtained an example file (and attached here) from this link
https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/202202/oisst-avhrr-v02r01.20220218.nc
oisst-avhrr-v02r01.20220218.nc.zip
That file is 1.5Mb, zipped only to get around the allowed GH extensions thing.
Steps to reproduce the problem.
gdalsrsinfo NETCDF:"oisst-avhrr-v02r01.20220218.nc":sst
ERROR 1: ERROR - failed to load SRS definition from NETCDF:oisst-avhrr-v02r01.20220218.nc:sst
system
Ubuntu 20 GDAL 3.6.0dev-298705c2af, released 2022/08/12 (debug build)
I assume GDAL could allow heuristics to provide a fall-back to "OGC:CRS84", because it's clearly basic longitude/latitude grid. I intended to PR this but I get lost in the size of the NetCDF driver, and this might be pretty easy with more experience 🙏
(I also have quite a few examples of similar sources that GDAL could augment by internal logic, so if this is of interest there's quite a range of similar examples for georeferencing and CRS that might fall into categories of similar kinds)
The motivation for us is to remove augmenting-logic from within R, if GDAL auto-detects this case then we can simplify the code and - while VRT strings do that (we are replacing R logic with these so other langs can use directly), it's of benefit to an even wider audience if GDAL itself contains the heuristics.
If the provided files were compliant
To demonstrate the fix required at the provider level, I created a new file.nc that adds the scalar ‘crs’ var with attributes, and this is pointed to by new attributes ‘coordinates’ and ‘grid_mapping’ from the 4D variables that use ‘lon’ and ‘lat’. (I'm not sure if my fix is exactly appropriate in terms of SRS details here)
The modification steps for the repaired file, and more details about communication with the provider are here:
https://github.com/mdsumner/fixoisst