nens / threedigrid-builder

Generate a 3Di simulation grid from a model schematisation.
Other
1 stars 0 forks source link

Fix tests for gdal 3.4 and 3.6 #352

Closed margrietpalm closed 4 months ago

margrietpalm commented 5 months ago

Fix gdal 3.6 issues

Cases where the area to refine exactly matches the computational grid may have different refinements in gdal 3.4 then in gdal 3.6. Users should be informed about this on release

Fix gdal 3.4 issues

Allow failing (skipped) test ./threedigrid_builder/tests/test_raster_interfaces.py::test_crs to pass by splitting the tests and running one or the other based on the gdal version. This however does not ensure that there are no downstream effects.

Given

current = CRS(CRS.from_epsg(28992).to_wkt())
legacy =  CRS.from_wkt(
        'PROJCS["Amersfoort / RD New",GEOGCS["Amersfoort",DATUM["Amersfoort",'
        'SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],'
        "TOWGS84[565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812],"
        'AUTHORITY["EPSG","6289"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],'
        'UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4289"]],'
        'PROJECTION["Oblique_Stereographic"],PARAMETER["latitude_of_origin",52.1561605555556],'
        'PARAMETER["central_meridian",5.38763888888889],PARAMETER["scale_factor",0.9999079],'
        'PARAMETER["false_easting",155000],PARAMETER["false_northing",463000],'
        'UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],'
        'AUTHORITY["EPSG","28992"]]'
    )

There is one call that gives a different result:

> current.to_epsg()
28992
> legacy.to_epsg
None

This call is used the property RasterIORasterInterface.epsg_code, which is subsequently used by RasterHasMatchingEPSGCheck.is_valid where it could potentially change the result. This function seemed to be well tested, so any issues here should be caught.

Furthermore, returning the actual spsg instead of None seems an improvement.

Partially updated github action matrix