| @@ 461-491 (lines=31) @@ | ||
| 458 | print("Pypsa-eur is not executed due to the settings of egon-data") |
|
| 459 | ||
| 460 | ||
| 461 | def read_network(planning_horizon=2045): |
|
| 462 | if config.settings()["egon-data"]["--run-pypsa-eur"]: |
|
| 463 | with open( |
|
| 464 | __path__[0] + "/datasets/pypsaeur/config_solve.yaml", "r" |
|
| 465 | ) as stream: |
|
| 466 | data_config = yaml.safe_load(stream) |
|
| 467 | ||
| 468 | target_file = ( |
|
| 469 | Path(".") |
|
| 470 | / "run-pypsa-eur" |
|
| 471 | / "pypsa-eur" |
|
| 472 | / "results" |
|
| 473 | / data_config["run"]["name"] |
|
| 474 | / "postnetworks" |
|
| 475 | / f"base_s_{data_config['scenario']['clusters'][0]}" |
|
| 476 | f"_l{data_config['scenario']['ll'][0]}" |
|
| 477 | f"_{data_config['scenario']['opts'][0]}" |
|
| 478 | f"_{data_config['scenario']['sector_opts'][0]}" |
|
| 479 | f"_{planning_horizon}.nc" |
|
| 480 | ) |
|
| 481 | ||
| 482 | else: |
|
| 483 | target_file = ( |
|
| 484 | Path(".") |
|
| 485 | / "data_bundle_egon_data" |
|
| 486 | / "pypsa_eur" |
|
| 487 | / "postnetworks" |
|
| 488 | / f"base_s_39_lc1.25__cb40ex0-T-H-I-B-solar+p3-dist1_{planning_horizon}.nc" |
|
| 489 | ) |
|
| 490 | ||
| 491 | return pypsa.Network(target_file) |
|
| 492 | ||
| 493 | ||
| 494 | def clean_database(): |
|
| @@ 1744-1775 (lines=32) @@ | ||
| 1741 | ) |
|
| 1742 | ||
| 1743 | ||
| 1744 | def prepared_network(planning_horizon=3): |
|
| 1745 | if egon.data.config.settings()["egon-data"]["--run-pypsa-eur"]: |
|
| 1746 | with open( |
|
| 1747 | __path__[0] + "/datasets/pypsaeur/config_prepare.yaml", "r" |
|
| 1748 | ) as stream: |
|
| 1749 | data_config = yaml.safe_load(stream) |
|
| 1750 | ||
| 1751 | target_file = ( |
|
| 1752 | Path(".") |
|
| 1753 | / "run-pypsa-eur" |
|
| 1754 | / "pypsa-eur" |
|
| 1755 | / "results" |
|
| 1756 | / data_config["run"]["name"] |
|
| 1757 | / "prenetworks" |
|
| 1758 | / f"base_s_{data_config['scenario']['clusters'][0]}" |
|
| 1759 | f"_l{data_config['scenario']['ll'][0]}" |
|
| 1760 | f"_{data_config['scenario']['opts'][0]}" |
|
| 1761 | f"_{data_config['scenario']['sector_opts'][0]}" |
|
| 1762 | f"_{data_config['scenario']['planning_horizons'][planning_horizon]}.nc" |
|
| 1763 | ) |
|
| 1764 | ||
| 1765 | else: |
|
| 1766 | target_file = ( |
|
| 1767 | Path(".") |
|
| 1768 | / "data_bundle_egon_data" |
|
| 1769 | / "pypsa_eur" |
|
| 1770 | / "prenetworks" |
|
| 1771 | / "prenetwork_post-manipulate_pre-solve" |
|
| 1772 | / "base_s_39_lc1.25__cb40ex0-T-H-I-B-solar+p3-dist1_2045.nc" |
|
| 1773 | ) |
|
| 1774 | ||
| 1775 | return pypsa.Network(target_file.absolute().as_posix()) |
|
| 1776 | ||
| 1777 | ||
| 1778 | def overwrite_H2_pipeline_share(): |
|