Skip to content

Commit

Permalink
Decode bytes to str
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfokkema committed Jun 11, 2024
1 parent d1cd8ee commit 5279219
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion publicdb/api/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def retrieve_traces(node, timestamp, nanoseconds, raw=False):
event = node.events.read_where(f'(timestamp == {timestamp}) & (nanoseconds == {nanoseconds})')[0]
traces_idx = event['traces']
baselines = event['baseline']
traces_str = [zlib.decompress(node.blobs[trace_idx]).split(',') for trace_idx in traces_idx if trace_idx != -1]
traces_str = [zlib.decompress(node.blobs[trace_idx]).decode().split(',') for trace_idx in traces_idx if trace_idx != -1]

Check failure on line 40 in publicdb/api/datastore.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (E501)

publicdb/api/datastore.py:40:121: E501 Line too long (124 > 120)

traces = [
[int(value) if baseline == -999 or raw else int(value) - baseline for value in trace_str if value != '']
Expand Down
2 changes: 1 addition & 1 deletion publicdb/raw_data/knmi_lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_reference_datetime(datafile):
:return: datetime object of the reference datetime
"""
date_string = datafile.root.discharge1._f_getattr('reference_datetime')[0]
date_string = datafile.root.discharge1._f_getattr('reference_datetime')[0].decode()
ref_date = datetime.strptime(date_string, '%d-%b-%Y;%H:%M:%S.%f')

return ref_date

0 comments on commit 5279219

Please sign in to comment.