def test_function_properly_combines_objects_in_single_region(self): pprint.pprint(self.stock_objects[0].remaining_floor_space_by_year) self.stock_objects[0].age_n_years(2) pprint.pprint(self.stock_objects[0].remaining_floor_space_by_year) code_bins = sum_bin_years(self.stock_objects) pprint.pprint(code_bins) self.assertEqual(code_bins['CA'][1990][1], 100)
# then sum and print those years. start_year = 1900 end_year = 2030 _1900_to_2030 = helper_functions.create_building_stock( start_year, end_year, copy.deepcopy(inputs.construction_history)) with open('results.csv', 'w') as f:#, newline='') as f: writer = csv.writer(f) writer.writerow(['snapshot_year', 'state', 'floor_space_vintage', 'building_type', 'code_number', 'code_title', 'subspace', 'floor_space']) for snapshot_year in range(start_year, end_year + 1): if snapshot_year > start_year: print("Aging to year {}".format(snapshot_year)) helper_functions.age_building_stock_to_year(_1900_to_2030, snapshot_year) code_bins = helper_functions.sum_bin_years(_1900_to_2030) helper_functions.print_csv_database_rows(snapshot_year, start_year, code_bins, writer) end_time = datetime.now() duration = end_time - start_time print("Duration: {}".format(duration))