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
18100e99
Verified
Commit
18100e99
authored
6 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Fix imports to point to new metobscommon.data package
parent
239c49e5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aosstower/level_00/parser.py
+2
-2
2 additions, 2 deletions
aosstower/level_00/parser.py
aosstower/level_00/rrd.py
+8
-7
8 additions, 7 deletions
aosstower/level_00/rrd.py
with
10 additions
and
9 deletions
aosstower/level_00/parser.py
+
2
−
2
View file @
18100e99
...
@@ -45,7 +45,7 @@ import time
...
@@ -45,7 +45,7 @@ import time
import
logging
import
logging
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
from
metobs
import
data
as
d
from
metobs
common.data.data_time
import
hhmm_to_offset
from
aosstower.schema
import
database
from
aosstower.schema
import
database
LOG
=
logging
.
getLogger
(
__name__
)
LOG
=
logging
.
getLogger
(
__name__
)
...
@@ -151,7 +151,7 @@ class ParserV1V2(object):
...
@@ -151,7 +151,7 @@ class ParserV1V2(object):
year
=
int
(
parts
[
1
])
year
=
int
(
parts
[
1
])
doy
=
int
(
parts
[
2
])
doy
=
int
(
parts
[
2
])
dt
=
datetime
.
strptime
(
'
{:d}.{:03d}
'
.
format
(
int
(
year
),
int
(
doy
)),
'
%Y.%j
'
)
dt
=
datetime
.
strptime
(
'
{:d}.{:03d}
'
.
format
(
int
(
year
),
int
(
doy
)),
'
%Y.%j
'
)
secs
=
d
.
hhmm_to_offset
(
parts
[
3
])
secs
=
hhmm_to_offset
(
parts
[
3
])
secs
+=
float
(
parts
[
4
])
secs
+=
float
(
parts
[
4
])
secs
-=
(
secs
%
5
)
secs
-=
(
secs
%
5
)
dt
+=
timedelta
(
seconds
=
secs
)
dt
+=
timedelta
(
seconds
=
secs
)
...
...
This diff is collapsed.
Click to expand it.
aosstower/level_00/rrd.py
+
8
−
7
View file @
18100e99
...
@@ -6,7 +6,8 @@ from datetime import datetime, timedelta
...
@@ -6,7 +6,8 @@ from datetime import datetime, timedelta
import
rrdtool
import
rrdtool
from
metobs
import
data
as
d
from
metobscommon.data.calc
import
altimeter
,
dewpoint
,
wind_vector_components
from
metobscommon.data.data_time
import
to_unix_timestamp
from
aosstower
import
station
from
aosstower
import
station
...
@@ -18,8 +19,8 @@ VARS = {'air_temp', 'rh', 'dewpoint',
...
@@ -18,8 +19,8 @@ VARS = {'air_temp', 'rh', 'dewpoint',
def
add_vector_winds
(
record
):
def
add_vector_winds
(
record
):
east
,
north
,
spd
=
d
.
wind_vector_components
(
float
(
record
[
'
wind_speed
'
]),
east
,
north
,
spd
=
wind_vector_components
(
float
(
record
[
'
wind_speed
'
]),
float
(
record
[
'
wind_dir
'
]))
float
(
record
[
'
wind_dir
'
]))
record
[
'
winddir_east
'
]
=
'
%.3d
'
%
east
record
[
'
winddir_east
'
]
=
'
%.3d
'
%
east
record
[
'
winddir_north
'
]
=
'
%.3d
'
%
north
record
[
'
winddir_north
'
]
=
'
%.3d
'
%
north
...
@@ -27,12 +28,12 @@ def add_vector_winds(record):
...
@@ -27,12 +28,12 @@ def add_vector_winds(record):
def
add_altimeter
(
record
,
elev
=
station
.
ELEVATION
):
def
add_altimeter
(
record
,
elev
=
station
.
ELEVATION
):
record
[
'
altimeter
'
]
=
'
%.3d
'
%
d
.
altimeter
(
float
(
record
[
'
pressure
'
]),
elev
)
record
[
'
altimeter
'
]
=
'
%.3d
'
%
altimeter
(
float
(
record
[
'
pressure
'
]),
elev
)
def
add_dewpoint
(
record
):
def
add_dewpoint
(
record
):
record
[
'
dewpoint
'
]
=
'
%.3d
'
%
d
.
dewpoint
(
float
(
record
[
'
air_temp
'
]),
record
[
'
dewpoint
'
]
=
'
%.3d
'
%
dewpoint
(
float
(
record
[
'
air_temp
'
]),
float
(
record
[
'
rh
'
]))
float
(
record
[
'
rh
'
]))
def
initialize_rrd
(
filepath
,
start
=
None
,
days
=
365
,
data_interval
=
5
):
def
initialize_rrd
(
filepath
,
start
=
None
,
days
=
365
,
data_interval
=
5
):
...
@@ -41,7 +42,7 @@ def initialize_rrd(filepath, start=None, days=365, data_interval=5):
...
@@ -41,7 +42,7 @@ def initialize_rrd(filepath, start=None, days=365, data_interval=5):
assert
not
os
.
path
.
exists
(
filepath
),
"
DB already exists
"
assert
not
os
.
path
.
exists
(
filepath
),
"
DB already exists
"
start
=
start
or
(
datetime
.
utcnow
()
-
timedelta
(
days
=
days
))
start
=
start
or
(
datetime
.
utcnow
()
-
timedelta
(
days
=
days
))
# normalize start to data interval
# normalize start to data interval
secs
=
d
.
to_unix_timestamp
(
start
)
secs
=
to_unix_timestamp
(
start
)
secs
-=
secs
%
data_interval
secs
-=
secs
%
data_interval
rrdtool
.
create
(
filepath
,
rrdtool
.
create
(
filepath
,
...
...
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