Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
AossTower
Commits
294ea1d9
Verified
Commit
294ea1d9
authored
7 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Fix symbol renaming in frame generation for legacy db
parent
7d2b1e37
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aosstower/level_00/parser.py
+6
-4
6 additions, 4 deletions
aosstower/level_00/parser.py
with
6 additions
and
4 deletions
aosstower/level_00/parser.py
+
6
−
4
View file @
294ea1d9
...
...
@@ -64,17 +64,18 @@ class LineParseError(Exception):
raise
exc
def
_make_frame
(
data
,
rename_timestamp
=
False
):
def
_make_frame
(
data
,
new_symbols
=
None
,
rename_timestamp
=
False
):
"""
Construct a frame from a list of tuples.
"""
frame
=
{}
for
key
,
value
in
data
:
for
idx
,
(
key
,
value
)
in
enumerate
(
data
)
:
if
key
in
[
'
stamp
'
,
'
timestamp
'
]:
frame
[
'
stamp
'
if
rename_timestamp
else
key
]
=
value
continue
if
key
in
database
:
try
:
frame
[
key
]
=
database
[
key
].
type
(
value
)
new_key
=
new_symbols
[
idx
]
if
new_symbols
and
len
(
new_symbols
)
>
idx
else
key
frame
[
new_key
]
=
database
[
key
].
type
(
value
)
except
(
ValueError
,
TypeError
):
raise
LineParseError
(
"
error converting
'
%s
'
using %s
"
,
value
,
database
[
key
].
type
)
...
...
@@ -218,7 +219,8 @@ def read_frames(source, error_handler=lambda *a: None, tail=False):
def
loggernet_to_tower
(
rec_dict
,
symbol_names
):
"""
Convert loggernet record dictionary to our standard naming
"""
# assume that the next record after the traditional frame is the timestamp
return
_make_frame
(
zip
([
'
timestamp
'
]
+
symbol_names
,
rec_dict
.
values
()),
rename_timestamp
=
True
)
new_symbols
=
[
'
timestamp
'
]
+
symbol_names
return
_make_frame
(
zip
(
new_symbols
,
rec_dict
.
values
()),
new_symbols
,
rename_timestamp
=
True
)
def
ldmp_generator
(
station_name
,
tables
,
symbol_names
=
ParserV1V2
.
names
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment