Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into add-param
Browse files Browse the repository at this point in the history
  • Loading branch information
davide-f committed Aug 28, 2023
2 parents 79d4dc8 + 6e6dbf6 commit b7b40be
Show file tree
Hide file tree
Showing 17 changed files with 565 additions and 730 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repos:
rev: v2.2.5
hooks:
- id: codespell
args: ['--ignore-regex="(\b[A-Z]+\b)"', '--ignore-words-list=fom,appartment,bage,ore,setis,tabacco,berfore'] # Ignore capital case words, e.g. country codes
args: ['--ignore-regex="(\b[A-Z]+\b)"', '--ignore-words-list=fom,appartment,bage,ore,setis,tabacco,berfore,fo,FO']
types_or: [python, rst, markdown]
files: ^(scripts|doc)/

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/kma33">
<img src="https://avatars.githubusercontent.com/u/25573938?v=4" width="100;" alt="kma33"/>
<br />
<sub><b>Katherine M. Antonio</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/pitmonticone">
<img src="https://avatars.githubusercontent.com/u/38562595?v=4" width="100;" alt="pitmonticone"/>
Expand Down
20 changes: 20 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,27 @@ rule build_bus_regions:
"scripts/build_bus_regions.py"


def terminate_if_cutout_exists(config=config):
"""
Check if any of the requested cutout files exist.
If that's the case, terminate execution to avoid data loss.
"""
config_cutouts = [
d_value["cutout"] for tc, d_value in config["renewable"].items()
] + list(config["atlite"]["cutouts"].keys())

for ct in set(config_cutouts):
cutout_fl = "cutouts/" + CDIR + ct + ".nc"
if os.path.exists(cutout_fl):
raise Exception(
"An option `build_cutout` is enabled, while a cutout file '"
+ cutout_fl
+ "' still exists and risks to be overwritten. If this is an intended behavior, please move or delete this file and re-run the rule. Otherwise, just disable the `build_cutout` rule in the config file."
)


if config["enable"].get("build_cutout", False):
terminate_if_cutout_exists(config)

rule build_cutout:
params:
Expand Down
1 change: 1 addition & 0 deletions config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ renewable:
carriers: [ror, PHS, hydro]
PHS_max_hours: 6
hydro_max_hours: "energy_capacity_totals_by_country" # not active
hydro_max_hours_default: 6.0 # (optional, default 6) Default value of max_hours for hydro when NaN values are found
clip_min_inflow: 1.0
extendable: true
normalization:
Expand Down
1 change: 1 addition & 0 deletions config.tutorial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ renewable:
carriers: [ror, PHS, hydro]
PHS_max_hours: 6
hydro_max_hours: "energy_capacity_totals_by_country" # one of energy_capacity_totals_by_country, estimate_by_large_installations or a float
hydro_max_hours_default: 6.0 # (optional, default 6) Default value of max_hours for hydro when NaN values are found
clip_min_inflow: 1.0
normalization:
method: hydro_capacities # 'hydro_capacities' to rescale country hydro production by using hydro_capacities, 'eia' to rescale by eia data, false for no rescaling
Expand Down
20 changes: 20 additions & 0 deletions configs/bundle_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ databundles:
- data/gebco/GEBCO_2021_TID.nc
- data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif
- data/ssp2-2.6/2030/era5_2013/Africa.nc
- data/ssp2-2.6/2030/era5_2013/Asia.nc
- data/ssp2-2.6/2030/era5_2013/Europe.nc
- data/ssp2-2.6/2030/era5_2013/NorthAmerica.nc
- data/ssp2-2.6/2030/era5_2013/SouthAmerica.nc
- data/ssp2-2.6/2030/era5_2013/Oceania.nc
- data/hydrobasins/hybas_world_lev04_v1c.shp
- data/hydrobasins/hybas_world_lev05_v1c.shp
- data/hydrobasins/hybas_world_lev06_v1c.shp

# resources bundle containing the resources folder for Africa only
bundle_natura_earth:
Expand Down Expand Up @@ -336,3 +344,15 @@ databundles:
# output: [cutouts/cutout-2013-era5.nc]
# disable_by_opt:
# build_cutout: [all]

# Cutout for South America, approx 18 GB
bundle_cutouts_southamerica:
countries: [SouthAmerica]
category: cutouts
destination: "cutouts"
urls:
# zenodo:
gdrive: https://drive.google.com/file/d/1Jeu2Vzoq4mNDUKSvIviN8HqSFx5gl61b/view?usp=sharing
output: [cutouts/cutout-2013-era5.nc]
disable_by_opt:
build_cutout: [all]

0 comments on commit b7b40be

Please sign in to comment.