def test_csdata_lines(nepc_connect): cs_lines = 0 for directoryname in DIR_NAMES: directory = os.fsencode(directoryname) for file in os.listdir(directory): filename = os.fsdecode(file) if filename.endswith(".met") or filename.endswith(".mod"): continue else: # subtract 1 to account for header cs_lines += util.wc_fxn(directoryname + filename) - 1 assert cs_lines == nepc.count_table_rows(nepc_connect[1], "csdata")
dtype=MOD_DTYPE, na_values=NA_VALUES) mod_data.insert(0, 'rate_id', met_data.iloc[0]['rate_id']) mod_data_list = list( mod_data.itertuples(index=False, name=None)) MYCURSOR.executemany(INSERT_COMMAND_MODELS2RATE, mod_data_list) MYDB.commit() MYDB.commit() F_RATE_DAT_FILE.close() if ARGS.debug: print_timestep("loaded data into rate, ratedata, and models2rate tables") # print_table("rate") print_timestep("built " + database + " database") for table in [ "species", "processes", "states", "cs", "models", "models2cs", "csdata", "rate", "models2rate", "ratedata" ]: print(table + ": " + str(nepc.count_table_rows(MYCURSOR, table)) + " rows") #################### # Close connection # #################### MYCURSOR.close() MYDB.close()