Skip to content

Commit

Permalink
Add scenario in tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
davide-f committed Jul 3, 2024
1 parent e0647e0 commit a158482
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
43 changes: 30 additions & 13 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ config.update({"submodule_commit": get_last_commit_message(PYPSAEARTH_FOLDER)})
RDIR_PE = run["name"] + "/" if run.get("name") else ""
CDIR_PE = RDIR_PE if not run.get("shared_cutouts") else ""

CUTOUTS_PATH = "cutouts/" + CDIR_PE + (
"cutout-2013-era5-tutorial.nc"
if config["tutorial"]
else "cutout-2013-era5.nc"
CUTOUTS_PATH = (
"cutouts/"
+ CDIR_PE
+ ("cutout-2013-era5-tutorial.nc" if config["tutorial"] else "cutout-2013-era5.nc")
)


Expand Down Expand Up @@ -171,7 +171,9 @@ if not config["custom_data"]["gas_network"]:
custom_gas_network=config["custom_data"]["gas_network"],
input:
regions_onshore=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
output:
clustered_gas_network="resources/gas_networks/gas_network_elec_s{simpl}_{clusters}.csv",
Expand Down Expand Up @@ -205,7 +207,9 @@ rule prepare_sector_network:
district_heat_share="resources/demand/heat/district_heat_share_{demand}_s{simpl}_{clusters}_{planning_horizons}.csv",
biomass_transport_costs="data/temp_hard_coded/biomass_transport_costs.csv",
shapes_path=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
pipelines="data_custom/pipelines.csv"
if config["custom_data"]["gas_network"]
Expand Down Expand Up @@ -253,7 +257,9 @@ rule add_export:
network=RDIR
+ "/prenetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}.nc",
shapes_path=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
output:
RDIR
Expand Down Expand Up @@ -281,7 +287,9 @@ rule override_respot:
for planning_horizons in config["scenario"]["planning_horizons"]
},
overrides="data/override_component_attrs",
network=pypsaearth("networks/" + RDIR_PE + "elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"),
network=pypsaearth(
"networks/" + RDIR_PE + "elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
),
energy_totals="data/energy_totals_{demand}_{planning_horizons}.csv",
output:
RDIR
Expand Down Expand Up @@ -396,7 +404,9 @@ rule build_solar_thermal_profiles:
pop_layout_urban="resources/population_shares/pop_layout_urban_{planning_horizons}.nc",
pop_layout_rural="resources/population_shares/pop_layout_rural_{planning_horizons}.nc",
regions_onshore=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
cutout=pypsaearth(CUTOUTS_PATH),
output:
Expand Down Expand Up @@ -448,7 +458,9 @@ rule build_clustered_population_layouts:
pop_layout_rural="resources/population_shares/pop_layout_rural_{planning_horizons}.nc",
gdp_layout="resources/gdp_shares/gdp_layout_{planning_horizons}.nc",
regions_onshore=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
cutout=pypsaearth(CUTOUTS_PATH),
output:
Expand All @@ -470,7 +482,9 @@ rule build_heat_demand:
pop_layout_urban="resources/population_shares/pop_layout_urban_{planning_horizons}.nc",
pop_layout_rural="resources/population_shares/pop_layout_rural_{planning_horizons}.nc",
regions_onshore=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
cutout=pypsaearth(CUTOUTS_PATH),
output:
Expand All @@ -493,7 +507,9 @@ rule build_temperature_profiles:
pop_layout_urban="resources/population_shares/pop_layout_urban_{planning_horizons}.nc",
pop_layout_rural="resources/population_shares/pop_layout_rural_{planning_horizons}.nc",
regions_onshore=pypsaearth(
"resources/" + RDIR_PE + "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
"resources/"
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
cutout=pypsaearth(CUTOUTS_PATH),
output:
Expand Down Expand Up @@ -689,6 +705,7 @@ rule run_test:
config_pypsaearth["electricity"]["extendable_carriers"]["Store"] = []
config_pypsaearth["electricity"]["extendable_carriers"]["Link"] = []
config_pypsaearth["electricity"]["co2limit"] = 7.75e7
config_pypsaearth["run"]["name"] = "tutorial"

with open("./config.pypsa-earth.yaml", "w") as wfile:
yaml.dump(config_pypsaearth, wfile)
Expand Down Expand Up @@ -774,4 +791,4 @@ rule build_industry_demand: #default data
benchmark:
"benchmarks/industrial_energy_demand_per_node_elec_s{simpl}_{clusters}_{planning_horizons}_{demand}.csv"
script:
"scripts/build_industry_demand.py"
"scripts/build_industry_demand.py"
2 changes: 1 addition & 1 deletion test/config.test1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ summary_dir: results/
costs_dir: data/ #TODO change to the equivalent of technology data

run:
name: "test3" # use this to keep track of runs with different settings
name: "tutorial" # use this to keep track of runs with different settings
shared_cutouts: true # set to true to share the default cutout(s) across runs
# Note: value false requires build_cutout to be enabled

Expand Down

0 comments on commit a158482

Please sign in to comment.