Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 1426-1461 (lines=36) @@
1423
    log.info("Profile share exported to DB!")
1424
1425
1426
def cts_heat():
1427
    """
1428
    Calculate cts electricity demand share of hvmv substation profile
1429
     for buildings.
1430
    """
1431
    log.info("Start logging!")
1432
    with db.session_scope() as session:
1433
        cells_query = session.query(CtsBuildings)
1434
1435
    df_cts_buildings = pd.read_sql(
1436
        cells_query.statement, cells_query.session.bind, index_col=None
1437
    )
1438
    log.info("CTS buildings from DB imported!")
1439
1440
    df_demand_share_2035 = calc_building_demand_profile_share(
1441
        df_cts_buildings, scenario="eGon2035", sector="heat"
1442
    )
1443
    log.info("Profile share for egon2035 calculated!")
1444
    df_demand_share_100RE = calc_building_demand_profile_share(
1445
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1446
    )
1447
    log.info("Profile share for egon100RE calculated!")
1448
    df_demand_share = pd.concat(
1449
        [df_demand_share_2035, df_demand_share_100RE],
1450
        axis=0,
1451
        ignore_index=True,
1452
    )
1453
1454
    df_demand_share.rename(columns={"id": "building_id"}, inplace=True)
1455
1456
    write_table_to_postgres(
1457
        df_demand_share,
1458
        EgonCtsHeatDemandBuildingShare,
1459
        drop=True,
1460
    )
1461
    log.info("Profile share exported to DB!")
1462
1463
1464
def get_cts_electricity_peak_load():
@@ 1388-1423 (lines=36) @@
1385
    log.info("CTS buildings exported to DB!")
1386
1387
1388
def cts_electricity():
1389
    """
1390
    Calculate cts electricity demand share of hvmv substation profile
1391
     for buildings.
1392
    """
1393
    log.info("Start logging!")
1394
    with db.session_scope() as session:
1395
        cells_query = session.query(CtsBuildings)
1396
1397
    df_cts_buildings = pd.read_sql(
1398
        cells_query.statement, cells_query.session.bind, index_col=None
1399
    )
1400
    log.info("CTS buildings from DB imported!")
1401
    df_demand_share_2035 = calc_building_demand_profile_share(
1402
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1403
    )
1404
    log.info("Profile share for egon2035 calculated!")
1405
1406
    df_demand_share_100RE = calc_building_demand_profile_share(
1407
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1408
    )
1409
    log.info("Profile share for egon100RE calculated!")
1410
1411
    df_demand_share = pd.concat(
1412
        [df_demand_share_2035, df_demand_share_100RE],
1413
        axis=0,
1414
        ignore_index=True,
1415
    )
1416
    df_demand_share.rename(columns={"id": "building_id"}, inplace=True)
1417
1418
    write_table_to_postgres(
1419
        df_demand_share,
1420
        EgonCtsElectricityDemandBuildingShare,
1421
        drop=True,
1422
    )
1423
    log.info("Profile share exported to DB!")
1424
1425
1426
def cts_heat():