Hello there,
Python version: 3.9.12
wradlib version: 1.17.0
I tried to reinstall the latest version of wradlib using conda in my virtual environment. It got successfully installed. When I was trying to read the data set I was getting the following error. I understand this is being caused because of the installation problem of gdal package in the virtual environment. When I run “conda list” in the shell it displays list of packages installed. Here I can see gdal(version 3.4.1) installed. But when I run in python and tried to import the module gdal, I get this error.(ModuleNotFoundError: No module named ‘gdal’)
comp = []
for f in os.listdir(src_path):
comp_ = wrl.io.open_radolan_dataset(src_path+f)
comp.append(comp_)
for f in os.listdir(src_path):
comp_ = wrl.io.open_radolan_dataset(src_path+f)
comp.append(comp_)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_6792\3213803040.py in <cell line: 1>()
1 for f in os.listdir(src_path):
----> 2 comp_ = wrl.io.open_radolan_dataset(src_path+f)
3 comp.append(comp_)
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py in open_radolan_dataset(filename_or_obj, **kwargs)
1335 }
1336 kwargs["backend_kwargs"] = backend_kwargs
-> 1337 return xr.open_dataset(filename_or_obj, engine="radolan", **kwargs)
1338
1339
~\anaconda3\envs\wradlib\lib\site-packages\xarray\backends\api.py in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, backend_kwargs, **kwargs)
537
538 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None)
--> 539 backend_ds = backend.open_dataset(
540 filename_or_obj,
541 drop_variables=drop_variables,
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\io\backends.py in open_dataset(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta, fillmissing, copy, ancillary)
199 store_entrypoint = StoreBackendEntrypoint()
200 with close_on_error(store):
--> 201 ds = store_entrypoint.open_dataset(
202 store,
203 mask_and_scale=mask_and_scale,
~\anaconda3\envs\wradlib\lib\site-packages\xarray\backends\store.py in open_dataset(self, store, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta)
24 decode_timedelta=None,
25 ):
---> 26 vars, attrs = store.load()
27 encoding = store.get_encoding()
28
~\anaconda3\envs\wradlib\lib\site-packages\xarray\backends\common.py in load(self)
126 """
127 variables = FrozenDict(
--> 128 (_decode_variable_name(k), v) for k, v in self.get_variables().items()
129 )
130 attributes = FrozenDict(self.get_attrs())
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\io\backends.py in get_variables(self)
155 def get_variables(self):
156 return FrozenDict(
--> 157 (k, self.open_store_variable(k, v)) for k, v in self.ds.variables.items()
158 )
159
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py in variables(self)
1102 def variables(self):
1103 if self._variables is None:
-> 1104 self._read()
1105 return self._variables
1106
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py in _read(self)
1214 proj = projection.create_osr("dwd-radolan-wgs84")
1215 else:
-> 1216 proj = projection.create_osr("dwd-radolan-sphere")
1217
1218 xlocs, ylocs = rect.get_radolan_coordinates(
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\georef\projection.py in create_osr(projname, **kwargs)
146 )
147
--> 148 proj = osr.SpatialReference()
149
150 if projname == "aeqd":
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\util.py in __getattr__(self, name)
71 "installation.html#optional-dependencies"
72 )
---> 73 raise AttributeError(
74 f"Module '{self.name}' is not installed.\n\n"
75 "You tried to access function/module/attribute "
AttributeError: Module 'osgeo.osr' is not installed.
You tried to access function/module/attribute 'SpatialReference'
from module 'osgeo.osr'.
This module is optional right now in wradlib.
You need to separately install this dependency.
Please refer to https://docs.wradlib.org/en/stable/installation.html#optional-dependencies
for further instructions.