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

test_gdal_compliant_grid_crs fails with rasterio 1.4 #1253

Open
JoerivanEngelen opened this issue Oct 23, 2024 · 3 comments
Open

test_gdal_compliant_grid_crs fails with rasterio 1.4 #1253

JoerivanEngelen opened this issue Oct 23, 2024 · 3 comments
Assignees

Comments

@JoerivanEngelen
Copy link
Contributor

In this giant merge of the imod5 feature branch (#1252), I updated our pixi lockfile and 2 tests failed.

One I could fix, but test_gdal_compliant_grid_crs fails with rasterio 1.4 causes a failure. For some reason:

test_gdal_compliant_grid_crs(tmpdir)
...
    da_read = rioxarray.open_rasterio(str(tmpdir / "gdal_accepted_grid.nc"))
    assert da_read.rio.crs == "EPSG:28992"
...

Gives an AssertionError, as the crs attribute equals None.

I resorted to setting rasterio to 1.3.11 in our dev environment, but it is something to keep track of.
Possibly related to:

@Huite
Copy link
Contributor

Huite commented Oct 23, 2024

Might be GDAL itself:

(Rasterio) Version 1.4.0 will require GDAL >= 3.5

@JoerivanEngelen
Copy link
Contributor Author

JoerivanEngelen commented Nov 6, 2024

I think not in this case, our build already uses GDAL 3.9.3, the problem really arises when updating rasterio to 1.4.

I now locally have the test crashing in an environment with rasterio 1.4.0 and GDAL 3.9.3

With GDAL 3.9.3 and rasterio 1.3.11 everything works

@JoerivanEngelen
Copy link
Contributor Author

Looked a bit further into this, the CRS is also not picked up by rasterio 1.4.2.

I debugged this as far as I could in the python code:
in rioxarray, there is a check: rio_crs = riods.crs or result.rio.crs,
located here

For rasterio 1.3.11, riods.crs has a value: CRS.from_epsg(28992), and result.rio.crs is None. With rasterio 1.4.2, there is no value for both.
riods is the dataset as opened by rasterio.open, unfortunately I did not manage to debug much further as I ran into Cython code from rasterio, which my Python VSCode debugger could not open.

@JoerivanEngelen JoerivanEngelen moved this from 📯 New to 📝Refined in iMOD Suite Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📝Refined
Development

No branches or pull requests

3 participants