Problem with WRADLIB-DATA

867 views
Skip to first unread message

Ercan Büyükbaş

unread,
Feb 19, 2021, 4:36:03 AM2/19/21
to wradlib-users
Hi,
I am trying to run wradlib by using the example data. Although all installations and configurations seem ok, I receive a message as "Environment Error: 'WRADLIB_DATA' environment variable not set." during the running.
I downloaded and extracted wradlib-data-master files.
I set WRADLIB_DATA environment variable pointing to the wradlib-data location   by using the command  setx WRADLIB_DATA C:\path\to\wradlib-data .
But it does not work.
Is there anyone encountered the same problem and found a solution.
Thanks a lot in advance for your kind interest and support.
Ercan  

Kai Mühlbauer

unread,
Feb 19, 2021, 8:50:02 AM2/19/21
to wradli...@googlegroups.com
Hi Ercan,

setx WRADLIB_DATA C:\path\to\wradlib-data

means you should set the path to the actual location.

If I had Windows (you have?) then this would look like:

setx WRADLIB_DATA C:\users\kai\wradlib-data

Not sure where the problem source is in your case, but you might also
try to set the environment variable in the code directly:

import os
os.environ["WRADLIB_DATA"] = "C:\users\kai\wradlib-data"

HTH,
Kai

Am 19.02.21 um 10:36 schrieb Ercan Büyükbaş:
> --
> You received this message because you are subscribed to the Google
> Groups "wradlib-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wradlib-user...@googlegroups.com
> <mailto:wradlib-user...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/wradlib-users/04590c7e-3786-4c60-bed7-4e2235246a85n%40googlegroups.com
> <https://groups.google.com/d/msgid/wradlib-users/04590c7e-3786-4c60-bed7-4e2235246a85n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Ercan Büyükbaş

unread,
Feb 19, 2021, 9:18:17 AM2/19/21
to wradli...@googlegroups.com
Dear Kai.
Thank you so much for your kind interest with my problem and answering my question.
Yes, the path I have is as follows:
C:\Users\Ercan\wradlib-data-master\geo

This is the command I used to set the environment variable:
  setx WRADLIB_DATA C:\Users\Ercan\wradlib-data-master\geo
I do not know if there may be a syntax error, but I received the message below:
SUCCESS: Specified value was saved.

I have been working with Windows as you guess from the set command I used.
I have been using jupyter notebook to edit and run the wradlib with example data.
I got that message for wradlib-data:
~\anaconda3\envs\wradlib\lib\site-packages\wradlib\util.py in get_wradlib_data_path()
    585     wrl_data_path = os.environ.get("WRADLIB_DATA", None)
    586     if wrl_data_path is None:
--> 587         raise EnvironmentError("'WRADLIB_DATA' environment variable not set")
    588     if not os.path.isdir(wrl_data_path):
    589         raise EnvironmentError(

OSError: 'WRADLIB_DATA' environment variable not set
 
 I will try your suggestion.
I hope it works.
Thanks a lot again.
Kind regards,
Ercan
19 Şub 2021 Cum 16:50 tarihinde Kai Mühlbauer <kai.mue...@uni-bonn.de> şunu yazdı:
You received this message because you are subscribed to a topic in the Google Groups "wradlib-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wradlib-users/_fg-mlHbtTo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wradlib-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wradlib-users/03118efa-68b7-448b-e6b2-3b52e370f0b1%40uni-bonn.de.

Ercan Büyükbaş

unread,
Feb 19, 2021, 10:23:14 AM2/19/21
to wradli...@googlegroups.com
Hi Kai,
I tried to set the environmental variable by using python console and inserted the command as you suggested, but it did not work.
I still have the same problem for WRADLIB_DATA.
thanks for your interest on that issue.
Kind regards,
Ercan

You received this message because you are subscribed to a topic in the Google Groups "wradlib-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wradlib-users/_fg-mlHbtTo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wradlib-user...@googlegroups.com.

Kai Mühlbauer

unread,
Feb 19, 2021, 10:34:37 AM2/19/21
to wradli...@googlegroups.com
Hi Ercan,

you would need to set it directly in the code where the processing is run.

So, if you have a python script, just add it at the beginning of the script. If you run jupyter notebook put it in a cell at the top of the notebook. That should work in any case.

If you still have problems please describe very detailed how you run the code.

Cheers,
Kai
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

Ercan Büyükbaş

unread,
Feb 19, 2021, 10:36:33 AM2/19/21
to wradli...@googlegroups.com
Thank you so much, Kai..
I will try and keep you informed. 
Kind regards, 
Ercan 


19 Şub 2021 Cum 18:34 tarihinde Kai Mühlbauer <kai.mue...@uni-bonn.de> şunu yazdı:

Ercan Büyükbaş

unread,
Feb 19, 2021, 10:43:50 AM2/19/21
to wradli...@googlegroups.com
Hi Kai,
Sorry for bothering you.
I tried in jupyter notebook, and I receive this error message:
File "<ipython-input-4-3e3abc23ae09>", line 2
    os.environ["WRADLIB_DATA"]="C:\Users\Ercan\wradlib-data-master\geo"
                               ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Kai Mühlbauer

unread,
Feb 19, 2021, 12:33:18 PM2/19/21
to wradli...@googlegroups.com
Hi Ercan,

now my poor Windows knowledge bites me ...

OK, this is propably with the backslashes, please use slashes instead.

HTH,
Kai

Kai Mühlbauer

unread,
Feb 19, 2021, 12:35:19 PM2/19/21
to wradli...@googlegroups.com
Hi again,

and do not append the 'geo'. Just use the unpacked folder. This should get you going.

Cheers,
Kai

Am 19. Februar 2021 15:43:31 UTC schrieb "Ercan Büyükbaş" <ercanb...@gmail.com>:

Ercan Büyükbaş

unread,
Feb 19, 2021, 3:17:35 PM2/19/21
to wradli...@googlegroups.com
Thanks a billion, Kai.
I will follow your suggestions. 


19 Şub 2021 Cum 20:35 tarihinde Kai Mühlbauer <kai.mue...@uni-bonn.de> şunu yazdı:

Ercan Büyükbaş

unread,
Feb 19, 2021, 3:52:20 PM2/19/21
to wradli...@googlegroups.com
Dear Kai,
I would like to express my deepest gratitude to you.
I never expected that the problem was coming from backslashes.
I used the slashes instead of backslashes without geo, and it works perfectly.
Thanks a billion for your kind interest and invaluable support.
All best regards,
Ercan


Kai Mühlbauer

unread,
Feb 19, 2021, 4:04:24 PM2/19/21
to wradli...@googlegroups.com
Hi Ercan,

Glad you got it working. And welcome as wradlib user.

Cheers,
Kai

Ercan Büyükbaş

unread,
Feb 19, 2021, 4:16:36 PM2/19/21
to wradli...@googlegroups.com
It is very kind of you.
I am glad to be here. 
Kindest regards,
Ercan 

20 Şub 2021 Cmt 00:04 tarihinde Kai Mühlbauer <kai.mue...@uni-bonn.de> şunu yazdı:

Fiacre Ryan

unread,
May 4, 2021, 2:58:49 AM5/4/21
to wradlib-users
Hi Kai,

I am getting the same initial problem with the error

OSError: 'WRADLIB_DATA' environment variable not set

however, when I try to set the missing environment variable using

setx WRADLIB_DATA C:\path\to\wradlib-data

I get a syntax error.

Specifically,

    setx WRADLIB_DATA C:/path/to/wradlib-data-master
         ^
SyntaxError: invalid syntax

Any help much appreciated.

Cheers, Fiacre

Kai Mühlbauer

unread,
May 4, 2021, 3:03:33 AM5/4/21
to wradli...@googlegroups.com
Hi Fiacre,

which OS are you on?

And, please, tell us exactly what you have done in which order. It seems
that you did run this command in Python. But this is a shell command.
You would have to run it in a shell.

Cheers,
Kai

Am 04.05.21 um 08:58 schrieb Fiacre Ryan:
>>>>>> File "<ipython-input-4-3e3abc23ae09>", line 2 os.environ["WRADLIB_DATA"]="C:\Users\Ercan\wradlib-data-master\geo" ^SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
>>>>> https://groups.google.com/d/msgid/wradlib-users/9F0853E6-2700-4992-856C-59084F6DA557%40uni-bonn.de
>>>>> <https://groups.google.com/d/msgid/wradlib-users/9F0853E6-2700-4992-856C-59084F6DA557%40uni-bonn.de?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>> --
>>> Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "wradlib-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/wradlib-users/_fg-mlHbtTo/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> wradlib-user...@googlegroups.com.
>>>
>> To view this discussion on the web, visit
>>> https://groups.google.com/d/msgid/wradlib-users/9AC7E54E-CB81-493C-9611-4313CB09B644%40uni-bonn.de
>>> <https://groups.google.com/d/msgid/wradlib-users/9AC7E54E-CB81-493C-9611-4313CB09B644%40uni-bonn.de?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>

Fiacre Ryan

unread,
May 4, 2021, 3:26:04 AM5/4/21
to wradlib-users
Hi Kai,

I am on a Windows OS.

All of the code from when I open the command window is below, I believe I am using python through the command window but I am unsure. (The file I am trying to open I have copied into the wradlib-data-master folder).

Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.

(base) C:\Users\FiacreRyan>activate wradlib

(wradlib) C:\Users\FiacreRyan>python
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 15:50:08) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wradlib as wrl
>>> wradlib.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'wradlib' is not defined
>>> wrl.__version__
'1.9.1'
>>> filename = '73_20200222_005041.pvol.h5'
>>> f = wrl.util.get_wradlib_data_file(filename)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\FiacreRyan\.conda\envs\wradlib\lib\site-packages\wradlib\util.py", line 596, in get_wradlib_data_file
    data_file = os.path.abspath(os.path.join(get_wradlib_data_path(), relfile))
  File "C:\Users\FiacreRyan\.conda\envs\wradlib\lib\site-packages\wradlib\util.py", line 587, in get_wradlib_data_path
    raise EnvironmentError("'WRADLIB_DATA' environment variable not set")
OSError: 'WRADLIB_DATA' environment variable not set
>>> setx WRADLIB_DATA C:/Users/FiacreRyan/wradlib-data-master
  File "<stdin>", line 1
    setx WRADLIB_DATA C:/Users/FiacreRyan/wradlib-data-master
         ^
SyntaxError: invalid syntax
>>>


Thanks, Fiacre

Kai Mühlbauer

unread,
May 4, 2021, 3:41:28 AM5/4/21
to wradli...@googlegroups.com
Hi Fiacre,

thanks for your detailed answer. I'll answer below inline.

Am 04.05.21 um 09:26 schrieb Fiacre Ryan:
> I am on a Windows OS.

OK, you are using the correct invocations.

>
> All of the code from when I open the command window is below, I believe I
> am using python through the command window but I am unsure. (The file I am
> trying to open I have copied into the wradlib-data-master folder).

OK, so just one thing to mention. You do not need to put that file into
the wradlib data folder and you can access any file on your filesystem
by just using the full path as argument to the wradlib functions. That
means you do not need to use `wrl.util.get_wradlib_data_file(filename)`
but just use filename.

If you want to use wradlib-data folder also with your own data, follow
up below.

>
> Microsoft Windows [Version 10.0.19042.928]
> (c) Microsoft Corporation. All rights reserved.
>
> (base) C:\Users\FiacreRyan>activate wradlib

Call setx here.
The above line you would need to set in the shell before calling `python`.

HTH,
Kai

Fiacre Ryan

unread,
May 4, 2021, 3:57:18 AM5/4/21
to wradlib-users
Hi Kai,

Thanks for all of the help.

Im still a little confused about how I can load a file in that case.

"That means you do not need to use `wrl.util.get_wradlib_data_file(filename)`
but just use filename."

What do you mean by just use file name.

Do you just mean the filename (including the full path) can be used as the argument to the below line.

fcontent = wrl.io.read_opera_hdf5(f)


Cheers, Fiacre


Kai Mühlbauer

unread,
May 4, 2021, 4:03:44 AM5/4/21
to wradli...@googlegroups.com
Hi Fiacre,

Am 04.05.21 um 09:57 schrieb Fiacre Ryan:
> Hi Kai,
>
> Thanks for all of the help.

You're welcome.
>
> Im still a little confused about how I can load a file in that case.
>
> "That means you do not need to use
> `wrl.util.get_wradlib_data_file(filename)`
> but just use filename."
>
> What do you mean by just use file name.
>
> Do you just mean the filename (including the full path) can be used as the
> argument to the below line.
>
> fcontent = wrl.io.read_opera_hdf5(f)

That's precisely what I wanted to explain. Thanks for pointing that out
more clearly.

The thing is, that we use the wradlib-data repo for testing,
documentation purposes and as tutorial data source. Via the environment
variable we have a means to find the wanted files regardless where it is
located.

Maybe we can improve the documentation? Can you suggest where we should
put additional notes, to minimize users getting confused?

Cheers,
Kai
>> https://groups.google.com/d/msgid/wradlib-users/9AC7E54E-CB81-493C-9611-4313CB09B644%40uni-bonn.de
>>>>>>> <
>>>>
>> https://groups.google.com/d/msgid/wradlib-users/9AC7E54E-CB81-493C-9611-4313CB09B644%40uni-bonn.de?utm_medium=email&utm_source=footer
>>>>>
>>>>>>> .
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>

Fiacre Ryan

unread,
May 5, 2021, 12:40:07 AM5/5/21
to wradlib-users
Hi Kai, 

It makes a lot of sense in hindsight now. As far as the documentation perhaps there could be more detail included in the installation section. In saying that, it was my first ever experience with Python and anaconda yesterday so I was very prone to misunderstanding.

Regardless, I've got it working now. Thanks for your time.!

Cheers, Fiacre

Reply all
Reply to author
Forward
0 new messages