def summarize_csv(specs): first_run = True general_csv = output_handle('summary') rh_csv = output_handle('rh-thresholds') check_csv = output_handle('checking') rh_by_runtime_csv = output_handle('daily-rh-runtime') for desc, scenario_path in specs: name = desc[-1] if exists(scenario_path): print("loading {0} from {1}".format(name, scenario_path)) hourly = hourly_data(scenario_path) print("summarizing {0}".format(name)) output_row(desc, summarize_run, hourly, general_csv, first_run) output_row(desc, rh_stats, hourly, rh_csv, first_run) output_row(desc, check_loads, hourly, check_csv, first_run) output_row(desc, rh_by_runtime, hourly, rh_by_runtime_csv, first_run) for k in ['SOLN', 'SOLE', 'SOLS', 'SOLW', 'QWALLS', 'QCEIL', 'QFLR', ]: if not hasattr(hourly, k): print("missing {0}".format(k)) first_run = False # flag, never becomes true again in this call if graphs: print("graphing {0}".format(name)) plot_TRH(hourly, name) plot_humidity_ratio(hourly, name) #plot_Wrt(name, hourly) plot_rh_hist_daily(hourly, name) #plot_t_hist(name, hourly) plot_daily_psychrometric(hourly, name) ac_bal_point(hourly, name) else: # scenario path does not exist print( "skipping {0}: path {1} does not exist".format(name, scenario_path))
def dir_to_json(path): h = hourly_data(path).__dict__ for key in h.keys(): if key == "name": continue handle = open(join(path, "{0}-{1}.json".format(basename(path), key)), "w") handle.write("[ ") handle.write(", ".join(map(float_to_str, h[key].tolist()))) handle.write("]\n") handle.close()
from pandas import * from parametrics import hourly_data import os from os.path import join, isdir from numpy import arange DIR = '/home/bergey/Library/rp-1449-results/' dates = arange(1,8761) for system in os.listdir(DIR): store = HDFStore('{0}.h5'.format(system)) n = len(os.listdir(join(DIR,system)))-1 i = 0 print("entering directory {0}".format(system)) for sim in os.listdir(join(DIR,system)): if not isdir(join(DIR,system, sim)): continue i += 1 print("{0}/{1}: {2}".format(i,n,sim)) h = hourly_data(join(DIR,system,sim)) df = DataFrame(h.__dict__, index=dates) store[sim] = df