Fix EP results writing
This commit is contained in:
parent
e21b9b63f4
commit
3f1bab01c8
|
@ -80,8 +80,9 @@ class EnergyValidation:
|
|||
demand *= 0.001/building_area
|
||||
|
||||
# replace indexes with month/day/year format
|
||||
months = {'month':
|
||||
['1/1/2023',
|
||||
months = {
|
||||
'month': [
|
||||
'1/1/2023',
|
||||
'2/1/2023',
|
||||
'3/1/2023',
|
||||
'4/1/2023',
|
||||
|
@ -93,8 +94,8 @@ class EnergyValidation:
|
|||
'10/1/2023',
|
||||
'11/1/2023',
|
||||
'12/1/2023'
|
||||
]
|
||||
}
|
||||
]}
|
||||
|
||||
demand.iloc[:, 0] = pd.DataFrame(months)
|
||||
|
||||
# insert building_name to first column
|
||||
|
@ -122,8 +123,7 @@ class EnergyValidation:
|
|||
TODO: number_of_adjacent_walls
|
||||
'''
|
||||
formatted_metadata = pd.DataFrame({
|
||||
'metadata':
|
||||
[
|
||||
'metadata': [
|
||||
metadata.iloc[0, 0].split(': ')[1],
|
||||
metadata.iloc[4, 0].split(': ')[1],
|
||||
metadata.iloc[3, 0].split(': ')[1],
|
||||
|
@ -184,9 +184,9 @@ class EnergyValidation:
|
|||
demand['source'] = 'ep'
|
||||
|
||||
# drop unneeded columns
|
||||
demand.drop(4)
|
||||
demand.drop(5)
|
||||
demand.drop(6)
|
||||
demand.drop(demand.columns[3], axis=1, inplace=True)
|
||||
demand.drop(demand.columns[3], axis=1, inplace=True)
|
||||
demand.drop(demand.columns[3], axis=1, inplace=True)
|
||||
|
||||
# last, but not least, append our lovely reformatted data to the results spreadsheet
|
||||
with pd.ExcelWriter(self.result_file, engine='openpyxl', if_sheet_exists='overlay', mode='a') as writer:
|
||||
|
@ -307,19 +307,17 @@ class EnergyValidation:
|
|||
'NA',
|
||||
'NA',
|
||||
'NA',
|
||||
'NA'
|
||||
]).transpose()
|
||||
print(building_with_error)
|
||||
|
||||
# with pd.ExcelWriter(self.result_file, engine='openpyxl', if_sheet_exists='overlay',
|
||||
# mode='a') as writer:
|
||||
# building_with_error.to_excel(
|
||||
# writer,
|
||||
# startrow=writer.sheets['Simulation data'].max_row,
|
||||
# sheet_name='Simulation data',
|
||||
# index=False,
|
||||
# header=False,
|
||||
# )
|
||||
with pd.ExcelWriter(self.result_file, engine='openpyxl', if_sheet_exists='overlay',
|
||||
mode='a') as writer:
|
||||
building_with_error.to_excel(
|
||||
writer,
|
||||
startrow=writer.sheets['Simulation data'].max_row,
|
||||
sheet_name='Simulation data',
|
||||
index=False,
|
||||
header=False,
|
||||
)
|
||||
|
||||
if cleanup is True:
|
||||
[os.remove(os.path.join(self.tmp_folder, file)) for file in os.listdir(self.tmp_folder)]
|
2
main.py
2
main.py
|
@ -16,4 +16,4 @@ test_batch = {
|
|||
|
||||
validate_meb_ep = EnergyValidation()
|
||||
# if cleanup is True, removes all files in tmp directory
|
||||
validate_meb_ep.run(building_set=buildings, building_quantities=test_batch, cleanup=True)
|
||||
validate_meb_ep.run(building_set=buildings, building_quantities=test_batch, cleanup=False)
|
||||
|
|
Loading…
Reference in New Issue
Block a user