Code Duplication    Length = 31-32 lines in 2 locations

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

@@ 1326-1357 (lines=32) @@
1323
    log.info("Profile share exported to DB!")
1324
1325
1326
def cts_heat():
1327
    """
1328
    Calculate cts electricity demand share of hvmv substation profile
1329
     for buildings.
1330
    """
1331
    log.info("Start logging!")
1332
    with db.session_scope() as session:
1333
        cells_query = session.query(CtsBuildings)
1334
1335
    df_cts_buildings = pd.read_sql(
1336
        cells_query.statement, cells_query.session.bind, index_col=None
1337
    )
1338
    log.info("CTS buildings from DB imported!")
1339
1340
    df_demand_share_2035 = calc_building_demand_profile_share(
1341
        df_cts_buildings, scenario="eGon2035", sector="heat"
1342
    )
1343
    log.info("Profile share for egon2035 calculated!")
1344
    df_demand_share_100RE = calc_building_demand_profile_share(
1345
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1346
    )
1347
    log.info("Profile share for egon100RE calculated!")
1348
    df_demand_share = pd.concat(
1349
        [df_demand_share_2035, df_demand_share_100RE],
1350
        axis=0,
1351
        ignore_index=True,
1352
    )
1353
1354
    write_table_to_postgres(
1355
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1356
    )
1357
    log.info("Profile share exported to DB!")
1358
1359
1360
def get_cts_electricity_peak_load():
@@ 1293-1323 (lines=31) @@
1290
    log.info("CTS buildings exported to DB!")
1291
1292
1293
def cts_electricity():
1294
    """
1295
    Calculate cts electricity demand share of hvmv substation profile
1296
     for buildings.
1297
    """
1298
    log.info("Start logging!")
1299
    with db.session_scope() as session:
1300
        cells_query = session.query(CtsBuildings)
1301
1302
    df_cts_buildings = pd.read_sql(
1303
        cells_query.statement, cells_query.session.bind, index_col=None
1304
    )
1305
    log.info("CTS buildings from DB imported!")
1306
    df_demand_share_2035 = calc_building_demand_profile_share(
1307
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1308
    )
1309
    log.info("Profile share for egon2035 calculated!")
1310
    df_demand_share_100RE = calc_building_demand_profile_share(
1311
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1312
    )
1313
    log.info("Profile share for egon100RE calculated!")
1314
    df_demand_share = pd.concat(
1315
        [df_demand_share_2035, df_demand_share_100RE],
1316
        axis=0,
1317
        ignore_index=True,
1318
    )
1319
1320
    write_table_to_postgres(
1321
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1322
    )
1323
    log.info("Profile share exported to DB!")
1324
1325
1326
def cts_heat():