[gdal-dev] Incorrect geolocation information using newer gdal versions

Even Rouault even.rouault at spatialys.com
Tue Mar 26 12:14:09 PDT 2024


Yes, some versions ago the netCDF driver became much more stricter, 
expecting a strict respect of the netCDF CF conventions for axis names & 
attributes, to avoid false identification of non-georeferenced axis, 
which could cause issues.

The below debug message gives a hint to use the 
GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS=YES to relax those checks.

Cf https://gdal.org/drivers/raster/netcdf.html#configuration-options

$ gdalinfo 20240321000000.nc --config 
GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS YES
[...]
Origin = (24500.000000000000000,465500.000000000000000)
Pixel Size = (1000.000000000000000,-1000.000000000000000)
[...]
Corner Coordinates:
Upper Left  (   24500.000,  465500.000)
Lower Left  (   24500.000,   14500.000)
Upper Right (  375500.000,  465500.000)
Lower Right (  375500.000,   14500.000)
Center      (  200000.000,  240000.000)

What is at least missing in that particular file is the 
Easting:standard_name = "projection_x_coordinate" and 
Northing:standard_name = "projection_y_coordinate" attributes.

Even

Le 26/03/2024 à 20:02, Andrew C Aitchison via gdal-dev a écrit :
> On Tue, 26 Mar 2024, Cristhian Rivera via gdal-dev wrote:
>
>> Hi all,
>>
>> I'm trying to debug an issue with a NetCDF file where in previous gdal
>> versions (up until 3.3.0) the geolocation was correctly identified by
>> gdalinfo, but in newer versions (>= 3.3.1) it is not.
>
> I note that both versions output the warnings:
>
> Warning 1: dimension #2 (Easting) is not a Longitude/X dimension.
> Warning 1: dimension #1 (Northing) is not a Latitude/Y dimension.
>
> gdalinfo --debug on 20240321000000.nc
> gives me more info:
>
> Warning 1: dimension #2 (Easting) is not a Longitude/X dimension.
> Warning 1: dimension #1 (Northing) is not a Latitude/Y dimension.
> GDAL_netCDF:
> =====
> SetProjectionFromVar( 65536, 4)
> GDAL_netCDF: got grid_mapping crs
> GDAL_netCDF: bIsGdalFile=0 bIsGdalCfFile=0 bSwitchedXY=0 bBottomUp=1
> netCDF: Georeferencing ignored due to non-specific enough X axis name. 
> Set GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS=YES as configuration option 
> to bypass this check
> netCDF: Georeferencing ignored due to non-specific enough Y axis name. 
> Set GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS=YES as configuration option 
> to bypass this check
> GDAL_netCDF: bGotGeogCS=0 bGotCfSRS=0 bGotCfGT=0 bGotCfWktSRS=0 
> bGotGdalSRS=0 bGotGdalGT=0
> GDAL_netCDF: did not get geotransform from CF nor GDAL!
> GDAL_netCDF: did not get projection from CF nor GDAL!
> GDAL_netCDF: netcdf type=5 gdal type=6 signedByte=1
> GDAL: GDALOpen(20240321000000.nc, this=0x63c988f650a0) succeeds as 
> netCDF.
> GDAL: GDALDefaultOverviews::OverviewScan()
> GDAL: GDALClose(20240321000000.nc, this=0x63c988f650a0)
>
>
>> In the attachments are the outputs of gdalinfo from the versions 
>> mentioned,
>> but the difference in both outputs is that newer versions cannot find 
>> the
>> "Origin" and "Pixel size", and the Corner coordinates differ a lot:
>>
>> *Gdal 3.3.0:*
>>
>>> Origin = (24500.000000000000000,465500.000000000000000)
>>> Pixel Size = (1000.000000000000000,-1000.000000000000000)
>>
>>
>>
>> Corner Coordinates:
>>> Upper Left  (   24500.000,  465500.000)
>>> Lower Left  (   24500.000,   14500.000)
>>> Upper Right (  375500.000,  465500.000)
>>> Lower Right (  375500.000,   14500.000)
>>> Center      (  200000.000,  240000.000)
>>
>>
>>> = *Gdal 3.3.1*
>>
>>> Corner Coordinates:
>>> Upper Left  (    0.0,    0.0)
>>> Lower Left  (    0.0,  451.0)
>>> Upper Right (  351.0,    0.0)
>>> Lower Right (  351.0,  451.0)
>>> Center      (  175.5,  225.5)
>>
>>
>> The files can also be found in the following drive repo if they are not
>> available in the mail:
>> https://drive.google.com/drive/folders/1zqV3n2SYUhOjgwxpYpChwqdNTiHAgNHj?usp=sharing 
>>
>>
>>
>> I've tried checking the changelog of that version but it seems only 
>> like a
>> bug fix release.
>> Any ideas of what else I can test to identify the issue?
>
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list