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
84f20276
Commit
84f20276
authored
10 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
Make frame a MutableMapping. Do a little linting.
parent
dadab83c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aosstower/frame.py
+19
-1
19 additions, 1 deletion
aosstower/frame.py
aosstower/l00/parser.py
+3
-4
3 additions, 4 deletions
aosstower/l00/parser.py
aosstower/station.py
+2
-0
2 additions, 0 deletions
aosstower/station.py
with
24 additions
and
5 deletions
aosstower/frame.py
+
19
−
1
View file @
84f20276
from
_abcoll
import
MutableMapping
from
aosstower
import
station
class
Frame
(
dict
):
class
Frame
(
MutableMapping
):
def
__init__
(
self
,
width
=
station
.
DATA_INTERVAL
):
self
.
_data
=
{}
self
.
width
=
width
def
__getattr__
(
self
,
name
,
default
=
None
):
return
self
.
get
(
name
,
default
)
def
__getitem__
(
self
,
name
):
return
self
.
_data
[
name
]
def
__setitem__
(
self
,
name
,
value
):
self
.
_data
[
name
]
=
value
def
__delitem__
(
self
,
name
):
del
self
.
_data
[
name
]
def
__iter__
(
self
):
return
iter
(
self
.
_data
)
def
__len__
(
self
):
return
len
(
self
.
_data
)
This diff is collapsed.
Click to expand it.
aosstower/l00/parser.py
+
3
−
4
View file @
84f20276
"""
"""
Code to parse level 00 data.
Data Versions
=============
There have so far been 3 changes to the format of the raw ASCII data over the
...
...
@@ -38,7 +39,6 @@ from datetime import datetime, timedelta
from
metobs
import
data
as
d
from
aosstower.schema
import
database
from
aosstower.frame
import
Frame
LOG
=
logging
.
getLogger
(
__name__
)
...
...
@@ -57,14 +57,13 @@ class LineParseError(Exception):
def
_make_frame
(
data
):
"""
Construct a frame from a list of tuples.
"""
frame
=
Frame
()
for
key
,
value
in
data
:
if
key
==
'
stamp
'
:
continue
if
key
in
database
:
try
:
data
[
key
]
=
database
[
key
].
type
(
data
[
key
])
except
(
ValueError
,
TypeError
)
as
err
:
except
(
ValueError
,
TypeError
):
raise
LineParseError
(
"
error converting
'
%s
'
using %s
"
,
data
[
key
],
database
[
key
].
type
)
return
data
...
...
This diff is collapsed.
Click to expand it.
aosstower/station.py
+
2
−
0
View file @
84f20276
"""
Station metadata.
"""
from
datetime
import
timedelta
# Time between data samples in seconds
...
...
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