示例#1
0
def complete(database: SqliteUtil):
    tables = ('nodes', 'links')
    exists = database.table_exists(*tables)
    if len(exists):
        present = ', '.join(exists)
        log.info(f'Found tables {present} already in database.')
    return len(exists) > 0
示例#2
0
def complete(database: SqliteUtil):
    done = False
    exists = database.table_exists('parcels')
    if len(exists):
        log.warning('Database already has table parcels.')
        done = True

    return done
示例#3
0
def ready(database: SqliteUtil, tmin_files: List[str], tmax_files: List[str]):
    ready = True
    for t_file in tmin_files + tmax_files:
        exists = os.path.exists(t_file)
        if not exists:
            log.warning(f'Could not open file {t_file}.')
            ready = False
    tables = ('parcels', 'links', 'nodes')
    exists = database.table_exists(*tables)
    missing = set(tables) - set(exists)
    for table in missing:
        log.warning(f'Database is missing table {table}.')
        ready = False

    return ready
示例#4
0
def ready(database: SqliteUtil, residence_file: str, commerce_file: str,
          parcel_file: str):
    ready = True
    exists = database.table_exists('regions')
    if not len(exists):
        log.warning('Database is missing table regions.')
        ready = False
    files = (residence_file, commerce_file, parcel_file)
    for f in files:
        exists = os.path.exists(f)
        if not exists:
            log.warning(f'Could not open file {f}.')
            ready = False

    return ready
示例#5
0
def complete(database: SqliteUtil):
    done = False
    exists = database.table_exists('air_temperatures')
    if len(exists):
        log.warning(f'Database already has table air_temperatures.')
        done = True
    null, nnull = null_count(database, 'links', 'air_temperature')
    if nnull > 0:
        log.warning(f'Found {nnull}/{null} links with/without air '
                    'temperature profiles.')
        done = True
    null, nnull = null_count(database, 'parcels', 'air_temperature')
    if nnull > 0:
        log.warning(f'Found {nnull}/{null} parcels with/without air '
                    'temperature profiles.')
        done = True

    return done
示例#6
0
def complete(database: SqliteUtil):
    tables = ('households', 'persons', 'trips')
    return len(database.table_exists(*tables)) == len(tables)