# OSError: 'WRADLIB\_DATA' path 'C:/Users/Admin/wradlib-data' does not exist

**URL:** <https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61>\
**Category:** Data\
**Tags:** wradlib, data\
**Created:** [October 18, 2022, 1:36pm UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61 "2022-10-18T13:36:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SandeepAllampalli](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/sandeepallampalli/32/17_2.png) [@SandeepAllampalli](https://openradar.discourse.group/u/SandeepAllampalli)\
**Post date:** [October 18, 2022, 1:36pm UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61/1 "2022-10-18T13:36:53Z")

</div>

Hi there,

Python version: 3.9.12  
wradlib version: 1.16.2

I was trying to run the following code. But it throws me this error.

```auto
f = wrl.util.get_wradlib_data_file(file_path[0])
data, metadata = wrl.io.read_radolan_composite(f)

```

Here file\_path[0] is ‘RW-200506.tar.gz’ which is a binary file.

```auto
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_12220\2806575136.py in <cell line: 1>()
----> 1 f = wrl.util.get_wradlib_data_file(file_path[0])
      2 data, metadata = wrl.io.read_radolan_composite(f)

~\anaconda3\envs\wradlib\lib\site-packages\wradlib\util.py in get_wradlib_data_file(relfile)
    598 
    599 def get_wradlib_data_file(relfile):
--> 600 data_file = os.path.abspath(os.path.join(get_wradlib_data_path(), relfile))
    601 if not os.path.exists(data_file):
    602 raise EnvironmentError(f"WRADLIB_DATA file '{data_file}' does not exist")

~\anaconda3\envs\wradlib\lib\site-packages\wradlib\util.py in get_wradlib_data_path()
    593 raise EnvironmentError("'WRADLIB_DATA' environment variable not set")
    594 if not os.path.isdir(wrl_data_path):
--> 595 raise EnvironmentError(f"'WRADLIB_DATA' path '{wrl_data_path}' does not exist")
    596 return wrl_data_path
    597 

OSError: 'WRADLIB_DATA' path 'C:/Users/Admin/wradlib-data' does not exist

```

---

<div class="post-metadata">

**Author:** ![SandeepAllampalli](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/sandeepallampalli/32/17_2.png) [@SandeepAllampalli](https://openradar.discourse.group/u/SandeepAllampalli)\
**Post date:** [October 19, 2022, 11:17am UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61/2 "2022-10-19T11:17:39Z")

</div>

@kmuehlbauer Do you have anything to say on this?

Note: Since there is problem with ASCII, I am using binary data files. However, i still encountered the above error while reading the file.

---

<div class="post-metadata">

**Author:** ![kmuehlbauer](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/kmuehlbauer/32/439_2.png) [@kmuehlbauer](https://openradar.discourse.group/u/kmuehlbauer)\
**Post date:** [October 19, 2022, 11:27am UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61/3 "2022-10-19T11:27:03Z")

</div>

First a `tar.gz` - file is an archive of data files. wradlib expects single data files. So, you would need to iterate over the tar-archive and feed single files to the wradlib-reader.

Second, `wrl.util.get_wradlib_datafile` is a convenience-function which returns an absolute path to the wanted file inside the `wradlib-data` repo. We use it for testing and for the wradlib-notebooks. You do not want to use it in normal operation. Just do:

```python
data, metadata = wrl.io.read_radolan_composite(filename)

```

where filename points to the wanted file.

---

<div class="post-metadata">

**Author:** ![SandeepAllampalli](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/sandeepallampalli/32/17_2.png) [@SandeepAllampalli](https://openradar.discourse.group/u/SandeepAllampalli)\
**Post date:** [October 29, 2022, 9:08am UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61/4 "2022-10-29T09:08:28Z")

</div>

Hello @kmuehlbauer ,

I understood the second point. Here my doubt is with the first point. How can I iterate over the tar archive and feed single files without actually downloading them to the local machine?  
Is there any sample code available for achieving this? Here my goal is to read files from 2005 to 2021 (loop through each year and in every year loop through each month and in each month loop through each day and so on…) I found it little difficult to iterate over multiple loops. Is there any documentation available to loop through .tar archive and reading files without downloading them?

---

<div class="post-metadata">

**Author:** ![kmuehlbauer](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/kmuehlbauer/32/439_2.png) [@kmuehlbauer](https://openradar.discourse.group/u/kmuehlbauer)\
**Post date:** [November 2, 2022, 6:52am UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61/5 "2022-11-02T06:52:17Z")

</div>

Hi @SandeepAllampalli,

There might be ways to open a tar-file directly from the external location, but at least I do not know one.

You would at least need to download the tar-archive. You can then iterate over the contents without extracting physically to disk.

With the following code snippet (see [RADOLAN Product Showcase — wradlib](https://docs.wradlib.org/en/stable/notebooks/radolan/radolan_showcase.html#RV-Product) for more detail) you can achieve that.

```python
import tarfile
fname = "DE1200_RV2210180700.tar.bz2"
# open the tar archive
fp = tarfile.open(fname)
# get the names
names = fp.getnames()
# extract all files into memory stream buffer
buffer = [io.BytesIO(fp.extractfile(name).read()) for name in names]
# name all streams accordingly (!)
for buf, name in zip(buffer, names):
    buf.name = name
# open with radolan reader
ds = wrl.io.open_radolan_mfdataset(buffer)
display(ds)

```

---

<div class="post-metadata">

**Author:** ![SandeepAllampalli](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/sandeepallampalli/32/17_2.png) [@SandeepAllampalli](https://openradar.discourse.group/u/SandeepAllampalli)\
**Post date:** [November 3, 2022, 6:50am UTC](https://openradar.discourse.group/t/oserror-wradlib-data-path-c-users-admin-wradlib-data-does-not-exist/61/6 "2022-11-03T06:50:28Z")

</div>

Hi @kmuehlbauer,

Thank you for the reply.
