Code Duplication    Length = 32-33 lines in 2 locations

src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py 2 locations

@@ 1131-1163 (lines=33) @@
1128
    log.info("Profile share exported to DB!")
1129
1130
1131
def cts_heat():
1132
    """
1133
    Calculate cts electricity demand share of hvmv substation profile
1134
     for buildings.
1135
    """
1136
    log = start_logging()
1137
    log.info("Start logging!")
1138
    with db.session_scope() as session:
1139
        cells_query = session.query(CtsBuildings)
1140
1141
    df_cts_buildings = pd.read_sql(
1142
        cells_query.statement, cells_query.session.bind, index_col=None
1143
    )
1144
    log.info("CTS buildings from DB imported!")
1145
1146
    df_demand_share_2035 = calc_building_demand_profile_share(
1147
        df_cts_buildings, scenario="eGon2035", sector="heat"
1148
    )
1149
    log.info("Profile share for egon2035 calculated!")
1150
    df_demand_share_100RE = calc_building_demand_profile_share(
1151
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1152
    )
1153
    log.info("Profile share for egon100RE calculated!")
1154
    df_demand_share = pd.concat(
1155
        [df_demand_share_2035, df_demand_share_100RE],
1156
        axis=0,
1157
        ignore_index=True,
1158
    )
1159
1160
    write_table_to_postgres(
1161
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1162
    )
1163
    log.info("Profile share exported to DB!")
1164
1165
1166
def get_cts_electricity_peak_load():
@@ 1097-1128 (lines=32) @@
1094
    log.info("CTS buildings exported to DB!")
1095
1096
1097
def cts_electricity():
1098
    """
1099
    Calculate cts electricity demand share of hvmv substation profile
1100
     for buildings.
1101
    """
1102
    log = start_logging()
1103
    log.info("Start logging!")
1104
    with db.session_scope() as session:
1105
        cells_query = session.query(CtsBuildings)
1106
1107
    df_cts_buildings = pd.read_sql(
1108
        cells_query.statement, cells_query.session.bind, index_col=None
1109
    )
1110
    log.info("CTS buildings from DB imported!")
1111
    df_demand_share_2035 = calc_building_demand_profile_share(
1112
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1113
    )
1114
    log.info("Profile share for egon2035 calculated!")
1115
    df_demand_share_100RE = calc_building_demand_profile_share(
1116
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1117
    )
1118
    log.info("Profile share for egon100RE calculated!")
1119
    df_demand_share = pd.concat(
1120
        [df_demand_share_2035, df_demand_share_100RE],
1121
        axis=0,
1122
        ignore_index=True,
1123
    )
1124
1125
    write_table_to_postgres(
1126
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1127
    )
1128
    log.info("Profile share exported to DB!")
1129
1130
1131
def cts_heat():