Code Duplication    Length = 35-36 lines in 2 locations

src/egon/data/datasets/DSM_cts_ind.py 2 locations

@@ 523-558 (lines=36) @@
520
    return dsm
521
522
523
def ind_sites_vent_data_import_individual(ind_vent_share, wz):
524
    """
525
    Import industry sites necessary to identify DSM-potential.
526
        ----------
527
    ind_vent_share: float
528
        Share of considered application in industry demand
529
    wz: int
530
        Wirtschaftszweig to be considered within industry sites
531
    """
532
533
    # import load data
534
535
    sources = config.datasets()["DSM_CTS_industry"]["sources"][
536
        "ind_sites_loadcurves_individual"
537
    ]
538
539
    dsm = db.select_dataframe(
540
        f"""
541
        SELECT site_id, bus_id as bus, scn_name, p_set FROM
542
        {sources['schema']}.{sources['table']}
543
        WHERE wz = {wz}
544
        """
545
    )
546
547
    # calculate share of timeseries for ventilation
548
549
    timeseries = dsm["p_set"].copy()
550
551
    for index, liste in timeseries.items():
552
        share = [float(item) * ind_vent_share for item in liste]
553
        timeseries.loc[index] = share
554
555
    dsm["p_set"] = timeseries.copy()
556
557
    return dsm
558
559
560
def calc_ind_site_timeseries(scenario):
561
    # calculate timeseries per site
@@ 486-520 (lines=35) @@
483
    return dsm
484
485
486
def ind_sites_vent_data_import(ind_vent_share, wz):
487
    """
488
    Import industry sites necessary to identify DSM-potential.
489
        ----------
490
    ind_vent_share: float
491
        Share of considered application in industry demand
492
    wz: int
493
        Wirtschaftszweig to be considered within industry sites
494
    """
495
496
    # import load data
497
498
    sources = config.datasets()["DSM_CTS_industry"]["sources"][
499
        "ind_sites_loadcurves"
500
    ]
501
502
    dsm = db.select_dataframe(
503
        f"""
504
        SELECT bus, scn_name, p_set FROM
505
        {sources['schema']}.{sources['table']}
506
        WHERE wz = {wz}
507
        """
508
    )
509
510
    # calculate share of timeseries for ventilation
511
512
    timeseries = dsm["p_set"].copy()
513
514
    for index, liste in timeseries.items():
515
        share = [float(item) * ind_vent_share for item in liste]
516
        timeseries.loc[index] = share
517
518
    dsm["p_set"] = timeseries.copy()
519
520
    return dsm
521
522
523
def ind_sites_vent_data_import_individual(ind_vent_share, wz):