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

Cristhian Rivera cristhian.rivera at hyds.es
Tue Mar 26 13:40:27 PDT 2024


Thanks a lot to both of you! The GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS
option did the trick!
Didn't know about the --debug on flag, it will come in handy in the future

Regarding the last part:

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.


 How can I manually set those values?

Thanks for the help,


El mar, 26 mar 2024 a las 20:14, Even Rouault via gdal-dev (<
gdal-dev at lists.osgeo.org>) escribió:

> 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.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
*Cristhian Rivera*
cristhian.rivera at hyds.es

*HYDS (Hydrometeorological Innovative Solutions)*
Jordi Girona 1-3, Ed. ParcUPC K2M 002
08034 Barcelona (Spain)
https://www.hyds.es
Tel: (+34) 933 524 050 <+34933524050>
*Disclaimer <https://www.hyds.es/disclaimer/> | Aviso Legal
<https://www.hyds.es/es/disclaimer/> | Avís Legal
<https://www.hyds.es/ca/disclaimer/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240326/0cd8da4c/attachment-0001.htm>


More information about the gdal-dev mailing list