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

Fix script for new model code

parent c8f18830
No related merge requests found
...@@ -5,8 +5,8 @@ import logging ...@@ -5,8 +5,8 @@ import logging
from datetime import datetime from datetime import datetime
from metobscommon.model import RrdModel, ModelError from metobscommon.model import RrdModel, ModelError
from aosstower.record import Record, LineParseError from aosstower.l00.parser import read_records
from aosstower.model import initialize_rrd, VARS from aosstower.l00.rrd import initialize_rrd
LOG = logging LOG = logging
...@@ -41,6 +41,7 @@ if __name__ == '__main__': ...@@ -41,6 +41,7 @@ if __name__ == '__main__':
LOG.info("Enter time ordered data files, one per line, ^D when done") LOG.info("Enter time ordered data files, one per line, ^D when done")
args.files = sys.stdin args.files = sys.stdin
for each in args.files.readlines(): for each in args.files.readlines():
fpath = each.strip() fpath = each.strip()
if not os.path.exists(fpath): if not os.path.exists(fpath):
...@@ -48,15 +49,7 @@ if __name__ == '__main__': ...@@ -48,15 +49,7 @@ if __name__ == '__main__':
continue continue
LOG.info("adding %s", fpath) LOG.info("adding %s", fpath)
for line in open(fpath).readlines(): for record in read_records(fpath):
if not line.strip():
continue
try:
record = Record.create(line)
except LineParseError as err:
LOG.error(str(err))
continue
try: try:
rrd.add_record(record['stamp'], record) rrd.add_record(record['stamp'], record)
except ModelError: except ModelError:
......
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