Code Duplication    Length = 33-34 lines in 2 locations

src/egon/data/datasets/pypsaeur/__init__.py 2 locations

@@ 1657-1690 (lines=34) @@
1654
        )
1655
1656
1657
def prepared_network(planning_horizon=3):
1658
    if egon.data.config.settings()["egon-data"]["--run-pypsa-eur"]:
1659
        with open(
1660
            __path__[0] + "/datasets/pypsaeur/config_prepare.yaml", "r"
1661
        ) as stream:
1662
            data_config = yaml.safe_load(stream)
1663
1664
        target_file = (
1665
            Path(".")
1666
            / "run-pypsa-eur"
1667
            / "pypsa-eur"
1668
            / "results"
1669
            / data_config["run"]["name"]
1670
            / "prenetworks"
1671
            / f"base_s_{data_config['scenario']['clusters'][0]}"
1672
            f"_l{data_config['scenario']['ll'][0]}"
1673
            f"_{data_config['scenario']['opts'][0]}"
1674
            f"_{data_config['scenario']['sector_opts'][0]}"
1675
            f"_{data_config['scenario']['planning_horizons'][planning_horizon]}.nc"
1676
        )
1677
1678
    else:
1679
        target_file = (
1680
            Path(".")
1681
            / "data_bundle_powerd_data"
1682
            / "pypsa_eur"
1683
            / "21122024_3h_clean_run"
1684
            / "results"
1685
            / "prenetworks"
1686
            / "prenetwork_post-manipulate_pre-solve"
1687
            / "base_s_39_lc1.25__cb40ex0-T-H-I-B-solar+p3-dist1_2045.nc"
1688
        )
1689
1690
    return pypsa.Network(target_file.absolute().as_posix())
1691
1692
1693
def overwrite_H2_pipeline_share():
@@ 366-398 (lines=33) @@
363
        print("Pypsa-eur is not executed due to the settings of egon-data")
364
365
366
def read_network(planning_horizon=3):
367
    if config.settings()["egon-data"]["--run-pypsa-eur"]:
368
        with open(
369
            __path__[0] + "/datasets/pypsaeur/config_solve.yaml", "r"
370
        ) as stream:
371
            data_config = yaml.safe_load(stream)
372
373
        target_file = (
374
            Path(".")
375
            / "run-pypsa-eur"
376
            / "pypsa-eur"
377
            / "results"
378
            / data_config["run"]["name"]
379
            / "postnetworks"
380
            / f"base_s_{data_config['scenario']['clusters'][0]}"
381
            f"_l{data_config['scenario']['ll'][0]}"
382
            f"_{data_config['scenario']['opts'][0]}"
383
            f"_{data_config['scenario']['sector_opts'][0]}"
384
            f"_{data_config['scenario']['planning_horizons'][planning_horizon]}.nc"
385
        )
386
387
    else:
388
        target_file = (
389
            Path(".")
390
            / "data_bundle_powerd_data"
391
            / "pypsa_eur"
392
            / "21122024_3h_clean_run"
393
            / "results"
394
            / "postnetworks"
395
            / "base_s_39_lc1.25__cb40ex0-T-H-I-B-solar+p3-dist1_2045.nc"
396
        )
397
398
    return pypsa.Network(target_file)
399
400
401
def clean_database():