UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 0: invalid start byte

493 views
Skip to first unread message

sandeep allampalli

unread,
Oct 3, 2022, 9:28:54 AM10/3/22
to wradlib-users
Dear wradlib users,

I am trying to read radolan files which are in ASCII format. 
My code is something like this: "data_raw, meta = wrl.io.read_radolan_composite(filename)"
And error: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 0: invalid start byte"

Any help is highly appreciated.

Thanks in Advance,
Sandeep

Kai Mühlbauer

unread,
Oct 3, 2022, 10:58:05 AM10/3/22
to wradli...@googlegroups.com
Dear Sandeep,

first, you might also ask this question here:

https://openradar.discourse.group

as we slowly transitioning towards a combined discussion resource.

To correctly answer your question, please provide your Python version,
wradlib version and the file in question (as attachment or linked).

A complete traceback of the exact error message helps too.

Thanks,
Kai

Am 03.10.22 um 15:28 schrieb sandeep allampalli:
> --
> 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/7f475869-34ef-4079-a31b-6901f921499bn%40googlegroups.com
> <https://groups.google.com/d/msgid/wradlib-users/7f475869-34ef-4079-a31b-6901f921499bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

sandeep allampalli

unread,
Oct 3, 2022, 11:18:52 AM10/3/22
to wradlib-users

Hello all,

I am trying to read data from (Index of /climate_environment/CDC/grids_germany/hourly/radolan/historical/asc/). I have downloaded the data to my local machine. For reference I am writing my code below in comments.

import os 
import sys
import wradlib as wrl
import numpy as np 
import warnings warnings.filterwarnings("ignore") 
 os.environ["WRADLIB_DATA"] = "C:\\Users\Admin\wradlib-data-main" 
 filename = "Data/Firstyear/RW-200506.tar" 
filename = wrl.util.get_wradlib_data_file(filename) 
data_raw, meta = wrl.io.read_radolan_composite(filename)

When running the file this is the error I am facing:

runfile(‘D:/Sandeep/Thesis/thesis.py’, wdir=‘D:/Sandeep/Thesis’)
Traceback (most recent call last):

File “C:\ProgramData\Anaconda3\envs\wradlib\lib\site-packages\spyder_kernels\py3compat.py”, line 356, in compat_exec
exec(code, globals, locals)

File “d:\sandeep\thesis\thesis.py”, line 19, in
data_raw, meta = wrl.io.read_radolan_composite(filename)

File “C:\ProgramData\Anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py”, line 763, in read_radolan_composite
attrs = radfile.attrs

File “C:\ProgramData\Anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py”, line 1000, in attrs
self._attrs = self._read_attrs()

File “C:\ProgramData\Anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py”, line 1039, in _read_attrs
header = read_radolan_header(self.fp)

File “C:\ProgramData\Anaconda3\envs\wradlib\lib\site-packages\wradlib\io\radolan.py”, line 691, in read_radolan_header
header += str(mychar.decode())

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x8b in position 0: invalid start byte


Reply all
Reply to author
Forward
0 new messages