def test(testfiles):
    dataset = testfiles["data10000"]
    sqlite_db = "dataset10000.db"
    h5_db = "h510000.db"

    dc = DatasetConverter(dataset, sqlite_db)
    dc.convert()

    h5conv = DatasetDB2HDF5(sqlite_db, h5_db)
    h5conv.convert()

    db = DatasetDatabase(sqlite_db)
    db.connect()

    first_datetime = dt.datetime.strptime(db.get_first_datetime(None),
                                          DATE_FORMAT)
    last_datetime = dt.datetime.strptime(db.get_last_datetime(None),
                                         DATE_FORMAT)
    delta = last_datetime - first_datetime
    pnum = delta.days * 3600 * 24 + delta.seconds + 1

    db.disconnect()

    with h5py.File(h5_db, 'r') as f:
        for name in f.keys():
            assert f[name].len() == pnum
def calc(args):
    db = DatasetDatabase(args.database_file)
    db.connect()
    first_datetime = dt.datetime.strptime(db.get_first_datetime(None), DATE_FORMAT)
    last_datetime = dt.datetime.strptime(db.get_last_datetime(None), DATE_FORMAT)
    ts_names = db.get_distinct_names()
    delta = last_datetime - first_datetime
    pnum = delta.days * 3600 * 24 + delta.seconds + 1
    total_points = pnum * len(ts_names)
    print(first_datetime.strftime("%m/%d/%Y-%H:%M:%S") + " - " + last_datetime.strftime("%m/%d/%Y-%H:%M:%S"))
    print("delta: " + str(delta))
    print("points per time series: %d" % pnum)
    print("total points in interpolated dataset: " + str(total_points))
    print("Estimated size (4 bytes per point): %f MB" % (total_points * 4.0 / 1024.0 / 1024.0))

    db.disconnect()
def calc(args):
    db = DatasetDatabase(args.database_file)
    db.connect()
    first_datetime = dt.datetime.strptime(db.get_first_datetime(None),
                                          DATE_FORMAT)
    last_datetime = dt.datetime.strptime(db.get_last_datetime(None),
                                         DATE_FORMAT)
    ts_names = db.get_distinct_names()
    delta = last_datetime - first_datetime
    pnum = delta.days * 3600 * 24 + delta.seconds + 1
    total_points = pnum * len(ts_names)
    print(
        first_datetime.strftime("%m/%d/%Y-%H:%M:%S") + " - " +
        last_datetime.strftime("%m/%d/%Y-%H:%M:%S"))
    print("delta: " + str(delta))
    print("points per time series: %d" % pnum)
    print("total points in interpolated dataset: " + str(total_points))
    print("Estimated size (4 bytes per point): %f MB" %
          (total_points * 4.0 / 1024.0 / 1024.0))

    db.disconnect()
def test(testfiles):
    dataset = testfiles["data10000"]
    sqlite_db = "dataset10000.db"
    h5_db = "h510000.db"

    dc = DatasetConverter(dataset, sqlite_db)
    dc.convert()

    h5conv = DatasetDB2HDF5(sqlite_db, h5_db)
    h5conv.convert()

    db = DatasetDatabase(sqlite_db)
    db.connect()

    first_datetime = dt.datetime.strptime(db.get_first_datetime(None), DATE_FORMAT)
    last_datetime = dt.datetime.strptime(db.get_last_datetime(None), DATE_FORMAT)
    delta = last_datetime - first_datetime
    pnum = delta.days * 3600 * 24 + delta.seconds + 1

    db.disconnect()

    with h5py.File(h5_db, 'r') as f:
        for name in f.keys():
            assert f[name].len() == pnum