Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 1365-1400 (lines=36) @@
1362
    log.info("Profile share exported to DB!")
1363
1364
1365
def cts_heat():
1366
    """
1367
    Calculate cts electricity demand share of hvmv substation profile
1368
     for buildings.
1369
    """
1370
    log.info("Start logging!")
1371
    with db.session_scope() as session:
1372
        cells_query = session.query(CtsBuildings)
1373
1374
    df_cts_buildings = pd.read_sql(
1375
        cells_query.statement, cells_query.session.bind, index_col=None
1376
    )
1377
    log.info("CTS buildings from DB imported!")
1378
1379
    df_demand_share_2035 = calc_building_demand_profile_share(
1380
        df_cts_buildings, scenario="eGon2035", sector="heat"
1381
    )
1382
    log.info("Profile share for egon2035 calculated!")
1383
    df_demand_share_100RE = calc_building_demand_profile_share(
1384
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1385
    )
1386
    log.info("Profile share for egon100RE calculated!")
1387
    df_demand_share = pd.concat(
1388
        [df_demand_share_2035, df_demand_share_100RE],
1389
        axis=0,
1390
        ignore_index=True,
1391
    )
1392
1393
    df_demand_share.rename(columns={"id": "building_id"}, inplace=True)
1394
1395
    write_table_to_postgres(
1396
        df_demand_share,
1397
        EgonCtsHeatDemandBuildingShare,
1398
        drop=True,
1399
    )
1400
    log.info("Profile share exported to DB!")
1401
1402
1403
def get_cts_electricity_peak_load():
@@ 1327-1362 (lines=36) @@
1324
    log.info("CTS buildings exported to DB!")
1325
1326
1327
def cts_electricity():
1328
    """
1329
    Calculate cts electricity demand share of hvmv substation profile
1330
     for buildings.
1331
    """
1332
    log.info("Start logging!")
1333
    with db.session_scope() as session:
1334
        cells_query = session.query(CtsBuildings)
1335
1336
    df_cts_buildings = pd.read_sql(
1337
        cells_query.statement, cells_query.session.bind, index_col=None
1338
    )
1339
    log.info("CTS buildings from DB imported!")
1340
    df_demand_share_2035 = calc_building_demand_profile_share(
1341
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1342
    )
1343
    log.info("Profile share for egon2035 calculated!")
1344
1345
    df_demand_share_100RE = calc_building_demand_profile_share(
1346
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1347
    )
1348
    log.info("Profile share for egon100RE calculated!")
1349
1350
    df_demand_share = pd.concat(
1351
        [df_demand_share_2035, df_demand_share_100RE],
1352
        axis=0,
1353
        ignore_index=True,
1354
    )
1355
    df_demand_share.rename(columns={"id": "building_id"}, inplace=True)
1356
1357
    write_table_to_postgres(
1358
        df_demand_share,
1359
        EgonCtsElectricityDemandBuildingShare,
1360
        drop=True,
1361
    )
1362
    log.info("Profile share exported to DB!")
1363
1364
1365
def cts_heat():