Code Duplication    Length = 32-33 lines in 2 locations

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

@@ 1182-1214 (lines=33) @@
1179
    log.info("Profile share exported to DB!")
1180
1181
1182
def cts_heat():
1183
    """
1184
    Calculate cts electricity demand share of hvmv substation profile
1185
     for buildings.
1186
    """
1187
    log = start_logging()
1188
    log.info("Start logging!")
1189
    with db.session_scope() as session:
1190
        cells_query = session.query(CtsBuildings)
1191
1192
    df_cts_buildings = pd.read_sql(
1193
        cells_query.statement, cells_query.session.bind, index_col=None
1194
    )
1195
    log.info("CTS buildings from DB imported!")
1196
1197
    df_demand_share_2035 = calc_building_demand_profile_share(
1198
        df_cts_buildings, scenario="eGon2035", sector="heat"
1199
    )
1200
    log.info("Profile share for egon2035 calculated!")
1201
    df_demand_share_100RE = calc_building_demand_profile_share(
1202
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1203
    )
1204
    log.info("Profile share for egon100RE calculated!")
1205
    df_demand_share = pd.concat(
1206
        [df_demand_share_2035, df_demand_share_100RE],
1207
        axis=0,
1208
        ignore_index=True,
1209
    )
1210
1211
    write_table_to_postgres(
1212
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1213
    )
1214
    log.info("Profile share exported to DB!")
1215
1216
1217
def get_cts_electricity_peak_load():
@@ 1148-1179 (lines=32) @@
1145
    return df_cts_buildings
1146
1147
1148
def cts_electricity():
1149
    """
1150
    Calculate cts electricity demand share of hvmv substation profile
1151
     for buildings.
1152
    """
1153
    log = start_logging()
1154
    log.info("Start logging!")
1155
    with db.session_scope() as session:
1156
        cells_query = session.query(CtsBuildings)
1157
1158
    df_cts_buildings = pd.read_sql(
1159
        cells_query.statement, cells_query.session.bind, index_col=None
1160
    )
1161
    log.info("CTS buildings from DB imported!")
1162
    df_demand_share_2035 = calc_building_demand_profile_share(
1163
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1164
    )
1165
    log.info("Profile share for egon2035 calculated!")
1166
    df_demand_share_100RE = calc_building_demand_profile_share(
1167
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1168
    )
1169
    log.info("Profile share for egon100RE calculated!")
1170
    df_demand_share = pd.concat(
1171
        [df_demand_share_2035, df_demand_share_100RE],
1172
        axis=0,
1173
        ignore_index=True,
1174
    )
1175
1176
    write_table_to_postgres(
1177
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1178
    )
1179
    log.info("Profile share exported to DB!")
1180
1181
1182
def cts_heat():