-
Notifications
You must be signed in to change notification settings - Fork 4
New cutout and apply pre-commit #43
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -22,29 +22,27 @@ scenario: | |||||
|
|
||||||
|
|
||||||
| snapshots: | ||||||
| start: "2023-01-01" | ||||||
| end: "2024-01-01" | ||||||
| start: "2013-01-01" | ||||||
| end: "2013-01-31" | ||||||
|
|
||||||
| countries: ['IT', 'AT', 'CH', 'DE'] | ||||||
|
|
||||||
| enable: | ||||||
| validate_ember: true | ||||||
|
|
||||||
| atlite: | ||||||
| cutout_directory: cutouts | ||||||
| default_cutout: europe-2023-sarah3-era5 | ||||||
| default_cutout: europe-jan-2023-sarah3-era5 | ||||||
| nprocesses: 4 | ||||||
| show_progress: true | ||||||
| cutouts: | ||||||
| # use 'base' to determine geographical bounds and time span from config | ||||||
| # base: | ||||||
| # module: era5 | ||||||
| europe-2023-sarah3-era5: | ||||||
| europe-jan-2023-sarah3-era5: | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| module: [sarah, era5] # in priority order | ||||||
| x: [-12., 42.] | ||||||
| y: [33., 72.] | ||||||
| dx: 0.3 | ||||||
| dy: 0.3 | ||||||
| time: ['2023', '2023'] | ||||||
|
|
||||||
| time: ["2013-01-01", "2013-01-31"] | ||||||
|
|
||||||
| lines: | ||||||
| under_construction: remove | ||||||
|
|
@@ -77,7 +75,7 @@ electricity: | |||||
| Offshore: offwind-ac | ||||||
| Onshore: onwind | ||||||
| PV: solar | ||||||
|
|
||||||
| load: | ||||||
| fill_gaps: | ||||||
| enable: true | ||||||
|
|
@@ -109,7 +107,7 @@ costs: | |||||
| year: 2025 | ||||||
|
|
||||||
| ember_settings: | ||||||
| ntc: false | ||||||
| ntc_cross_country_pf_restriction: false | ||||||
| ramping: false | ||||||
| nuclear_decommissioning: false | ||||||
| ntc: false | ||||||
| ntc_cross_country_pf_restriction: false | ||||||
| ramping: false | ||||||
| nuclear_decommissioning: false | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,24 +2,29 @@ | |
| # | ||
| # SPDX-License-Identifier: MIT | ||
| import time | ||
|
|
||
| # rules/emberdata.smk | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| import requests | ||
|
|
||
| DOWNLOADS = { | ||
| Path("validation", "ember_data", "yearly_full_release_long_format.csv"): | ||
| "https://storage.googleapis.com/emb-prod-bkt-publicdata/public-downloads/yearly_full_release_long_format.csv", | ||
| Path("validation", "ember_data", "europe_monthly_full_release_long_format.csv"): | ||
| "https://storage.googleapis.com/emb-prod-bkt-publicdata/public-downloads/europe_monthly_full_release_long_format.csv", | ||
| Path("validation", "entsoe_data", "physical_energy_power_flows_2023.csv"): | ||
| "https://www.entsoe.eu/publications/data/power-stats/2023/physical_energy_power_flows_2023.csv" | ||
| Path( | ||
| "validation", "ember_data", "yearly_full_release_long_format.csv" | ||
| ): "https://storage.googleapis.com/emb-prod-bkt-publicdata/public-downloads/yearly_full_release_long_format.csv", | ||
| Path( | ||
| "validation", "ember_data", "europe_monthly_full_release_long_format.csv" | ||
| ): "https://storage.googleapis.com/emb-prod-bkt-publicdata/public-downloads/europe_monthly_full_release_long_format.csv", | ||
| Path( | ||
| "validation", "entsoe_data", "physical_energy_power_flows_2023.csv" | ||
| ): "https://www.entsoe.eu/publications/data/power-stats/2023/physical_energy_power_flows_2023.csv", | ||
| } | ||
|
|
||
|
|
||
| rule download_ember_data: | ||
| output: | ||
| [str(path) for path in DOWNLOADS.keys()] | ||
| [str(path) for path in DOWNLOADS.keys()], | ||
|
||
| run: | ||
| import urllib.request | ||
| import yaml | ||
|
|
@@ -41,63 +46,69 @@ rule download_ember_data: | |
| logger.info(f"Downloading {url} -> {filepath}") | ||
| response = requests.get(url) | ||
| response.raise_for_status() # Raise an error for non-200 responses | ||
| with open(filepath,"wb") as f: | ||
| with open(filepath, "wb") as f: | ||
| f.write(response.content) | ||
|
|
||
| # Confirm file creation | ||
| # Confirm file creation | ||
| while not filepath.exists(): | ||
| logger.info(f"Waiting for {filepath} to appear...") | ||
| time.sleep(1) | ||
|
|
||
| else: | ||
| logger.info(f"Already exists: {filepath}") | ||
|
|
||
|
|
||
| rule download_ember_NTC_data: | ||
| output: | ||
| file="validation/ember_data/Reg_NTC" | ||
| file="validation/ember_data/Reg_NTC", | ||
| shell: | ||
| """ | ||
| gdown https://drive.google.com/uc?id=1GTo4UrI_X9ZCsgtM4KobO_pw-TTrEoDy -O {output.file} | ||
| """ | ||
|
|
||
|
|
||
| rule download_eurostat: | ||
| output: | ||
| "validation/eurostatdata/eurostat_nrg_bal_c_2023.csv" | ||
| "validation/eurostatdata/eurostat_nrg_bal_c_2023.csv", | ||
| shell: | ||
| """ | ||
| curl -L "https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/nrg_bal_c?format=SDMX-CSV&startPeriod=2023&endPeriod=2023&lang=en&geo=EU27_2020&unit=KTOE" -o {output} | ||
| """ | ||
|
|
||
|
|
||
| rule download_jrc_idees: | ||
| output: | ||
| "validation/eurostatdata/JRC-IDEES-2021_EU27.zip" | ||
| "validation/eurostatdata/JRC-IDEES-2021_EU27.zip", | ||
| shell: | ||
| """ | ||
| curl -L "https://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/JRC-IDEES/JRC-IDEES-2021_v1/JRC-IDEES-2021_EU27.zip" -o {output} | ||
| """ | ||
|
|
||
|
|
||
| rule download_hotmaps: | ||
| output: | ||
| "validation/eurostatdata/Industrial_Database.csv" | ||
| "validation/eurostatdata/Industrial_Database.csv", | ||
| shell: | ||
| """ | ||
| curl -L "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database/-/raw/master/data/Industrial_Database.csv" -o {output} | ||
| """ | ||
|
|
||
|
|
||
| rule hourly_lignite_prices: | ||
| input: | ||
| "validation/ember_data/hourly_fuel_costs.csv" | ||
| "validation/ember_data/hourly_fuel_costs.csv", | ||
| output: | ||
| resources("hourly_fuel_costs_with_lignite.csv") | ||
| resources("hourly_fuel_costs_with_lignite.csv"), | ||
| script: | ||
| "../scripts/hourly_lignite.py" | ||
|
|
||
|
|
||
| rule extract_jrc_idees: | ||
| input: | ||
| "validation/eurostatdata/JRC-IDEES-2021_EU27.zip" | ||
| "validation/eurostatdata/JRC-IDEES-2021_EU27.zip", | ||
| output: | ||
| directory("validation/eurostatdata/jrc_idees/") | ||
| directory("validation/eurostatdata/jrc_idees/"), | ||
| shell: | ||
| """ | ||
| unzip {input} -d {output} | ||
| """ | ||
| """ | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -61,8 +61,6 @@ | |||||
| import xarray as xr | ||||||
| from pypsa.clustering.spatial import DEFAULT_ONE_PORT_STRATEGIES, normed_or_uniform | ||||||
|
|
||||||
| from scripts.apply_ntcs import apply_ntc | ||||||
|
|
||||||
| from scripts._helpers import ( | ||||||
| PYPSA_V1, | ||||||
| configure_logging, | ||||||
|
|
@@ -71,6 +69,7 @@ | |||||
| set_scenario_config, | ||||||
| update_p_nom_max, | ||||||
| ) | ||||||
| from scripts.apply_ntcs import apply_ntc | ||||||
|
|
||||||
| if PYPSA_V1: | ||||||
| pypsa.options.params.add.return_names = True | ||||||
|
|
@@ -615,7 +614,7 @@ def attach_wind_and_solar( | |||||
| caps = ppl.query("carrier == @car").groupby("bus").p_nom.sum() | ||||||
| caps = pd.Series( | ||||||
| data=ds.indexes["bus"].get_level_values("bus").map(caps), | ||||||
| index=ds.indexes["bus"] | ||||||
| index=ds.indexes["bus"], | ||||||
|
||||||
| index=ds.indexes["bus"], | |
| index=ds.indexes["bus"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.