2020-05-29 07:50:55 +00:00
|
|
|
# SPDX-FileCopyrightText: : 2017-2020 The PyPSA-Eur Authors
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2019-11-28 15:33:33 +00:00
|
|
|
from os.path import normpath, exists
|
|
|
|
from shutil import copyfile
|
|
|
|
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
from snakemake.remote.HTTP import RemoteProvider as HTTPRemoteProvider
|
|
|
|
HTTP = HTTPRemoteProvider()
|
|
|
|
|
2019-11-28 15:33:33 +00:00
|
|
|
if not exists("config.yaml"):
|
|
|
|
copyfile("config.default.yaml", "config.yaml")
|
2019-11-22 14:13:46 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
configfile: "config.yaml"
|
|
|
|
|
2018-10-25 14:43:24 +00:00
|
|
|
COSTS="data/costs.csv"
|
2020-12-03 18:50:53 +00:00
|
|
|
ATLITE_NPROCESSES = config['atlite'].get('nprocesses', 4)
|
|
|
|
|
2018-10-25 14:43:24 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
wildcard_constraints:
|
2018-10-26 08:28:54 +00:00
|
|
|
simpl="[a-zA-Z0-9]*|all",
|
|
|
|
clusters="[0-9]+m?|all",
|
2020-12-03 18:50:53 +00:00
|
|
|
ll="(v|c)([0-9\.]+|opt|all)|all",
|
2019-06-18 09:50:54 +00:00
|
|
|
opts="[-+a-zA-Z0-9\.]*"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2020-12-05 16:54:50 +00:00
|
|
|
rule cluster_all_networks:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: expand("networks/elec_s{simpl}_{clusters}.nc", **config['scenario'])
|
|
|
|
|
2019-02-03 13:00:45 +00:00
|
|
|
|
2020-12-05 16:54:50 +00:00
|
|
|
rule extra_components_all_networks:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: expand("networks/elec_s{simpl}_{clusters}_ec.nc", **config['scenario'])
|
|
|
|
|
2020-01-09 13:09:28 +00:00
|
|
|
|
2020-12-05 16:54:50 +00:00
|
|
|
rule prepare_all_networks:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: expand("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", **config['scenario'])
|
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-05 16:54:50 +00:00
|
|
|
rule solve_all_networks:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: expand("results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", **config['scenario'])
|
|
|
|
|
2018-01-30 22:48:29 +00:00
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if config['enable'].get('prepare_links_p_nom', False):
|
2018-08-13 12:09:20 +00:00
|
|
|
rule prepare_links_p_nom:
|
|
|
|
output: 'data/links_p_nom.csv'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: 'logs/prepare_links_p_nom.log'
|
2018-08-13 12:09:20 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=500
|
2018-08-13 12:09:20 +00:00
|
|
|
script: 'scripts/prepare_links_p_nom.py'
|
|
|
|
|
2019-11-05 11:53:21 +00:00
|
|
|
|
|
|
|
datafiles = ['ch_cantons.csv', 'je-e-21.03.02.xls',
|
|
|
|
'eez/World_EEZ_v8_2014.shp', 'EIA_hydro_generation_2000_2014.csv',
|
|
|
|
'hydro_capacities.csv', 'naturalearth/ne_10m_admin_0_countries.shp',
|
|
|
|
'NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp', 'nama_10r_3popgdp.tsv.gz',
|
2020-12-03 11:49:04 +00:00
|
|
|
'nama_10r_3gdp.tsv.gz', 'corine/g250_clc06_V18_5.tif']
|
2019-11-19 14:56:44 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if not config.get('tutorial', False):
|
2019-11-06 16:50:57 +00:00
|
|
|
datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"])
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2019-11-19 14:56:44 +00:00
|
|
|
if config['enable'].get('retrieve_databundle', True):
|
|
|
|
rule retrieve_databundle:
|
2020-12-03 18:50:53 +00:00
|
|
|
output: expand('data/bundle/{file}', file=datafiles)
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/retrieve_databundle.log"
|
2019-11-19 14:56:44 +00:00
|
|
|
script: 'scripts/retrieve_databundle.py'
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2020-12-03 11:49:04 +00:00
|
|
|
rule build_load_data:
|
|
|
|
output: "resources/load.csv"
|
|
|
|
log: "logs/build_load_data.log"
|
|
|
|
script: 'scripts/build_load_data.py'
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2019-10-31 15:45:13 +00:00
|
|
|
rule build_powerplants:
|
2019-11-06 14:59:34 +00:00
|
|
|
input:
|
|
|
|
base_network="networks/base.nc",
|
|
|
|
custom_powerplants="data/custom_powerplants.csv"
|
2019-10-31 15:45:13 +00:00
|
|
|
output: "resources/powerplants.csv"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_powerplants.log"
|
2019-10-31 15:45:13 +00:00
|
|
|
threads: 1
|
|
|
|
resources: mem=500
|
|
|
|
script: "scripts/build_powerplants.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
rule base_network:
|
|
|
|
input:
|
|
|
|
eg_buses='data/entsoegridkit/buses.csv',
|
|
|
|
eg_lines='data/entsoegridkit/lines.csv',
|
|
|
|
eg_links='data/entsoegridkit/links.csv',
|
|
|
|
eg_converters='data/entsoegridkit/converters.csv',
|
|
|
|
eg_transformers='data/entsoegridkit/transformers.csv',
|
|
|
|
parameter_corrections='data/parameter_corrections.yaml',
|
2018-08-03 09:49:23 +00:00
|
|
|
links_p_nom='data/links_p_nom.csv',
|
2018-09-24 18:19:47 +00:00
|
|
|
links_tyndp='data/links_tyndp.csv',
|
2018-08-03 09:49:23 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
|
|
|
europe_shape='resources/europe_shape.geojson'
|
2018-01-29 21:28:33 +00:00
|
|
|
output: "networks/base.nc"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/base_network.log"
|
2018-01-29 21:28:33 +00:00
|
|
|
benchmark: "benchmarks/base_network"
|
2017-12-18 19:34:15 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=500
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/base_network.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-08-03 09:49:23 +00:00
|
|
|
rule build_shapes:
|
|
|
|
input:
|
|
|
|
naturalearth='data/bundle/naturalearth/ne_10m_admin_0_countries.shp',
|
|
|
|
eez='data/bundle/eez/World_EEZ_v8_2014.shp',
|
|
|
|
nuts3='data/bundle/NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp',
|
|
|
|
nuts3pop='data/bundle/nama_10r_3popgdp.tsv.gz',
|
|
|
|
nuts3gdp='data/bundle/nama_10r_3gdp.tsv.gz',
|
|
|
|
ch_cantons='data/bundle/ch_cantons.csv',
|
|
|
|
ch_popgdp='data/bundle/je-e-21.03.02.xls'
|
|
|
|
output:
|
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
|
|
|
europe_shape='resources/europe_shape.geojson',
|
|
|
|
nuts3_shapes='resources/nuts3_shapes.geojson'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_shapes.log"
|
2018-08-03 09:49:23 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=500
|
2018-08-03 09:49:23 +00:00
|
|
|
script: "scripts/build_shapes.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-01-29 21:28:33 +00:00
|
|
|
rule build_bus_regions:
|
2017-12-18 19:34:15 +00:00
|
|
|
input:
|
2018-08-03 09:49:23 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
2018-01-29 21:28:33 +00:00
|
|
|
base_network="networks/base.nc"
|
|
|
|
output:
|
|
|
|
regions_onshore="resources/regions_onshore.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore.geojson"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_bus_regions.log"
|
2020-12-03 18:50:53 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=1000
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/build_bus_regions.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
if config['enable'].get('build_cutout', False):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule build_cutout:
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
input:
|
|
|
|
regions_onshore="resources/regions_onshore.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore.geojson"
|
|
|
|
output: "cutouts/{cutout}.nc"
|
2019-12-09 20:29:15 +00:00
|
|
|
log: "logs/build_cutout/{cutout}.log"
|
2019-11-05 11:53:21 +00:00
|
|
|
benchmark: "benchmarks/build_cutout_{cutout}"
|
2020-12-03 18:50:53 +00:00
|
|
|
threads: ATLITE_NPROCESSES
|
|
|
|
resources: mem=ATLITE_NPROCESSES * 1000
|
2019-11-05 11:53:21 +00:00
|
|
|
script: "scripts/build_cutout.py"
|
2020-03-16 14:51:47 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2020-03-16 14:51:47 +00:00
|
|
|
if config['enable'].get('retrieve_cutout', True):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule retrieve_cutout:
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
input: HTTP.remote("zenodo.org/record/4709858/files/{cutout}.nc", keep_local=True)
|
|
|
|
output: "cutouts/{cutout}.nc"
|
|
|
|
shell: "mv {input} {output}"
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2018-08-03 09:54:28 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
if config['enable'].get('build_natura_raster', False):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule build_natura_raster:
|
2020-12-03 18:50:53 +00:00
|
|
|
input:
|
2019-11-11 15:29:27 +00:00
|
|
|
natura="data/bundle/natura/Natura2000_end2015.shp",
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
cutouts=expand("cutouts/{cutouts}.nc", **config['atlite'])
|
2019-11-05 11:53:21 +00:00
|
|
|
output: "resources/natura.tiff"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_natura_raster.log"
|
2019-11-05 11:53:21 +00:00
|
|
|
script: "scripts/build_natura_raster.py"
|
2020-03-16 14:51:47 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2020-03-16 14:51:47 +00:00
|
|
|
if config['enable'].get('retrieve_natura_raster', True):
|
2019-11-05 11:53:21 +00:00
|
|
|
rule retrieve_natura_raster:
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
input: HTTP.remote("zenodo.org/record/4706686/files/natura.tiff", keep_local=True)
|
2019-11-05 11:53:21 +00:00
|
|
|
output: "resources/natura.tiff"
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
shell: "mv {input} {output}"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-01-29 21:28:33 +00:00
|
|
|
rule build_renewable_profiles:
|
2017-12-18 19:34:15 +00:00
|
|
|
input:
|
2018-01-29 21:28:33 +00:00
|
|
|
base_network="networks/base.nc",
|
2018-12-10 17:40:54 +00:00
|
|
|
corine="data/bundle/corine/g250_clc06_V18_5.tif",
|
|
|
|
natura="resources/natura.tiff",
|
2020-12-03 18:50:53 +00:00
|
|
|
gebco=lambda w: ("data/bundle/GEBCO_2014_2D.nc"
|
|
|
|
if "max_depth" in config["renewable"][w.technology].keys()
|
|
|
|
else []),
|
2018-12-10 17:40:54 +00:00
|
|
|
country_shapes='resources/country_shapes.geojson',
|
2018-12-11 16:30:25 +00:00
|
|
|
offshore_shapes='resources/offshore_shapes.geojson',
|
2020-12-03 18:50:53 +00:00
|
|
|
regions=lambda w: ("resources/regions_onshore.geojson"
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
if w.technology in ('onwind', 'solar')
|
|
|
|
else "resources/regions_offshore.geojson"),
|
|
|
|
cutout=lambda w: "cutouts/" + config["renewable"][w.technology]['cutout'] + ".nc"
|
|
|
|
output: profile="resources/profile_{technology}.nc",
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_renewable_profile_{technology}.log"
|
2018-02-19 09:16:29 +00:00
|
|
|
benchmark: "benchmarks/build_renewable_profiles_{technology}"
|
2020-12-03 18:50:53 +00:00
|
|
|
threads: ATLITE_NPROCESSES
|
|
|
|
resources: mem=ATLITE_NPROCESSES * 5000
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/build_renewable_profiles.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2019-10-03 10:32:49 +00:00
|
|
|
if 'hydro' in config['renewable'].keys():
|
|
|
|
rule build_hydro_profile:
|
|
|
|
input:
|
|
|
|
country_shapes='resources/country_shapes.geojson',
|
|
|
|
eia_hydro_generation='data/bundle/EIA_hydro_generation_2000_2014.csv',
|
Atlite availability (#224)
* adjust buil_cutout.py and Snakefile
* try adjusting build_renewable_profiles, currently crashing due to weird pyproj error
* build_renewable_profiles: -remove printing gid
* build_renewable_profiles: use dask for paralellization, use dense functions
* build_renewable_profiles:
- revise imports
- add logging for long calculation
- revise explaining comment
- revise distance calculation
* build profiles: adjust to cutout.grid
* * fix area to square km
* rename potmatrix -> capacity_potential
* rename available to availibility
* config.default update cutout params
build_renewable_potentials: major refactoring and simplification
hydro_profiles: update code
* build profiles: fix weight output dimensions
* build profiles: fix typo, fix selection of buses
* build profiles: reinsert paths variable
* follow up
* build profiles: move to dask calculation only
* CI: set build cutout to true (add CDSAPI)
* build profiles: use pyproj, test with gleas and geokit upstream
* environment.yaml fix atlite version
* build profiles: use dask 'processes' for more than 25 regions
* build profiles: specify dask scheduler according to number of regions
* backpedal a bit, only allow scheduler='processes'
* follow up, code style and fixup
* build profiles: add logger info for underwater fraction calc
* config adjust cutout parameters
Snakefile fixup
* config.default.yaml: adjust resolution
* config: use one cutout in total
build_cutout: automatic detetection of geographical boundaries
* env: add python>=3.8 requirement
build_cutout: fixup for region bound
* config: allow base cutout
* folllow up, fix up
* follow up II
* clean up
* clean up II
* build profiles: move back to multiprocessing due to performance issues
* small code style corrections
* move in pool context
* swqitch to ratsterio
* switch to rasterio for availibility calculation
* tiny fixup
* * build continental raster for offshore distance calculation
* adjust Snakefile to new script build_raster
* rename continental raster to onshore raster
add projected_mask function (not yet tested)
add docstrings, modularize
* Snakefile: remove build_onhore_raster rule, build mask directly from geometry instead
build_natura_raster: adjust code, add function for exporting
build_profiles:
* add buffer to shore distance to init_globals function
* update docstrings
* improve handling of nodata grid codes
* add geometry mask if natura raster not activated
(the 255 value is an 'eligible' value for the corine data base,
do this for excluding data outside the shape)
* build_profiles: adjust docstrings
* update environment
* build profiles: fixup reproject woth padding
* follow up, small fixups
* fix resampling method
checkpoint: reproduces solar profile in tut data
* reintegrate plot map
code style
* config: rename cutout into "base"
* build profiles: adjust to new atlite code
* natura raster: small fixup
* build natura raster: compress tiff file
* config: adjust cutout names
* build profiles: cover case if no or partial overlap between natura raster and cutout
* config-tutorial: adjust cutout params
* buid-profifiles: fixup in gebco filter
* follow up
* update config files
* build profiles: select layoutmatrix != 0
* build profiles: speed up average_distance and underwaterfraction
* build profiles: fix typo
* update release notes
build_cutout: only build needed features
* update envs
* config: add temperature to sarah features
* temporary fix for atlite v0.2.1 and new xarray version release
* env: remove xarray specification
* * remove rule build_country_flh
* build profiles: remove sneaked in line
* doc: update configuration.rst (section atlite) and corresponding csv table
* release notes: fix quotes
* build profiles: use 3035 for area calculation
* Update envs/environment.docs.yaml
* Update scripts/build_cutout.py
* Update doc/release_notes.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update doc/configuration.rst
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* Update scripts/build_cutout.py
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
* update release notes
* release notes: add deprecation of 'keep_all_available_areas'
build profiles: remove warning for 'keep_all_available_areas'
* build cutout: rearrage code, set buffer correctly
* Rename tutorial cutout to remove name clash with real cutout.
* Update release_notes.rst: Rename tutorial cutout.
* retrieve: update cutouts and downloads (alternative) (#237)
* retrieve: update cutouts and downloads
* retrieve: remove unnecessary import
* use snakemake remote file functionality
* Snakefile: update zenodo link
* update natura remote link (closes #234)
* env: update atlite version to 0.2.2
* env: fix dask version due to memory issues
* test: retrieve cutout instead of build
* test: use tutorial cutout for CI
Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-27 15:58:31 +00:00
|
|
|
cutout="cutouts/" + config["renewable"]['hydro']['cutout'] + ".nc"
|
2019-10-03 10:32:49 +00:00
|
|
|
output: 'resources/profile_hydro.nc'
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/build_hydro_profile.log"
|
2019-10-03 10:32:49 +00:00
|
|
|
resources: mem=5000
|
|
|
|
script: 'scripts/build_hydro_profile.py'
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
rule add_electricity:
|
|
|
|
input:
|
2018-01-29 21:28:33 +00:00
|
|
|
base_network='networks/base.nc',
|
2018-10-25 14:43:24 +00:00
|
|
|
tech_costs=COSTS,
|
2018-01-29 21:28:33 +00:00
|
|
|
regions="resources/regions_onshore.geojson",
|
2018-02-10 16:16:20 +00:00
|
|
|
powerplants='resources/powerplants.csv',
|
2018-08-03 09:53:14 +00:00
|
|
|
hydro_capacities='data/bundle/hydro_capacities.csv',
|
2018-11-12 20:43:33 +00:00
|
|
|
geth_hydro_capacities='data/geth2015_hydro_capacities.csv',
|
2020-12-03 11:49:04 +00:00
|
|
|
load='resources/load.csv',
|
2018-08-03 09:53:14 +00:00
|
|
|
nuts3_shapes='resources/nuts3_shapes.geojson',
|
2020-12-03 18:50:53 +00:00
|
|
|
**{f"profile_{tech}": f"resources/profile_{tech}.nc"
|
|
|
|
for tech in config['renewable']}
|
2018-01-29 21:28:33 +00:00
|
|
|
output: "networks/elec.nc"
|
2019-11-28 07:22:52 +00:00
|
|
|
log: "logs/add_electricity.log"
|
2018-01-29 21:28:33 +00:00
|
|
|
benchmark: "benchmarks/add_electricity"
|
2017-12-18 19:34:15 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=3000
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/add_electricity.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-01-30 22:11:16 +00:00
|
|
|
rule simplify_network:
|
2018-01-29 21:28:33 +00:00
|
|
|
input:
|
2020-12-03 18:50:53 +00:00
|
|
|
network='networks/elec.nc',
|
2018-10-27 01:41:38 +00:00
|
|
|
tech_costs=COSTS,
|
2018-01-29 21:28:33 +00:00
|
|
|
regions_onshore="resources/regions_onshore.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore.geojson"
|
|
|
|
output:
|
2020-12-03 18:50:53 +00:00
|
|
|
network='networks/elec_s{simpl}.nc',
|
|
|
|
regions_onshore="resources/regions_onshore_elec_s{simpl}.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore_elec_s{simpl}.geojson",
|
2021-08-04 16:19:23 +00:00
|
|
|
busmap='resources/busmap_elec_s{simpl}.csv',
|
|
|
|
connection_costs='resources/connection_costs_s{simpl}.csv'
|
2020-12-03 18:50:53 +00:00
|
|
|
log: "logs/simplify_network/elec_s{simpl}.log"
|
|
|
|
benchmark: "benchmarks/simplify_network/elec_s{simpl}"
|
2018-01-30 22:11:16 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=4000
|
2018-01-30 22:11:16 +00:00
|
|
|
script: "scripts/simplify_network.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-01-30 22:11:16 +00:00
|
|
|
rule cluster_network:
|
|
|
|
input:
|
2020-12-03 18:50:53 +00:00
|
|
|
network='networks/elec_s{simpl}.nc',
|
|
|
|
regions_onshore="resources/regions_onshore_elec_s{simpl}.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore_elec_s{simpl}.geojson",
|
|
|
|
busmap=ancient('resources/busmap_elec_s{simpl}.csv'),
|
|
|
|
custom_busmap=("data/custom_busmap_elec_s{simpl}_{clusters}.csv"
|
2020-12-03 14:17:16 +00:00
|
|
|
if config["enable"].get("custom_busmap", False) else []),
|
2019-09-23 14:44:48 +00:00
|
|
|
tech_costs=COSTS
|
2018-01-30 22:11:16 +00:00
|
|
|
output:
|
2020-12-03 18:50:53 +00:00
|
|
|
network='networks/elec_s{simpl}_{clusters}.nc',
|
|
|
|
regions_onshore="resources/regions_onshore_elec_s{simpl}_{clusters}.geojson",
|
|
|
|
regions_offshore="resources/regions_offshore_elec_s{simpl}_{clusters}.geojson",
|
|
|
|
busmap="resources/busmap_elec_s{simpl}_{clusters}.csv",
|
|
|
|
linemap="resources/linemap_elec_s{simpl}_{clusters}.csv"
|
|
|
|
log: "logs/cluster_network/elec_s{simpl}_{clusters}.log"
|
|
|
|
benchmark: "benchmarks/cluster_network/elec_s{simpl}_{clusters}"
|
2018-01-29 21:28:33 +00:00
|
|
|
threads: 1
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=3000
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/cluster_network.py"
|
|
|
|
|
2019-11-19 18:36:28 +00:00
|
|
|
|
|
|
|
rule add_extra_components:
|
|
|
|
input:
|
2020-12-03 18:50:53 +00:00
|
|
|
network='networks/elec_s{simpl}_{clusters}.nc',
|
2019-11-19 18:36:28 +00:00
|
|
|
tech_costs=COSTS,
|
2020-12-03 18:50:53 +00:00
|
|
|
output: 'networks/elec_s{simpl}_{clusters}_ec.nc'
|
|
|
|
log: "logs/add_extra_components/elec_s{simpl}_{clusters}.log"
|
|
|
|
benchmark: "benchmarks/add_extra_components/elec_s{simpl}_{clusters}_ec"
|
2019-11-19 18:36:28 +00:00
|
|
|
threads: 1
|
|
|
|
resources: mem=3000
|
|
|
|
script: "scripts/add_extra_components.py"
|
|
|
|
|
|
|
|
|
2018-01-29 21:28:33 +00:00
|
|
|
rule prepare_network:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: 'networks/elec_s{simpl}_{clusters}_ec.nc', tech_costs=COSTS
|
|
|
|
output: 'networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc'
|
|
|
|
log: "logs/prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"
|
|
|
|
benchmark: "benchmarks/prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
2018-01-29 21:28:33 +00:00
|
|
|
threads: 1
|
2020-12-03 15:02:21 +00:00
|
|
|
resources: mem=4000
|
2018-01-29 21:28:33 +00:00
|
|
|
script: "scripts/prepare_network.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-02-19 09:03:25 +00:00
|
|
|
def memory(w):
|
2018-10-22 21:28:56 +00:00
|
|
|
factor = 3.
|
|
|
|
for o in w.opts.split('-'):
|
|
|
|
m = re.match(r'^(\d+)h$', o, re.IGNORECASE)
|
|
|
|
if m is not None:
|
|
|
|
factor /= int(m.group(1))
|
|
|
|
break
|
2020-12-03 15:02:21 +00:00
|
|
|
for o in w.opts.split('-'):
|
|
|
|
m = re.match(r'^(\d+)seg$', o, re.IGNORECASE)
|
|
|
|
if m is not None:
|
|
|
|
factor *= int(m.group(1)) / 8760
|
|
|
|
break
|
2018-02-19 09:03:25 +00:00
|
|
|
if w.clusters.endswith('m'):
|
2018-10-22 21:28:56 +00:00
|
|
|
return int(factor * (18000 + 180 * int(w.clusters[:-1])))
|
2018-02-19 09:03:25 +00:00
|
|
|
else:
|
2019-02-06 10:46:39 +00:00
|
|
|
return int(factor * (10000 + 195 * int(w.clusters)))
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-02-10 16:19:46 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
rule solve_network:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
|
|
|
output: "results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
2017-12-18 19:34:15 +00:00
|
|
|
log:
|
2020-12-03 18:50:53 +00:00
|
|
|
solver=normpath("logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_solver.log"),
|
|
|
|
python="logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log",
|
|
|
|
memory="logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_memory.log"
|
|
|
|
benchmark: "benchmarks/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
2017-12-18 19:34:15 +00:00
|
|
|
threads: 4
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=memory
|
2020-12-03 18:50:53 +00:00
|
|
|
shadow: "shallow"
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/solve_network.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-02-19 09:17:49 +00:00
|
|
|
rule solve_operations_network:
|
|
|
|
input:
|
2020-12-03 18:50:53 +00:00
|
|
|
unprepared="networks/elec_s{simpl}_{clusters}_ec.nc",
|
|
|
|
optimized="results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
|
|
|
output: "results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc"
|
2018-02-19 09:17:49 +00:00
|
|
|
log:
|
2020-12-03 18:50:53 +00:00
|
|
|
solver=normpath("logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_solver.log"),
|
|
|
|
python="logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_python.log",
|
|
|
|
memory="logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_memory.log"
|
|
|
|
benchmark: "benchmarks/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
2018-02-19 09:17:49 +00:00
|
|
|
threads: 4
|
2018-09-20 12:26:38 +00:00
|
|
|
resources: mem=(lambda w: 5000 + 372 * int(w.clusters))
|
2020-12-03 18:50:53 +00:00
|
|
|
shadow: "shallow"
|
2018-02-19 09:17:49 +00:00
|
|
|
script: "scripts/solve_operations_network.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2017-12-18 19:34:15 +00:00
|
|
|
rule plot_network:
|
|
|
|
input:
|
2020-12-03 18:50:53 +00:00
|
|
|
network="results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
2018-10-25 14:43:24 +00:00
|
|
|
tech_costs=COSTS
|
2017-12-18 19:34:15 +00:00
|
|
|
output:
|
2020-12-03 18:50:53 +00:00
|
|
|
only_map="results/plots/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}.{ext}",
|
|
|
|
ext="results/plots/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}_ext.{ext}"
|
|
|
|
log: "logs/plot_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}_{ext}.log"
|
2017-12-18 19:34:15 +00:00
|
|
|
script: "scripts/plot_network.py"
|
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2019-02-03 12:50:05 +00:00
|
|
|
def input_make_summary(w):
|
2018-10-26 08:28:54 +00:00
|
|
|
# It's mildly hacky to include the separate costs input as first entry
|
2019-02-10 15:08:39 +00:00
|
|
|
if w.ll.endswith("all"):
|
|
|
|
ll = config["scenario"]["ll"]
|
|
|
|
if len(w.ll) == 4:
|
|
|
|
ll = [l for l in ll if l[0] == w.ll[0]]
|
|
|
|
else:
|
|
|
|
ll = w.ll
|
2018-10-26 08:28:54 +00:00
|
|
|
return ([COSTS] +
|
2020-12-03 18:50:53 +00:00
|
|
|
expand("results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
2019-02-10 15:08:39 +00:00
|
|
|
ll=ll,
|
2018-10-26 08:28:54 +00:00
|
|
|
**{k: config["scenario"][k] if getattr(w, k) == "all" else getattr(w, k)
|
2019-02-10 15:08:39 +00:00
|
|
|
for k in ["simpl", "clusters", "opts"]}))
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-10-26 08:28:54 +00:00
|
|
|
rule make_summary:
|
2019-02-03 12:50:05 +00:00
|
|
|
input: input_make_summary
|
2020-12-03 18:50:53 +00:00
|
|
|
output: directory("results/summaries/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}")
|
|
|
|
log: "logs/make_summary/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}.log",
|
2018-10-26 08:28:54 +00:00
|
|
|
script: "scripts/make_summary.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
2018-10-26 08:28:54 +00:00
|
|
|
rule plot_summary:
|
2020-12-03 18:50:53 +00:00
|
|
|
input: "results/summaries/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}"
|
|
|
|
output: "results/plots/summary_{summary}_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}.{ext}"
|
|
|
|
log: "logs/plot_summary/{summary}_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{country}_{ext}.log"
|
2018-10-26 08:28:54 +00:00
|
|
|
script: "scripts/plot_summary.py"
|
2017-12-18 19:34:15 +00:00
|
|
|
|
2020-12-03 18:50:53 +00:00
|
|
|
|
|
|
|
def input_plot_p_nom_max(w):
|
|
|
|
return [("networks/elec_s{simpl}{maybe_cluster}.nc"
|
|
|
|
.format(maybe_cluster=('' if c == 'full' else ('_' + c)), **w))
|
|
|
|
for c in w.clusts.split(",")]
|
|
|
|
|
|
|
|
|
2019-02-03 13:22:12 +00:00
|
|
|
rule plot_p_nom_max:
|
|
|
|
input: input_plot_p_nom_max
|
2020-12-03 18:50:53 +00:00
|
|
|
output: "results/plots/elec_s{simpl}_cum_p_nom_max_{clusts}_{techs}_{country}.{ext}"
|
|
|
|
log: "logs/plot_p_nom_max/elec_s{simpl}_{clusts}_{techs}_{country}_{ext}.log"
|
2019-02-03 13:22:12 +00:00
|
|
|
script: "scripts/plot_p_nom_max.py"
|
|
|
|
|