Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netCDF georeferencing broken with gdal 3.5.0 #85

Closed
jdries opened this issue Oct 12, 2022 · 4 comments
Closed

netCDF georeferencing broken with gdal 3.5.0 #85

jdries opened this issue Oct 12, 2022 · 4 comments
Assignees

Comments

@jdries
Copy link
Contributor

jdries commented Oct 12, 2022

GDAL 3.5.0 introduced changes to netCDF CF attributes handling.
As a result, georferencing of openEO geotrellis netCDF files is wrong, we probably need to review our attributes and make them work with both old and new gdal versions.

https://github.com/OSGeo/gdal/blob/v3.5.0/NEWS.md

netCDF driver:

-     handle 'crs_wkt' attribute
-     always use WKT when found, without comparing with CF params (#4725)
-     limit SetFromUserInput() use to non file input
-     disable filename recoding to ANSI on Windows for netCDF >= 4.8
-     add WRITE_GDAL_VERSION and WRITE_GDAL_HISTORY creation option
-     add a VARIABLES_AS_BANDS=YES/NO open option
-     allow update mode of raster datasets
-     implement SetMetadataItem()/SetMetadata()
-     avoid warnings when CreateCopy() a non-georeferenced dataset, and opening a 1x1 non-georeferenced dataset
-     add a IGNORE_XY_AXIS_NAME_CHECKS=YES open option (https://github.com/qgis/QGIS/issues/47158)
-     recognize x/y axis from GMT generated files as geospatial axis (#5291, https://github.com/qgis/QGIS/issues/47158, https://github.com/qgis/QGIS/issues/45704)
-     read CF attributes giving CRS component names (#5493)
-     add support for writing/reading geolocation array without a grid_mapping variable
@jdries jdries self-assigned this Oct 12, 2022
@jdries
Copy link
Contributor Author

jdries commented Oct 12, 2022

So the problem is, GDAL finds the SRS, but not the GeoTransform, this is revealed by setting CPL_DEBUG=ON:

GDAL_netCDF: did not get geotransform from CF nor GDAL!

@jdries
Copy link
Contributor Author

jdries commented Oct 12, 2022

So GDAL checks if CF conventions 1.9 are used, which apparently has clarified the use of crs_wkt, which we already use:
cf-convention/cf-conventions#222

So seems like we better declare this version as well.

@jdries
Copy link
Contributor Author

jdries commented Oct 12, 2022

The axis attribute on our coordinate variables seems to be an issue, even though the CF conventions seem to say that this is relevant.
For lat/lon projection, the 'coordinates' attribute on the data variables was also a problem.

Both coordinates and axis have now been removed.

jdries added a commit that referenced this issue Oct 12, 2022
@jdries
Copy link
Contributor Author

jdries commented Oct 13, 2022

Fixed on openeo-dev!

@jdries jdries closed this as completed Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant