Code Duplication    Length = 35-36 lines in 2 locations

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

@@ 571-606 (lines=36) @@
568
    return dsm
569
570
571
def ind_sites_vent_data_import_individual(ind_vent_share, wz):
572
    """
573
    Import industry sites necessary to identify DSM-potential.
574
575
    Parameters
576
    ----------
577
    ind_vent_share: float
578
        Share of considered application in industry demand
579
    wz: int
580
        Wirtschaftszweig to be considered within industry sites
581
    """
582
583
    # import load data
584
585
    sources = config.datasets()["DSM_CTS_industry"]["sources"][
586
        "ind_sites_loadcurves_individual"
587
    ]
588
589
    dsm = db.select_dataframe(
590
        f"""
591
        SELECT site_id, bus_id as bus, scn_name, p_set FROM
592
        {sources['schema']}.{sources['table']}
593
        WHERE wz = {wz}
594
        """
595
    )
596
597
    # calculate share of timeseries for ventilation
598
599
    timeseries = dsm["p_set"].copy()
600
601
    for index, liste in timeseries.items():
602
        share = [float(item) * ind_vent_share for item in liste]
603
        timeseries.loc[index] = share
604
605
    dsm["p_set"] = timeseries.copy()
606
607
    return dsm
608
609
@@ 532-566 (lines=35) @@
529
    return dsm
530
531
532
def ind_sites_vent_data_import(ind_vent_share, wz):
533
    """
534
    Import industry sites necessary to identify DSM-potential.
535
536
    Parameters
537
    ----------
538
    ind_vent_share: float
539
        Share of considered application in industry demand
540
    wz: int
541
        Wirtschaftszweig to be considered within industry sites
542
    """
543
544
    # import load data
545
546
    sources = config.datasets()["DSM_CTS_industry"]["sources"][
547
        "ind_sites_loadcurves"
548
    ]
549
550
    dsm = db.select_dataframe(
551
        f"""
552
        SELECT bus, scn_name, p_set FROM
553
        {sources['schema']}.{sources['table']}
554
        WHERE wz = {wz}
555
        """
556
    )
557
558
    # calculate share of timeseries for ventilation
559
560
    timeseries = dsm["p_set"].copy()
561
562
    for index, liste in timeseries.items():
563
        share = [float(item) * ind_vent_share for item in liste]
564
        timeseries.loc[index] = share
565
566
    dsm["p_set"] = timeseries.copy()
567
568
    return dsm
569