OGR Error: Unsupported SRS

Hi

I have just installed wradlib (using conda on a fedora 38 wkstation) and now running the ppi_example notebook and get the following error:

RuntimeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 ax, pm = wradlib.vis.plot_ppi(img)
2 txt = pl.title(“Simple PPI”)

File ~/anaconda3/envs/wradlib/lib/python3.11/site-packages/wradlib/vis.py:473, in plot_ppi(data, r, az, elev, site, proj, fig, ax, func, rf, **kwargs)
459 elev = np.ones_like(az) * elev
461 da = georef.create_xarray_dataarray(
462 data,
463 r=r,
(…)
470 **kw_spherical,
471 )
→ 473 da = georef.georeference_dataset(da, proj=proj)
475 if util.has_import(osr):
476 # fallback to proj=None for GDAL OSR
477 if isinstance(proj, osr.SpatialReference):

File ~/anaconda3/envs/wradlib/lib/python3.11/site-packages/wradlib/georef/xarray.py:194, in georeference_dataset(obj, **kwargs)
189 xyz, dst_proj = polar.spherical_to_xyz(
190 r, az, obj[“elevation”], site, re=re, ke=ke, squeeze=True
191 )
192 # proj, convert to aeqd and add offset
193 else:
→ 194 xyz, dst_proj = polar.spherical_to_xyz(
195 r, az, obj[“elevation”], site, re=re, ke=ke, squeeze=True
196 )
197 xyz += np.array(site).T
199 # calculate center point
200 # use first range bins

File ~/anaconda3/envs/wradlib/lib/python3.11/site-packages/wradlib/georef/polar.py:106, in spherical_to_xyz(r, phi, theta, sitecoords, re, ke, squeeze, strict_dims)
104 osr = import_optional(“osgeo.osr”)
105 if has_import(osr):
→ 106 rad = projection.proj4_to_osr(projstr)
107 else:
108 rad = projstr

File ~/anaconda3/envs/wradlib/lib/python3.11/site-packages/wradlib/georef/projection.py:206, in proj4_to_osr(proj4str)
204 proj = osr.SpatialReference()
205 proj.ImportFromProj4(proj4str)
→ 206 proj.AutoIdentifyEPSG()
208 if proj.Validate() == ogr.OGRERR_CORRUPT_DATA:
209 raise ValueError(
210 “proj4str validates to ‘ogr.OGRERR_CORRUPT_DATA’”
211 “and can’t be imported as OSR object”
212 )

File ~/anaconda3/envs/wradlib/lib/python3.11/site-packages/osgeo/osr.py:616, in SpatialReference.AutoIdentifyEPSG(self, *args)
614 def AutoIdentifyEPSG(self, *args):
615 r"““AutoIdentifyEPSG(SpatialReference self) → OGRErr””"
→ 616 return _osr.SpatialReference_AutoIdentifyEPSG(self, *args)

RuntimeError: OGR Error: Unsupported SRS

Any ideas on what is going on?

Many thanks
Alan Seed

@alan-weatherradar

Please install GDAL < 3.7 to make this work. There have been some changes which lead to this behaviour. Still investigating what causes this.

Many thanks Kai, much appreciated, Alan

@alan-weatherradar Alan, you’re very welcome.

I’ll add this issue Beam Blockage Calculation Example - RuntimeError: OGR Error: Unsupported SRS · Issue #628 · wradlib/wradlib · GitHub here which tracks this special error.

I did not find out which change in GDAL causes this behaviour, but the solution is obviously just to not use AutoIdentifyEPSG() in GDAL >= 3.7.