Code Duplication    Length = 31-32 lines in 2 locations

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

@@ 1276-1307 (lines=32) @@
1273
    log.info("Profile share exported to DB!")
1274
1275
1276
def cts_heat():
1277
    """
1278
    Calculate cts electricity demand share of hvmv substation profile
1279
     for buildings.
1280
    """
1281
    log.info("Start logging!")
1282
    with db.session_scope() as session:
1283
        cells_query = session.query(CtsBuildings)
1284
1285
    df_cts_buildings = pd.read_sql(
1286
        cells_query.statement, cells_query.session.bind, index_col=None
1287
    )
1288
    log.info("CTS buildings from DB imported!")
1289
1290
    df_demand_share_2035 = calc_building_demand_profile_share(
1291
        df_cts_buildings, scenario="eGon2035", sector="heat"
1292
    )
1293
    log.info("Profile share for egon2035 calculated!")
1294
    df_demand_share_100RE = calc_building_demand_profile_share(
1295
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1296
    )
1297
    log.info("Profile share for egon100RE calculated!")
1298
    df_demand_share = pd.concat(
1299
        [df_demand_share_2035, df_demand_share_100RE],
1300
        axis=0,
1301
        ignore_index=True,
1302
    )
1303
1304
    write_table_to_postgres(
1305
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1306
    )
1307
    log.info("Profile share exported to DB!")
1308
1309
1310
def get_cts_electricity_peak_load():
@@ 1243-1273 (lines=31) @@
1240
    log.info("CTS buildings exported to DB!")
1241
1242
1243
def cts_electricity():
1244
    """
1245
    Calculate cts electricity demand share of hvmv substation profile
1246
     for buildings.
1247
    """
1248
    log.info("Start logging!")
1249
    with db.session_scope() as session:
1250
        cells_query = session.query(CtsBuildings)
1251
1252
    df_cts_buildings = pd.read_sql(
1253
        cells_query.statement, cells_query.session.bind, index_col=None
1254
    )
1255
    log.info("CTS buildings from DB imported!")
1256
    df_demand_share_2035 = calc_building_demand_profile_share(
1257
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1258
    )
1259
    log.info("Profile share for egon2035 calculated!")
1260
    df_demand_share_100RE = calc_building_demand_profile_share(
1261
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1262
    )
1263
    log.info("Profile share for egon100RE calculated!")
1264
    df_demand_share = pd.concat(
1265
        [df_demand_share_2035, df_demand_share_100RE],
1266
        axis=0,
1267
        ignore_index=True,
1268
    )
1269
1270
    write_table_to_postgres(
1271
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1272
    )
1273
    log.info("Profile share exported to DB!")
1274
1275
1276
def cts_heat():