ebm.model.construction module
- calculate_construction(building_category: BuildingCategory, demolition_floor_area: Series | list, database_manager: DatabaseManager, period: YearRange) DataFrame[source]
Calculate constructed floor area for buildings based using provided demolition_floor_area and input data from database_manager.
Parameters.
building_category: BuildingCategory demolition_floor_area: pd.Series expects index=2010..2050 database_manager: DatabaseManager period : YearRange
Raises
This function always raises NotImplementedError.
Returns
- calculated_construction: pd.DataFrame
dataframe columns include; (building_growth) (demolished_floor_area) (constructed_floor_area) (accumulated_constructed_floor_area) (total_floor_area) (floor_area_over_population_growth) (households) (household_size) (population) (population_growth)
- calculate_constructed_floor_area(constructed_floor_area: Series, total_floor_area: Series, period: YearRange) Series[source]
Calculate the constructed floor area over a specified period.
Parameters
- constructed_floor_areapd.Series
A pandas Series to store the constructed floor area for each previous year.
- total_floor_areapd.Series
A pandas Series containing the total floor area for each year.
- periodYearRange
An object containing the start year, end year, and the range of years.
Returns
- pd.Series
A pandas Series containing the constructed floor area for each year in the period.
Notes
The constructed floor area is calculated from year 6 onwards by subtracting the previous year’s floor area from the current year’s floor area and adding the previous year’s demolition floor area.
- calculate_floor_area_growth(total_floor_area: Series, period: YearRange) Series[source]
Calculate the growth of floor area over a specified period.
Parameters
- total_floor_areapd.Series
A pandas Series containing the total floor area for each year.
- periodYearRange
An object containing the start year, end year, and the range of years.
Returns
- pd.Series
A pandas Series containing the floor area growth for each year in the period.
Notes
The growth for the first year in the period is set to NaN. The growth for the next four years is calculated based on the change in total floor area from the previous year.
Examples
>>> total_floor_area = pd.Series({2020: 1000, 2021: 1100, 2022: 1210, 2023: 1331, 2024: 1464}) >>> period = YearRange(2020, 2024) >>> calculate_floor_area_growth(total_floor_area, period) 2020 NaN 2021 0.1000 2022 0.1000 2023 0.1000 2024 0.1000 dtype: float64
- calculate_floor_area_over_building_growth(building_growth: Series, population_growth: Series, years: YearRange) Series[source]
Calculate the floor area over building growth for a given range of years.
Parameters
- building_growthpd.Series
A pandas Series representing the building growth over the years.
- population_growthpd.Series
A pandas Series representing the population growth over the years.
- yearsYearRange
An object representing the range of years for the calculation.
Returns
- pd.Series
A pandas Series representing the floor area over building growth for each year in the specified range.
Notes
The first year in the range is initialized with NaN.
For the first 4 years, the floor area over building growth is calculated directly from the building and population growth.
For the next 5 years, the mean floor area over building growth is used.
From the 11th year onwards, the value is set to 1.
For the years between the 11th and 21st, the value is interpolated linearly.
Examples
>>> building_growth = pd.Series([1.2, 1.3, 1.4, 1.5, 1.6], index=[2010, 2011, 2012, 2013, 2014]) >>> pd.Series([1.1, 1.2, 1.3, 1.4, 1.5], index=[2010, 2011, 2012, 2013, 2014]) >>> years = YearRange(start=2010, end=2050) >>> calculate_floor_area_over_building_growth(building_growth, population_growth, years) 2010 NaN 2011 1.083333 2012 1.076923 2013 1.071429 2014 1.066667 2015 1.074588 2016 1.074588 … 2050 1.000000 2051 1.000000 dtype: float64
- calculate_population_growth(population: Series) Series[source]
Calculate the annual growth in building categories based on household changes.
Parameters
- populationpd.Series
A pandas Series representing the population indexed by year.
Returns
- pd.Series
A pandas Series representing the annual growth population.
- calculate_total_floor_area(floor_area_over_population_growth: Series, population_growth: Series, total_floor_area: Series, period: YearRange) Series[source]
Calculate the total floor area over a given period based on population growth.
Parameters
- floor_area_over_population_growthpd.Series
A pandas Series containing the floor area change over population growth for each year.
- population_growthpd.Series
A pandas Series containing the population growth for each year.
- total_floor_areapd.Series
A pandas Series containing the total floor area for each year.
- periodYearRange
A named tuple containing the start and end years of the period.
Returns
- pd.Series
Updated pandas Series with the total floor area for each year in the given period.
Notes
The calculation starts from period.start + 5 to period.end. For each year, the total floor area is updated based on the formula:
total_floor_area[year] = ((change_ratio * pop_growth) + 1) * previous_floor_area