From 228c283fc17fac24071ccca8533fc297e387efdc Mon Sep 17 00:00:00 2001 From: Bruce Flynn <brucef@ssec.wisc.edu> Date: Thu, 31 Jul 2014 19:51:01 +0000 Subject: [PATCH] Fix script for new model code --- scripts/make_database.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/make_database.py b/scripts/make_database.py index 51269da..1fd6120 100755 --- a/scripts/make_database.py +++ b/scripts/make_database.py @@ -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,15 +49,7 @@ 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: -- GitLab