Skip to content
Snippets Groups Projects
Verified Commit 18100e99 authored by David Hoese's avatar David Hoese
Browse files

Fix imports to point to new metobscommon.data package

parent 239c49e5
No related branches found
No related tags found
No related merge requests found
...@@ -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 metobscommon.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)
......
...@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment