Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated osm-prebuilt network to v0.4 and added version control to config #1293

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ co2_budget:
electricity:
voltages: [200., 220., 300., 380., 500., 750.]
base_network: osm-prebuilt
osm-prebuilt-version: 0.4
gaslimit_enable: false
gaslimit: false
co2limit_enable: false
Expand Down
1 change: 1 addition & 0 deletions doc/configtables/electricity.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
,Unit,Values,Description
voltages,kV,"Any subset of {200., 220., 300., 380., 500., 750.}",Voltage levels to consider
base_network, --, "Any value in {'entsoegridkit', 'osm-prebuilt', 'osm-raw}", "Specify the underlying base network, i.e. GridKit (based on ENTSO-E web map extract, OpenStreetMap (OSM) prebuilt or raw (built from raw OSM data), takes longer."
osm-prebuilt-version, --, "float, any value in range 0.1-0.4", "Choose the version of the prebuilt OSM network. Defaults to latest Zenodo release."
gaslimit_enable,bool,true or false,Add an overall absolute gas limit configured in ``electricity: gaslimit``.
gaslimit,MWhth,float or false,Global gas usage limit
co2limit_enable,bool,true or false,Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit`` in :mod:`prepare_network`. **Warning:** This option should currently only be used with electricity-only networks, not for sector-coupled networks..
Expand Down
8 changes: 4 additions & 4 deletions doc/data_sources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ Data in this section is retrieved and extracted in rules specified in ``rules/re
``data/osm-prebuilt``

- **Source:** OpenStreetMap; Xiong, B., Neumann, F., & Brown, T. (2024).
Prebuilt Electricity Network for PyPSA-Eur based on OpenStreetMap Data (0.3)
[Data set]. Zenodo. https://doi.org/10.5281/zenodo.13358976
- **Link:** https://zenodo.org/records/13358976
- **License:** ODbL (`reference <https://zenodo.org/records/13358976>`)
Prebuilt Electricity Network for PyPSA-Eur based on OpenStreetMap Data (0.4)
[Data set]. Zenodo. https://doi.org/10.5281/zenodo.13759222
- **Link:** https://zenodo.org/records/13759222
- **License:** ODbL (`reference <https://zenodo.org/records/13759222>`)
- **Description:** Pre-built data of high-voltage transmission grid in Europe from OpenStreetMap.

``data/osm-raw``
Expand Down
4 changes: 4 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Release Notes

* The sources of nearly all data files are now listed in the documentation.

* Updated osm-prebuilt network to version 0.4: https://doi.org/10.5281/zenodo.13759222 : Added Kosovo (XK) as dedicated region. Fixed major 330 kV line in Moldova (MD) (https://www.openstreetmap.org/way/33360284).

* Add version control to osm-prebuilt: `config["electricity"]["osm-prebuilt-version"]`. Defaults to latest Zenodo release, i.e. v0.4, Config is only considered when selecting `osm-prebuilt` as `base_network`.

PyPSA-Eur 0.12.0 (30th August 2024)
===================================

Expand Down
8 changes: 6 additions & 2 deletions rules/build_electricity.smk
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ rule build_powerplants:

def input_base_network(w):
base_network = config_provider("electricity", "base_network")(w)
osm_prebuilt_version = config_provider("electricity", "osm-prebuilt-version")(w)
components = {"buses", "lines", "links", "converters", "transformers"}
if base_network == "osm-raw":
inputs = {c: resources(f"osm-raw/build/{c}.csv") for c in components}
else:
elif base_network == "osm-prebuilt":
inputs = {
c: f"data/{base_network}/{osm_prebuilt_version}/{c}.csv" for c in components
}
elif base_network == "entsoegridkit":
inputs = {c: f"data/{base_network}/{c}.csv" for c in components}
if base_network == "entsoegridkit":
inputs["parameter_corrections"] = "data/parameter_corrections.yaml"
inputs["links_p_nom"] = "data/links_p_nom.csv"
return inputs
Expand Down
36 changes: 25 additions & 11 deletions rules/retrieve.smk
Original file line number Diff line number Diff line change
Expand Up @@ -534,24 +534,38 @@ if config["enable"]["retrieve"]:
if config["enable"]["retrieve"] and (
config["electricity"]["base_network"] == "osm-prebuilt"
):

# Dictionary of prebuilt versions, e.g. 0.3 : "13358976"
osm_prebuilt_version = {
0.1: "12799202",
0.2: "13342577",
0.3: "13358976",
0.4: "13759222",
}

# update rule to use the correct version
rule retrieve_osm_prebuilt:
input:
buses=storage("https://zenodo.org/records/13358976/files/buses.csv"),
buses=storage(
f"https://zenodo.org/records/{osm_prebuilt_version[config['electricity']['osm-prebuilt-version']]}/files/buses.csv"
),
converters=storage(
"https://zenodo.org/records/13358976/files/converters.csv"
f"https://zenodo.org/records/{osm_prebuilt_version[config['electricity']['osm-prebuilt-version']]}/files/converters.csv"
),
lines=storage(
f"https://zenodo.org/records/{osm_prebuilt_version[config['electricity']['osm-prebuilt-version']]}/files/lines.csv"
),
links=storage(
f"https://zenodo.org/records/{osm_prebuilt_version[config['electricity']['osm-prebuilt-version']]}/files/links.csv"
),
lines=storage("https://zenodo.org/records/13358976/files/lines.csv"),
links=storage("https://zenodo.org/records/13358976/files/links.csv"),
transformers=storage(
"https://zenodo.org/records/13358976/files/transformers.csv"
f"https://zenodo.org/records/{osm_prebuilt_version[config['electricity']['osm-prebuilt-version']]}/files/transformers.csv"
),
output:
buses="data/osm-prebuilt/buses.csv",
converters="data/osm-prebuilt/converters.csv",
lines="data/osm-prebuilt/lines.csv",
links="data/osm-prebuilt/links.csv",
transformers="data/osm-prebuilt/transformers.csv",
buses=f"data/osm-prebuilt/{config['electricity']['osm-prebuilt-version']}/buses.csv",
converters=f"data/osm-prebuilt/{config['electricity']['osm-prebuilt-version']}/converters.csv",
lines=f"data/osm-prebuilt/{config['electricity']['osm-prebuilt-version']}/lines.csv",
links=f"data/osm-prebuilt/{config['electricity']['osm-prebuilt-version']}/links.csv",
transformers=f"data/osm-prebuilt/{config['electricity']['osm-prebuilt-version']}/transformers.csv",
log:
"logs/retrieve_osm_prebuilt.log",
threads: 1
Expand Down
14 changes: 12 additions & 2 deletions scripts/base_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ def base_network(
):

base_network = config["electricity"].get("base_network")
osm_prebuilt_version = config["electricity"].get("osm-prebuilt-version")
assert base_network in {
"entsoegridkit",
"osm-raw",
Expand All @@ -728,7 +729,12 @@ def base_network(
DeprecationWarning,
)

logger.info(f"Creating base network using {base_network}.")
logger_str = (
f"Creating base network using {base_network}"
+ (f" v{osm_prebuilt_version}" if base_network == "osm-prebuilt" else "")
+ "."
)
logger.info(logger_str)

buses = _load_buses(buses, europe_shape, config)
transformers = _load_transformers(buses, transformers)
Expand Down Expand Up @@ -764,7 +770,11 @@ def base_network(
converters = _set_electrical_parameters_converters(converters, config)

n = pypsa.Network()
n.name = f"PyPSA-Eur ({base_network})"
n.name = (
f"PyPSA-Eur ({base_network}"
+ (f" v{osm_prebuilt_version}" if base_network == "osm-prebuilt" else "")
+ ")"
)

time = get_snapshots(snakemake.params.snapshots, snakemake.params.drop_leap_day)
n.set_snapshots(time)
Expand Down
Loading