AttributeError

504 views
Skip to first unread message

markus....@gmail.com

unread,
Jul 11, 2016, 6:25:56 AM7/11/16
to wradlib-users
Dear all,

I would like to step through the  wradlib tutorial
(A Typical Workflow for Radar-Based Rainfall Estimation).
In the step In [2]  I get the following error -->

>>> filename = wrl.util.get_wradlib_data_file('dx/raa00-dx_10908-0806021655-fbg---bin.gz')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'get_wradlib_data_file'

So everythin works until i want to read in the dx/raa00-dx_10908-0806021655-fbg---bin.gz' file!


Does anyone know the problem, or has ever had this error bevore, pleas help me?

Best regards,
Markus

irene crisologo

unread,
Jul 11, 2016, 7:14:36 AM7/11/16
to wradli...@googlegroups.com
Hi Markus,

You also have to clone the wradlib data repository (instructions can be found here: https://github.com/wradlib/wradlib-data/blob/master/README.md), because the 'get_wradlib_data_file' module looks into this repository for the files used in the examples.

Hope this helps,
irene

--
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.
For more options, visit https://groups.google.com/d/optout.

Maik Heistermann

unread,
Jul 11, 2016, 7:31:18 AM7/11/16
to wradlib-users
Dear Markus,

there might be another issue here: wradlib release 0.8.x does not yet include the "new" way in using WRADLIB_DATA together with the util.get_wradlib_data_file function. In order to use these functions, you need to install the bleeding edge code. You could e.g. try this:

1. Download the bleeding edge distribution here: https://github.com/wradlib/wradlib/archive/master.zip

2. Extract to some temporary directory and open a console/bash in that directory

3. Now execute from the command line:

$ activate wradlib
$ python setup.py install

Hope it helps...

Best,
Maik
To unsubscribe from this group and stop receiving emails from it, send an email to wradlib-users+unsubscribe@googlegroups.com.

markus....@gmail.com

unread,
Jul 11, 2016, 10:17:51 AM7/11/16
to wradlib-users
Dear Maik,

I did the things you posted here, I executed $ source activate wradlib because only $ activate wradlib doesn't work!
When I execute the following in the tempory directory  (which in my case is downloads) $ python setup.py install, I get the following error 
(python: can't open file 'setup.py': [Errno 2] No such file or directory)! So python can't find the setup.py file. 
Do you no were I can find it, or get it?

Thank you
    Markus

To unsubscribe from this group and stop receiving emails from it, send an email to wradlib-user...@googlegroups.com.

markus....@gmail.com

unread,
Jul 11, 2016, 10:26:13 AM7/11/16
to wradlib-users
Dear Irene,

thank you for your quick respond, but I cloned the wradlib data repository from the verry start!

Best regards,
    Markus

Am Montag, 11. Juli 2016 13:14:36 UTC+2 schrieb irene:

Kai Muehlbauer

unread,
Jul 11, 2016, 10:30:31 AM7/11/16
to wradli...@googlegroups.com
Hi Markus,

you are sure you have unzipped "master.zip"? You also need to descent
into the created directory.

Cheers,
Kai
>>> On Mon, Jul 11, 2016 at 12:25 PM, <markus....@gmail.com <javascript:>>
>>> wrote:
>>>
>>>> Dear all,
>>>>
>>>> I would like to step through the wradlib tutorial
>>>> (A Typical Workflow for Radar-Based Rainfall Estimation).
>>>> In the step In [2] I get the following error -->
>>>>
>>>>>>> filename =
>>>> wrl.util.get_wradlib_data_file('dx/raa00-dx_10908-0806021655-fbg---bin.gz')
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in <module>
>>>> AttributeError: 'module' object has no attribute 'get_wradlib_data_file'
>>>>
>>>> So everythin works until i want to read in the
>>>> dx/raa00-dx_10908-0806021655-fbg---bin.gz' file!
>>>>
>>>> Does anyone know the problem, or has ever had this error bevore, pleas
>>>> help me?
>>>>
>>>> Best regards,
>>>> Markus
>>>>
>>>> --
>>>> 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 <javascript:>.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>

--
Kai Muehlbauer
Meteorological Institute University of Bonn
Auf dem Huegel 20 | +49 228 739083
D-53121 Bonn | kai.mue...@uni-bonn.de

markus....@gmail.com

unread,
Jul 11, 2016, 11:06:05 AM7/11/16
to wradlib-users, kai.mue...@uni-bonn.de
Hello Maik,

Yes I'm quite sure, when I unzip wradlib-master.zip, I get the following folder wradlib-data-master. In that folder there are the following subfolders
(dx  geo  hdf5  misc  netcdf  radolan  rainbow  README.md  shapefiles).
But there is no setup.py script, is it necessary?
When I now execute source activate wradlib --> that works!
But when I execute $ python setup.py install, it does not work!
So coming to the above question, when I want to ececute a script, it has to be somewhere, or am I completly wrong?

Thx
    Markus

Kai Mühlbauer

unread,
Jul 11, 2016, 11:35:10 AM7/11/16
to markus....@gmail.com, wradlib-users
Hi Markus,

ah, this is a misunderstanding.

We need to distinguish between "wradlib" and "wradlib-data". "wradlib"
is the source code, "wradlib-data" is the example radar data.

You need to unzip "wradlib-data" archive to some folder, which will not
be temporary. Then you need to export this folder in the env variable
WRADLIB_DATA.

The you have to unzip "wradlib" archive to some other folder. There
inside you'll find the setup.py and all the radar code.

HTH!

Cheers,
Kai

Am 11.07.2016 um 17:06 schrieb markus....@gmail.com:
> Hello Maik,
>
> Yes I'm quite sure, when I unzip wradlib-master.zip, I get the following
> folder wradlib-data-master. In that folder there are the following
> subfolders
> (dx geo hdf5 misc netcdf radolan rainbow README.md shapefiles).
> But there is no setup.py script, is it necessary?
> When I now execute source activate wradlib --> that works!
> But when I execute $ python setup.py install, it does not work!
> So coming to the above question, when I want to ececute a script, it has
> to be somewhere, or am I completly wrong?
>
> Thx
> Markus
>
> Am Montag, 11. Juli 2016 16:30:31 UTC+2 schrieb Kai Muehlbauer:
>
> Hi Markus,
>
> you are sure you have unzipped "master.zip"? You also need to descent
> into the created directory.
>
> Cheers,
> Kai
>
> <https://github.com/wradlib/wradlib-data/blob/master/README.md>),
> <https://groups.google.com/d/optout>.
> >>>>
> >>>
> >>>
> >
>
> --
> Kai Muehlbauer
> Meteorological Institute University of Bonn
> Auf dem Huegel 20 | +49 228 739083
> D-53121 Bonn | kai.mue...@uni-bonn.de <javascript:>
>

Kai Mühlbauer

unread,
Jul 11, 2016, 11:39:13 AM7/11/16
to wradli...@googlegroups.com
Here are the links to the two repos at github:

wradlib
https://github.com/wradlib/wradlib

wradlib-data
https://github.com/wradlib/wradlib-data

- Kai

markus....@gmail.com

unread,
Jul 13, 2016, 3:09:58 AM7/13/16
to wradlib-users, kai.mue...@uni-bonn.de
Hello Together, 

I'm affraid but I still get an error mesage!
I have two folders one data folder where there is the unziped version of (wradlib-master.zip). Then I have another folder the source folder where I have the wradlib folder, which to my understanding is part of the (wradlib-master.zip) file. So I only copied the wradlib folder (which in my situation was not zipped) in the my created source folder!

I think that I have problems with the exporting! I did the following (export WRADLIB_DATA=/home/unix/Desktop/data) ...so I exported the hole data folder, is that correct? By the way I do not really understand, what the export does!

Then I followed the stepps in Maik's post 
$ activate wradlib (I did source activate wradlib, because without source it does not work)
$ python setup.py install
This two stepps work, but if I follow the stepps in the tutorial In [2]: 
I get the following error message!

>>> filename = wrl.util.get_wradlib_data_file('/home/unix/Desktop/data/wradlib-master/examples/data/raa00-dx_10908-0806021655-fbg---bin.gz')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/unix/anaconda2/envs/wradlib/lib/python2.7/site-packages/wradlib/util.py", line 1375, in get_wradlib_data_file
    data_file = os.path.join(get_wradlib_data_path(), relfile)
  File "/home/unix/anaconda2/envs/wradlib/lib/python2.7/site-packages/wradlib/util.py", line 1367, in get_wradlib_data_path
    raise EnvironmentError("'WRADLIB_DATA' environment variable not set")
EnvironmentError: 'WRADLIB_DATA' environment variable not set
>>>

Best regards and thank you
Markus

Maik Heistermann

unread,
Jul 13, 2016, 4:37:30 AM7/13/16
to wradlib-users, kai.mue...@uni-bonn.de
Dear Markus,

sorry it does not yet work out.

The export command under Linux sets an environment variable, in this case the environment variable WRADLIB_DATA. wradlib uses this variable in order to find the path where you stored the example data.

You can use the shell comand printenv in order to show all environment variables. Do you find WRADLIB_DATA in the output of printenv? If not, something went wrong.

The path represented by WRADLIB_DATA must point to the directory that contains the unzipped directories from the wradlib-data repository. So if you execute

$ export WRADLIB_DATA=/home/unix/Desktop/data

the directory data must contain a set of subdirectories such as dx, geo, hdf5 etc.

Hope this helps to find what's wrong.

Best,
Maik

Kai Muehlbauer

unread,
Jul 13, 2016, 4:39:27 AM7/13/16
to wradli...@googlegroups.com
Hi Markus,

we are getting closer now.

If the folder where wradlib-data is located is

/home/unix/Desktop/data

then you need to export this folder in the WRADLIB_DATA environment
variable.

Could you export this correctly?

$ export WRADLIB_DATA=/home/unix/Desktop/data
$ echo $WRADLIB_DATA

Be careful this will only work in a bash-like shell, for other shell
types setting an env var might be different. And, this adds the
WRADLIB_DATA environment variable only in your active shell. To make
this system wide or shell permanent, you would have to add it to your
system environment or to your .bashrc (for bash-shell) respectively.

The error you are getting, indicates that WRADLIB_DATA is not set within
your environment from where you run the script.

Also do not give the full path

>
wrl.util.get_wradlib_data_file('/home/unix/Desktop/data/wradlib-master/examples/data/raa00-dx_10908-0806021655-fbg---bin.gz')

but do this:

wrl.util.get_wradlib_data_file('dx/raa00-dx_10908-0806021655-fbg---bin.gz')

HTH!

Cheers,
Kai

markus....@gmail.com

unread,
Jul 13, 2016, 8:07:32 AM7/13/16
to wradlib-users, kai.mue...@uni-bonn.de
Ok, 
many thanks to all, now it works!
One last questions,
--> How can I inspect the data? In the tutorial is something is written like via keywords, is keywords a folder, or programm... or something like that?

Best regards
    Markus

Kai Muehlbauer

unread,
Jul 13, 2016, 8:22:02 AM7/13/16
to wradli...@googlegroups.com
Markus,

we are talking python :-) "keywords" is obviously not the right term
here, it should read 'keys'.

Take this line:

data, metadata = wrl.io.readDX(filename)

This means, the radar data is available as numpy array "data".

Metadata is extracted into the "metadata" python dictionary. You can
inspect this with:

> print(metadata.keys())

dict_keys(['datetime', 'message', 'elevprofile', 'azim', 'version',
'statfilter', 'radarid', 'producttype', 'bytes', 'cluttermap', 'elev',
'clutter', 'dopplerfilter'])

> print(metadata['datetime'])

2008-06-02 16:55:00+00:00

So, mostly we are referring to the python code and variables.

HTH!

Cheers,
Kai

markus....@gmail.com

unread,
Jul 13, 2016, 9:21:24 AM7/13/16
to wradlib-users, kai.mue...@uni-bonn.de
Hello Maik,

ah ok, this is a missunderstanding! 
What I wanted to know is the following... If I copy the commands in In [2], I should get a popup-window with a plot, or I'm I wrong?
I do not get a picture, I only get no error message!
This is what I meant with 'inspect'!

Best regards,
    Markus

Kai Muehlbauer

unread,
Jul 13, 2016, 10:07:54 AM7/13/16
to wradlib-users
Ahh I see.

You're not in a Notebook session, but with normal python interpreter.

Try pl.show() at the end of the code. This should create the window.

Cheers,
Kai

markus....@gmail.com

unread,
Jul 13, 2016, 11:03:41 AM7/13/16
to wradlib-users, kai.mue...@uni-bonn.de
Oh yes,
I can see a figure!!!

Thank verry much
    Markus
Reply all
Reply to author
Forward
0 new messages