ebm.s_curve module

original_condition(s_curve_cumulative_demolition, s_curve_renovation, s_curve_renovation_and_small_measure, s_curve_small_measure)[source]

Calculates buildings remaining as original condition by subtracting every other condition

Parameters

s_curve_cumulative_demolition : pandas.Series s_curve_renovation : pandas.Series s_curve_renovation_and_small_measure : pandas.Series s_curve_small_measure : pandas.Series

Returns

pandas.Series

buildings remaining as original condition

small_measure(s_curve_renovation_and_small_measure: Series, s_curve_small_measure_total: Series) Series[source]

Calculates the remaining small measure share by subtracting renovation and small measure values from the total small measure curve.

Parameters

s_curve_renovation_and_small_measure : Series s_curve_small_measure_total : Series

Returns

Series

s_curve_small_measure

Notes

  • This function currently does not implement logic to zero out values before the building year.

  • Assumes both input Series are aligned on the index year.

renovation_and_small_measure(s_curve_renovation: Series, s_curve_renovation_total: Series) Series[source]

Calculates the remaining renovation_and_small_measure share by subtracting renovation from the total renovation total curve.

Parameters

s_curve_renovationpandas.Series

A time series representing the S-curve of exclusive renovation condition.

s_curve_renovation_totalpandas.Series

A time series representing the total S-curve for the total renovation condition.

Returns

pandas.Series

A time series representing the difference between the total and renovation-only S-curves. Values before the building year should be set to 0 (not yet implemented).

Notes

  • This function currently does not implement logic to zero out values before the building year.

  • Assumes both input Series are aligned on index year.

trim_renovation_from_renovation_total(s_curve_renovation: Series, s_curve_renovation_max: Series, s_curve_renovation_total: Series, scurve_total: Series) Series[source]

Adjust the renovation S-curve by incorporating values from the total renovation curve where the total share is less than the maximum renovation share.

This function identifies time points where the total S-curve (scurve_total) is less than the maximum renovation S-curve (s_curve_renovation_max). For those points, it replaces the corresponding values in s_curve_renovation with values from s_curve_renovation_total.

Parameters

s_curve_renovationpandas.Series

The original renovation S-curve to be adjusted.

s_curve_renovation_maxpandas.Series

The maximum allowed values for the renovation S-curve.

s_curve_renovation_totalpandas.Series

The total renovation S-curve including all measures.

scurve_totalpandas.Series

The actual total S-curve values to compare against the max renovation curve.

Returns

pandas.Series

The adjusted renovation S-curve with values merged from the total renovation curve where the total share is less than the maximum renovation share.

Notes

  • Assumes all input Series are aligned on the index year.

renovation_from_small_measure(s_curve_renovation_max: Series, s_curve_small_measure_total: Series) Series[source]

Calculate the renovation S-curve by subtracting small measures from the max renovation curve.

Parameters

s_curve_renovation_maxpandas.Series

The maximum yearly values for the renovation S-curve.

s_curve_small_measure_totalpandas.Series

The yearly total S-curve for small measures.

Returns

pandas.Series

The resulting renovation S-curve with values clipped at 0

total(s_curve_renovation_total: Series, s_curve_small_measure_total: Series) Series[source]

Calculates the yearly sum of renovation and small_measure

Parameters

s_curve_renovation_total : pandas.Series s_curve_small_measure_total : pandas.Series

Returns

pandas.Series

yearly sum of renovation and small_measure

trim_max_value(s_curve_cumulative_small_measure: Series, s_curve_small_measure_max: Series) Series[source]
small_measure_max(s_curve_cumulative_demolition: Series, s_curve_small_measure_never_share: Series)[source]

Calculates the maximum possible value for small_measure condition

Parameters

s_curve_cumulative_demolition : pandas.Series s_curve_small_measure_never_share : pandas.Series

Returns

pandas.Series

Yearly maximum possible value for small_measure

renovation_max(s_curve_cumulative_demolition: Series, s_curve_renovation_never_share: Series)[source]

Calculates the maximum possible value for renovation condition

Parameters

s_curve_cumulative_demolition : pandas.Series s_curve_renovation_never_share : pandas.Series

Returns

pandas.Series

Yearly maximum possible value for renovation

cumulative_renovation(s_curves_with_building_code: Series, years: YearRange) Series[source]

Return the yearly cumulative sum of renovation condition.

Parameters

s_curves_with_building_code : pandas.Series years : pandas.Series

Returns

pandas.Series

cumulative sum of renovation

Notes

NaN values are replaced by float 0.0

cumulative_small_measure(s_curves_with_building_code: Series, years: YearRange) Series[source]

Return the yearly cumulative sum of small_measure condition.

Parameters

s_curves_with_building_code : pandas.Series years : YearRange

Returns

pandas.Series

cumulative sum of small_measure

Notes

NaN values are replaced by float 0.0

transform_demolition(demolition: Series, years: YearRange) Series[source]

Filter yearly demolition for years Parameters ———- demolition : pandas.Series years : YearRange

Returns

demolition for years

transform_to_cumulative_demolition(cumulative_demolition: DataFrame, years: YearRange) Series[source]

Filter yearly cumulative demolition for years Parameters ———- cumulative_demolition : pandas.DataFrame years : YearRange

Returns

pandas.Series

cumulative demolition for years

scurve_parameters_to_never_share(s_curves: DataFrame, scurve_parameters: DataFrame) DataFrame[source]

Transform scurve_parameters with s_curve to never_share. Parameters ———- s_curves : pandas.DataFrame scurve_parameters : pandas.DataFrame

Returns

pandas.DataFrame

Notes

Age is padded from -max age to 0

scurve_parameters_to_scurve(scurve_parameters: DataFrame) Series[source]
Create scurve new dataframe from scurve_parameters using ebm.model.area.building_condition_scurves and

ebm.model.area.building_condition_accumulated_scurves

Each row represent a building_category and building_condition at a certain age.

Parameters

scurve_parameters : pandas.DataFrame

Returns

pandas.Series

accumulate_demolition(s_curves_long: DataFrame, years: YearRange) DataFrame[source]

Sets demolition in year 0 (2020) to 0.0 and sums up the yearly demolition using years

Parameters

s_curves_long : pandas.DataFrame years : YearRange

Returns

pandas.DataFrame

merge_s_curves_and_building_code(s_curves: DataFrame, df_never_share: DataFrame, building_code_parameters: DataFrame) DataFrame[source]

Cross merge s_curves and df_never_share with all building_code in building_code_parameters

Parameters

s_curves : pandas.DataFrame df_never_share : pandas.DataFrame building_code_parameters : pandas.DataFrame

Returns

pandas.DataFrame

transform_to_dataframe(s_curve_cumulative_demolition: Series, s_curve_original_condition: Series, s_curve_renovation: Series, s_curve_renovation_and_small_measure: Series, s_curve_small_measure: Series, s_curve_demolition: Series) DataFrame[source]

Creates a pandas DataFrame from the parameters

Parameters

s_curve_cumulative_demolition : pandas.Series s_curve_original_condition : pandas.Series s_curve_renovation : pandas.Series s_curve_renovation_and_small_measure : pandas.Series s_curve_small_measure : pandas.Series s_curve_demolition : pandas.Series

Returns

pandas.DataFrame

transform_to_long(s_curves_by_condition: DataFrame) DataFrame[source]

Parameters

s_curves_by_condition : pandas.DataFrame

Returns

pandas.DataFrame

transformed to long, on condition for each row

calculate_s_curves(scurve_parameters, building_code_parameters, years, **kwargs)[source]