Skip to content
Snippets Groups Projects
Commit dadab83c authored by Bruce Flynn's avatar Bruce Flynn
Browse files

Merge branch 'develop' of versionitis.ssec.wisc.edu:/git/metobs/AossTower into develop

Conflicts:
	aosstower/l00/parser.py
parents d3ace430 23489a29
No related branches found
No related tags found
No related merge requests found
......@@ -60,13 +60,14 @@ def _make_frame(data):
frame = Frame()
for key, value in data:
if key == 'stamp':
frame[key] = value
elif key in database:
frame[key] = database[key].type(value)
else:
frame[key] = value
return frame
continue
if key in database:
try:
data[key] = database[key].type(data[key])
except (ValueError, TypeError) as err:
raise LineParseError("error converting '%s' using %s",
data[key], database[key].type)
return data
class ParserV0(object):
......
......@@ -5,8 +5,8 @@ import logging
from datetime import datetime
from metobscommon.model import RrdModel, ModelError
from aosstower.record import Record, LineParseError
from aosstower.model import initialize_rrd, VARS
from aosstower.l00.parser import read_records
from aosstower.l00.rrd import initialize_rrd
LOG = logging
......@@ -41,6 +41,7 @@ if __name__ == '__main__':
LOG.info("Enter time ordered data files, one per line, ^D when done")
args.files = sys.stdin
for each in args.files.readlines():
fpath = each.strip()
if not os.path.exists(fpath):
......@@ -48,17 +49,9 @@ if __name__ == '__main__':
continue
LOG.info("adding %s", fpath)
for line in open(fpath).readlines():
if not line.strip():
continue
try:
record = Record.create(line)
except LineParseError as err:
LOG.error(str(err))
continue
for record in read_records(fpath):
try:
rrd.add_record(record['stamp'], record)
except ModelError:
LOG.exception("Could not insert: %s", record)
except ModelError as err:
LOG.error("Insert failed: %s", err)
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