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