import pathlib
import typing
from loguru import logger
import pandas as pd
from ebm.model.file_handler import FileHandler
[docs]
class EnergyRequirementCalibrationWriter:
[docs]
def __init__(self):
pass
[docs]
def load(self, df: pd.DataFrame, to_file: typing.Union[str, pathlib.Path] = None):
logger.debug(f'Save {to_file}')
if to_file is None:
to_file = pathlib.Path('input') / FileHandler.CALIBRATE_ENERGY_REQUIREMENT
file_path: pathlib.Path = to_file if isinstance(to_file, pathlib.Path) else pathlib.Path(to_file)
df = df[df['group'].isin(['energy_requirements', 'energy_requirement'])]
df = df.rename(columns={'variable': 'purpose'})
df = df[['building_category', 'purpose', 'heating_rv_factor']].reset_index(drop=True)
if file_path.suffix == '.csv':
df.to_csv(file_path, index=False)
elif file_path.suffix == '.xlsx':
df.to_excel(file_path, index=False)
logger.info(f'Wrote {to_file}')
[docs]
class EnergyConsumptionCalibrationWriter:
df: pd.DataFrame
[docs]
def __init__(self):
pass
[docs]
def load(self, df: pd.DataFrame, to_file: typing.Union[str, pathlib.Path] = None):
logger.debug(f'Save {to_file}')
if to_file is None:
to_file = pathlib.Path('input/calibrate_energy_consumption.xlsx')
file_path: pathlib.Path = to_file if isinstance(to_file, pathlib.Path) else pathlib.Path(to_file)
if file_path.suffix == '.csv':
df.to_csv(file_path, index=False)
elif file_path.suffix == '.xlsx':
df.to_excel(file_path, index=False)
logger.info(f'Wrote {to_file}')
[docs]
class EbmCalibration:
energy_requirement_original_condition: pd.Series
pass
[docs]
class CalibrationReader:
[docs]
def load(self) -> None:
pass
[docs]
class CalibrationWriter:
pass