Skip to content

Commit

Permalink
Bypass external urls (pypsa-meets-earth#1257)
Browse files Browse the repository at this point in the history
* Update bundles with gadm-like to bypass gadm dependency

* Minor fixes

* Restore automatic emission download

* Add release note

* Add description to bundles
  • Loading branch information
davide-f authored Dec 23, 2024
1 parent 62a4bfa commit 236e0d0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
43 changes: 39 additions & 4 deletions configs/bundle_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ databundles:
category: data
destination: "data"
urls:
zenodo: https://sandbox.zenodo.org/records/3853/files/bundle_tutorial_NGBJ.zip?download=1
gdrive: https://drive.google.com/file/d/1Vb1ISjhy7iwTTZYeezGd6S4nLt-EDGme/view?usp=drive_link
zenodo: https://sandbox.zenodo.org/records/145504/files/bundle_tutorial_NGBJ_with_gadmlike.zip?download=1
gdrive: https://drive.google.com/file/d/12K03Epx3O9o-IQLh9afzCQyT-nMKWM3P/view?usp=drive_link
output:
- data/gebco/GEBCO_2021_TID.nc
- data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif
- data/gadm/gadm41_NGA/gadm41_NGA.gpkg # needed in build_shapes
- data/gadm/gadm41_BEN/gadm41_BEN.gpkg # needed in build_shapes
- data/gadm/gadm36_NGA/gadm36_NGA.gpkg # needed in sector-coupled model
- data/gadm/gadm36_BEN/gadm36_BEN.gpkg # needed in sector-coupled model

# tutorial bundle specific for Botswana only
bundle_tutorial_BW:
Expand All @@ -49,11 +53,13 @@ databundles:
category: data
destination: "data"
urls:
zenodo: https://sandbox.zenodo.org/records/3853/files/bundle_tutorial_BW.zip?download=1
gdrive: https://drive.google.com/file/d/19IXvTD8gVSzgTInL85ta7QjaNI8ZPCCY/view?usp=drive_link
zenodo: https://sandbox.zenodo.org/records/145504/files/bundle_tutorial_BW_with_gadmlike.zip?download=1
gdrive: https://drive.google.com/file/d/1YbbYGs1NsSsZYqNX1g1Jo-iJzt5m-81c/view?usp=drive_link
output:
- data/gebco/GEBCO_2021_TID.nc
- data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif
- data/gadm/gadm41_BWA/gadm41_BWA.gpkg # needed in build_shapes
- data/gadm/gadm36_BWA/gadm36_BWA.gpkg # needed in sector-coupled model

# tutorial bundle specific for Morocco only
bundle_tutorial_MA:
Expand Down Expand Up @@ -364,3 +370,32 @@ databundles:
urls:
protectedplanet: https://d1gam3xoknrgr2.cloudfront.net/current/WDPA_{month:s}{year:d}_Public_shp.zip
output: [data/landcover/world_protected_areas/*]

# Backup tutorial bundles with no gadm-like data; for reference:
# https://github.com/pypsa-meets-earth/pypsa-earth/issues/1258
#
# # tutorial bundle specific for Nigeria and Benin only, without gadm-like data
# bundle_tutorial_NGBJ:
# countries: [NG, BJ]
# tutorial: true
# category: data
# destination: "data"
# urls:
# zenodo: https://sandbox.zenodo.org/records/3853/files/bundle_tutorial_NGBJ.zip?download=1
# gdrive: https://drive.google.com/file/d/1Vb1ISjhy7iwTTZYeezGd6S4nLt-EDGme/view?usp=drive_link
# output:
# - data/gebco/GEBCO_2021_TID.nc
# - data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif

# # tutorial bundle specific for Botswana only, without gadm-like data
# bundle_tutorial_BW:
# countries: [BW]
# tutorial: true
# category: data
# destination: "data"
# urls:
# zenodo: https://sandbox.zenodo.org/records/3853/files/bundle_tutorial_BW.zip?download=1
# gdrive: https://drive.google.com/file/d/19IXvTD8gVSzgTInL85ta7QjaNI8ZPCCY/view?usp=drive_link
# output:
# - data/gebco/GEBCO_2021_TID.nc
# - data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ This part of documentation collects descriptive release notes to capture the mai

* Added electricity bus to Fischer-Tropsch in prepare_sector_network.py `PR #1226 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1226>`__

* Update BW, NG and BJ tutorial databundles to include gadm-like sources from geoboundaries `PR #1257 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1257>`__


PyPSA-Earth 0.5.0
=================
Expand Down
5 changes: 3 additions & 2 deletions scripts/prepare_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def set_line_nom_max(n, s_nom_max_set=np.inf, p_nom_max_set=np.inf):
clusters="4",
ll="c1",
opts="Co2L-4H",
configfile="test/config.sector.yaml",
)

configure_logging(snakemake)
Expand Down Expand Up @@ -372,10 +373,10 @@ def set_line_nom_max(n, s_nom_max_set=np.inf, p_nom_max_set=np.inf):
co2limit = co2limit * float(m[0])
logger.info("Setting CO2 limit according to emission base year.")
elif len(m) > 0:
co2limit = float(m[0]) * snakemake.params.electricity["co2base"]
co2limit = float(m[0]) * float(snakemake.params.electricity["co2base"])
logger.info("Setting CO2 limit according to wildcard value.")
else:
co2limit = snakemake.params.electricity["co2limit"]
co2limit = float(snakemake.params.electricity["co2limit"])
logger.info("Setting CO2 limit according to config value.")
add_co2limit(n, co2limit, Nyears)
break
Expand Down

0 comments on commit 236e0d0

Please sign in to comment.