Skip to content

fix raster crs fallback in exclusion container#500

Merged
coroa merged 2 commits intomasterfrom
fix/fix-crs-fallback
Apr 14, 2026
Merged

fix raster crs fallback in exclusion container#500
coroa merged 2 commits intomasterfrom
fix/fix-crs-fallback

Conversation

@coroa
Copy link
Copy Markdown
Member

@coroa coroa commented Apr 13, 2026

Changes proposed in this Pull Request

Regression that leads to PyPSA/pypsa-eur#2148 after #453 , since the CRS of corine does not contain enough information for reprojecting it:

In [17]: ds = rio.open("../pypsa-eur/data/corine/archive/v18_5/corine.tif")

In [18]: ds.crs
Out[18]: CRS.from_wkt('LOCAL_CS["Geocoding information not available Projection Name = ETRS_1989_LAEA Units = meters GeoTIFF Units = ot",UNIT["unknown",1],AXIS["Easting",EAST],AXIS["Northing",NORTH]]')

In [19]: ds.crs.is_valid
<ipython-input-19-fecbbcf2d289>:1: RasterioDeprecationWarning: is_valid is not useful and will be removed in 2.0.0.
  ds.crs.is_valid
Out[19]: False

In [21]: ds.crs.is_projected
Out[21]: False

In [22]: ds.crs.is_geographic
Out[22]: False

is_valid was just a short form for whether the CRS is either projected or geographic, we still need to check for if either is the case. WGS84 is an example of a geographic crs, epsg 3035 is an example of a projected one (ie a projected has meters and can be used for measuring distances or areas). We need one of the two for projected it to another CRS.

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@coroa coroa requested a review from euronion April 13, 2026 20:00
Copy link
Copy Markdown
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling so quickly!

@coroa coroa mentioned this pull request Apr 14, 2026
3 tasks
@coroa coroa merged commit b6a9084 into master Apr 14, 2026
18 of 19 checks passed
@coroa coroa deleted the fix/fix-crs-fallback branch April 14, 2026 09:41
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

Successfully merging this pull request may close these issues.

2 participants