#Change extension from .txt to .py def main(): # Code must be wrapped in this def for multicore support in Windows import thermostat; thermostat.get_version() #Check install version and import import sys import os import warnings from os.path import expanduser from thermostat.importers import from_csv from thermostat.exporters import metrics_to_csv from thermostat.stats import compute_summary_statistics from thermostat.stats import summary_statistics_to_csv from thermostat.multiple import multiple_thermostat_calculate_epa_field_savings_metrics #Optional Logging for Import Weather data, etc # import logging # logger = logging.getLogger() # logger.setLevel(logging.DEBUG) #Set location data_dir = "C:/Users/33531/Desktop/Python27/TestMulticore" metadata_filename = os.path.join(data_dir, "testdata/metadata.csv") thermostats = from_csv(metadata_filename, verbose=True) metrics = [] #MULTICORE SUPPORT FUNCTION CALL metrics = multiple_thermostat_calculate_epa_field_savings_metrics(thermostats) # OLD QUICKSTART ROUTINE # # saved_thermostats = [] # for thermostat in thermostats: # outputs = thermostat.calculate_epa_field_savings_metrics() # metrics.extend(outputs) # # saved_thermostats.append(thermostat) output_filename = os.path.join(data_dir, "thermostat_example_output.csv") metrics_df = metrics_to_csv(metrics, output_filename) # uses the metrics_df created in the Quickstart above. with warnings.catch_warnings(): warnings.simplefilter("ignore") # uses the metrics_df created in the quickstart above. stats = compute_summary_statistics(metrics_df) # If you want to have advanced filter outputs, use this instead # stats_advanced = compute_summary_statistics(metrics_df, advanced_filtering=True) product_id = "INSERT ALPHANUMERIC PRODUCT ID HERE" stats_filepath = os.path.join(data_dir, "thermostat_example_stats.csv") stats_df = summary_statistics_to_csv(stats, stats_filepath, product_id) # or with advanced filter outputs # stats_advanced_filepath = os.path.join(data_dir, "thermostat_example_stats_advanced.csv") # stats_advanced_df = summary_statistics_to_csv(stats_advanced, stats_advanced_filepath, product_id) #Needed for Multicore support in Windows if __name__ == "__main__": main()