ebm.cmd.run_calculation module

area_forecast_result_to_dataframe(forecast: DataFrame) DataFrame[source]

Create a dataframe from a forecast

Parameters

forecast : Dict[str, list[float]]

Returns dataframepd.Dataframe

A dataframe of all area values in forecast indexed by building_category, tek and year


result_to_horizontal_dataframe(result: DataFrame) DataFrame[source]

Create a dataframe from a forecast with years listed horizontally start to end year

Parameters

result : pd.DataFrame:

Returns

dataframepd.Dataframe

A dataframe of all area values in forecast indexed by building_category, tek and year

validate_years(start_year: int, end_year: int) YearRange[source]

Validates the start and end year arguments and returns a YearRange

Parameters

end_yearint

The end year to validate.

start_yearint

The start year to validate.

Returns

YearRange

from start_year to end_year

Raises

ValueError

If start_year is greater than or equal to end_year. If end_year is not exactly 40 years after start_year. If start_year is not 2010 or end_year is not 2050.

calculate_building_category_energy_requirements(building_category: BuildingCategory, area_forecast, database_manager: DatabaseManager, start_year: int, end_year: int, calibration_year: int = 2019) DataFrame[source]

Calculate energy need by building_category, TEK, building_condition and purpose.

The parameter building_category is not used and should be removed.

Parameters

building_category : BuildingCategory, unused area_forecast : pd.DataFrame database_manager : DatabaseManager start_year : int end_year : int calibration_year : int, optional

Returns

pd.DataFrame

write_to_disk(constructed_floor_area, building_category: BuildingCategory)[source]

Writes constructed_floor_area to disk if the environment variable EBM_WRITE_TO_DISK is True

calculate_building_category_area_forecast(database_manager: DatabaseManager, start_year: int, end_year: int) DataFrame[source]

Calculates the area forecast for a given building category from start to end year (including).

Parameters

database_managerDatabaseManager

The database manager used to interact with the database.

start_yearint

The starting year of the forecast period.

end_yearint

The ending year of the forecast period.

Returns

pd.DataFrame
A dictionary where keys are strings representing different area categories and values are lists of floats

representing the forecasted areas for each year in the specified period.

Notes

This function builds the buildings for the specified category, calculates the area forecast, and accounts for

demolition and construction over the specified period.

calculate_heating_systems(energy_requirements, database_manager: DatabaseManager) DataFrame[source]

Calculate heating systems projection, efficiencies and multiplies by energy_requirements for total energy use by building_category, TEK, building_condition, purpose and heating_system.

Parameters

energy_requirements : pd.DataFrame database_manager : ebm.model.database_manager.DatabaseManager

Returns

pd.DataFrame