Skip to content

Commit

Permalink
Merge branch 'main' into sec_paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatef authored Dec 20, 2024
2 parents f5a957e + 302f45a commit 8b70c7f
Show file tree
Hide file tree
Showing 51 changed files with 1,053 additions and 881 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test:
snakemake solve_all_networks -call --configfile config.tutorial.yaml configs/scenarios/config.NG.yaml
snakemake solve_all_networks_monte -call --configfile config.tutorial.yaml test/config.monte_carlo.yaml
snakemake solve_all_networks -call --configfile config.tutorial.yaml test/config.landlock.yaml
snakemake -c4 solve_sector_networks --configfile config.tutorial.yaml test/config.test1.yaml
snakemake -c4 solve_sector_networks --configfile config.tutorial.yaml test/config.sector.yaml
echo "All tests completed successfully."

setup:
Expand All @@ -24,5 +24,5 @@ clean:
snakemake -j1 solve_all_networks --delete-all-output --configfile config.tutorial.yaml configs/scenarios/config.NG.yaml
snakemake -j1 solve_all_networks_monte --delete-all-output --configfile test/config.monte_carlo.yaml
snakemake -j1 run_all_scenarios --delete-all-output --configfile test/config.landlock.yaml
snakemake -j1 solve_sector_networks --delete-all-output --configfile test/config.test1.yaml
snakemake -j1 solve_sector_networks --delete-all-output --configfile test/config.sector.yaml
echo "Clean-up complete."
687 changes: 317 additions & 370 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ rule prepare_ports:
rule prepare_airports:
params:
airport_sizing_factor=config["sector"]["airport_sizing_factor"],
airport_custom_data=config["custom_data"]["airports"],
output:
ports="resources/" + SECDIR + "airports.csv",
script:
Expand Down
11 changes: 10 additions & 1 deletion config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: CC0-1.0

version: 0.4.2
version: 0.5.0
tutorial: false

logging:
Expand Down Expand Up @@ -107,6 +107,7 @@ cluster_options:

build_shape_options:
gadm_layer_id: 1 # GADM level area used for the gadm_shapes. Codes are country-dependent but roughly: 0: country, 1: region/county-like, 2: municipality-like
simplify_gadm: true # When true, shape polygons are simplified else no
update_file: false # When true, all the input files are downloaded again and replace the existing files
out_logging: true # When true, logging is printed to console
year: 2020 # reference year used to derive shapes, info on population and info on GDP
Expand Down Expand Up @@ -481,6 +482,7 @@ custom_data:
custom_sectors: false
gas_network: false # If "True" then a custom .csv file must be placed in "resources/custom_data/pipelines.csv" , If "False" the user can choose btw "greenfield" or Model built-in datasets. Please refer to ["sector"] below.
export_ports: false # If "True" then a custom .csv file must be placed in "data/custom/export_ports.csv"
airports: false # If "True" then a custom .csv file must be placed in "data/custom/airports.csv". Data format for aiports must be in the format of the airports.csv file in the data folder.

industry:
reference_year: 2015
Expand Down Expand Up @@ -594,6 +596,13 @@ sector:
efficiency_heat_biomass_to_elec: 0.9
efficiency_heat_gas_to_elec: 0.9

electricity_distribution_grid: true # adds low voltage buses and shifts AC loads, BEVs, heat pumps, and resistive heaters, micro CHPs to low voltage buses if technologies are present
solar_rooftop: true # adds distribution side customer rooftop PV (only work if electricity_distribution_grid: true)
home_battery: true # adds home batteries to low voltage buses ((only work if electricity_distribution_grid: true)
transmission_efficiency:
electricity distribution grid:
efficiency_static: 0.97 # efficiency of distribution grid (i.e. 3% loses)

dynamic_transport:
enable: false # If "True", then the BEV and FCEV shares are obtained depending on the "Co2L"-wildcard (e.g. "Co2L0.70: 0.10"). If "False", then the shares are obtained depending on the "demand" wildcard and "planning_horizons" wildcard as listed below (e.g. "DF_2050: 0.08")
land_transport_electric_share:
Expand Down
2 changes: 1 addition & 1 deletion config.tutorial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: CC0-1.0

version: 0.4.2
version: 0.5.0
tutorial: true


Expand Down
2 changes: 2 additions & 0 deletions data/custom/airports.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
,ident,type,airport_size_nr,name,y,x,elevation_ft,continent,country,iso_region,municipality,scheduled_service,iata_code,length_ft,width_ft,surface,lighted,closed,Total_airport_size_nr,fraction
0,5A8,medium_airport,1,Aleknagik / New Airport,59.2826004028,-158.617996216,66.0,,US,US-AK,Aleknagik,yes,WKK,2040.0,80.0,GRVL-DIRT-F,0.0,0.0,633,0.001579778830963665
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
copyright = f"{datetime.datetime.today().year}, {author}"

# The full version, including alpha/beta/rc tags
release = "0.4.1"
release = "0.5.0"

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
Expand Down
19 changes: 10 additions & 9 deletions doc/configtables/build_shape_options.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
,Unit,Values,Description
gadm_layer_id,, "{0, 1, 2}", "GADM level area used for the gadm_shapes. Codes are country-dependent but roughly: 0: country, 1: region/county-like, 2: municipality-like."
update_file, bool, "{True, False}", "True: all input files are downloaded again and replace the existing files."
out_logging, bool, "{True, False}", "True: Logging is printed in the console."
year,, "past year; e.g. YYYY", "Reference year used to derive shapes, info on population and info on GDP."
nprocesses, int,, "Number of processes to be used in build_shapes."
worldpop_method,, "{""standard"", ""api"", false}", "Specifies how population is added to every shape: ""standard"" pulls from web 1kmx1km raster; ""api"" pulls from API 100mx100m raster; false (not ""false"") no population addition to shape. This is useful when generating only cutout."
gdp_method,, "{""standard"", false}", "Specifies how GDP is added to every shape: ""standard"" pulls from web 1x1km raster; false (not ""false"") no gdp addition to shape. This is useful when generating only cutout."
contended_flag,, "{""set_by_country"", ""drop""}", "Specifies what to do with contended countries: ""set_by_country"" assigns the contended areas to the countries according to the GADM database; ""drop"" drops the contended areas from the model."
,Unit,Values,Description,,,,
gadm_layer_id,,"""{0",1,"2}""","""GADM level area used for the gadm_shapes. Codes are country-dependent but roughly: 0: country",1: region/county-like,"2: municipality-like."""
simplify_gadm,bool," ""{True"," False}""",True: shape polygons are simplified else no,,,
update_file, bool," ""{True"," False}"""," ""True: all input files are downloaded again and replace the existing files.""",,,
out_logging, bool," ""{True"," False}"""," ""True: Logging is printed in the console.""",,,
year,," ""past year; e.g. YYYY"""," ""Reference year used to derive shapes"," info on population and info on GDP.""",,,
nprocesses, int,," ""Number of processes to be used in build_shapes.""",,,,
worldpop_method,," ""{""standard"""," ""api"""," false}""","""Specifies how population is added to every shape: ""standard"" pulls from web 1kmx1km raster; ""api"" pulls from API 100mx100m raster; false (not ""false"") no population addition to shape. This is useful when generating only cutout.""",,
gdp_method,," ""{""standard"""," false}""","""Specifies how GDP is added to every shape: ""standard"" pulls from web 1x1km raster; false (not ""false"") no gdp addition to shape. This is useful when generating only cutout.""",,,
contended_flag,," ""{""set_by_country"""," ""drop""}"""," ""Specifies what to do with contended countries: ""set_by_country"" assigns the contended areas to the countries according to the GADM database; ""drop"" drops the contended areas from the model.""",,,
60 changes: 40 additions & 20 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,46 @@ Release Notes
Upcoming release
================

Please add descriptive release notes like in `PyPSA-Eur <https://github.com/PyPSA/pypsa-eur/blob/master/doc/release_notes.rst>`__.
E.g. if a new rule becomes available describe how to use it `make test` and in one sentence what it does.
This part of documentation collects descriptive release notes to capture the main improvements introduced by developing the model before the next release.

**New Features and Major Changes**

* Include option in the config to allow for custom airport data `PR #1241 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1241>`__


**Minor Changes and bug-fixing**



PyPSA-Earth 0.5.0
=================

**New Features and Major Changes (14th December 2024)**

* Added capabilities of cross-sectoral modeling by merging with PyPSA-Earth-Sec model `https://github.com/pypsa-meets-earth/pypsa-earth-sec`__

* The workflow configuration now supports incremental changes to the default configuration in the `config.yaml` and configfiles passed to snakemake via `--configfile myconfig.yaml`. Therefore the user may now only include settings in their `config.yaml` which differ from the default configuration. One can think of the new `config.yaml` as of a list of arguments in a python function that already have a default. So in principle the `config.yaml` could now be empty, and the workflow would still run. `PR #1053 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1053>`__

* Local tests are now run with `make test`. This uses a `Makefile` which runs snakemake calls with different configurations. `PR #1053 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1053>`__
* Include option of endogenous export, which optimizes the export quantity based on price signals `PR #1201 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1201>`__

* Integrate RDIR into sector rules to store intermediate data in scenario folders `PR #1154 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1154>`__
* Remove elec-based H2 and battery technologies before addition in `prepare_sector_network.py` script and fix bus names for links that models H2 repuspose network `PR #1198 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1198>`__

* Add electricity distribution grid with solar rooftop and home battery technologies `PR #1221 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1221>`__

* Include a dedicated cutout for North America in bundle_config.yaml `PR #1121 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1121>`__

* Include a dedicated cutout for Europe in bundle_config.yaml `PR #1125 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1125>`__

* Include a dedicated cutout for Oceania in bundle_config.yaml `PR #1157 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1157>`__

* Removed duplications of devendencies in environment.yaml `PR #1128 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1128>`_
* Integrate RDIR into sector rules to store intermediate data in scenario folders `PR #1154 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1154>`__

* Use BASE_DIR in rules and `_helpers.py` script for facilitate module import in subworkflow `PR #1137 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1137>`__
* The computation of `hydro_profile.nc` in `build_renewable_profiles.py` is not differentiated whether alternative clustering is applied or not; the indexing of the different power plants in `add_electricity.py` is performed according to the bus either in case alternative clustering is applied or not and a `hydro_inflow_factor` is computed prior to the computation of `inflow_t` to split the inflow according to the capacity of each different unit of each power plant (if more units are present). `PR #1119 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1119>`__

* Use BASE_DIR in rules and `_helpers.py` script for facilitate module import in subworkflow `PR #1137 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1137>`__

* Enable sector rules import in subworkflow `PR #1178 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1178>`__

* Include option of endogenous export, which optimizes the export quantity based on price signals `PR #1201 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1201>`__

* Remove elec-based H2 and battery technologies before addition in `prepare_sector_network.py` script and fix bus names for links that models H2 repuspose network `PR #1198 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1198>`__

* Drop vrestil depenedncy `PR #1220 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1220>`__

**Minor Changes and bug-fixing**

* The default configuration for `electricity:estimate_renewable_capacities:year` was updated from 2020 to 2023. `PR #1106 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1106>`__
Expand All @@ -47,25 +57,37 @@ E.g. if a new rule becomes available describe how to use it `make test` and in o

* Enable configfile specification for mock_snakemake `PR #1135 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1135>`__

* Removed duplications of devendencies in environment.yaml `PR #1128 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1128>`__

* Fix pre-commit docformatter python issue. `PR #1153 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1153>`__

* Drop duplicate entries in `AL_production.csv` data used in `build_industry_demand` rule `PR #1143 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1143>`__

* The computation of `hydro_profile.nc` in `build_renewable_profiles.py` is not differentiated whether alternative clustering is applied or not; the indexing of the different power plants in `add_electricity.py` is performed according to the bus either in case alternative clustering is applied or not and a `hydro_inflow_factor` is computed prior to the computation of `inflow_t` to split the inflow according to the capacity of each different unit of each power plant (if more units are present). `PR #1119 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1119>`__

* Fix bugs in `prepare_sector_network.py` related to links with H2 buses and bug of re-addition of H2 and battery carriers in present `PR #1145 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1145>`__

* Drop entries that contain non-string elements in country column of `CO2_emissions_csv` data in `prepare_transport_data_input.py` script `PR #1166 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1166>`_
* Drop entries that contain non-string elements in country column of `CO2_emissions_csv` data in `prepare_transport_data_input.py` script `PR #1166 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1166>`__

* Local tests are now run with `make test`. This uses a `Makefile` which runs snakemake calls with different configurations. `PR #1053 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1053>`__

* Adds `Dependabot <https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide>`__ to keep GitHub actions up to date. `PR #1184 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1184>`__

* Adds code security scans via `CodeQL <https://codeql.github.com/>`__ to CI. `PR #1185 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1185>`__

* Adds CI to update keep pinned environment files up to date. `PR #1183 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1183>`__ and `PR #1210 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1210>`__

* Revise ports data for export in `add_export.py` related to sector model `PR #1175 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1175>`_
* Revise ports data for export in `add_export.py` related to sector model `PR #1175 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1175>`__

* Restore string values of tech_colors in config file `PR #1205 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1205>`__

* Drop vrestil dependency `PR #1220 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1220>`__

* Include a configuration option to simplify / not simplify shapefiles based on a boolean value specified under `build_shape_options:simplify_gadm` option in the config file `PR 1138 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1138>`_

* Fix the mismatch between buses and x, y locations while creating H2 Stores `PR #1134 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1134>`_

* Remove duplicate entries from hydrogen export ports `PR #1233 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1233>`__

* Restore string values of tech_colors in config file `PR #1205 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1205>`_
* Fix the environment placing a version limit to numpoly `PR #1237 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1237>`__

PyPSA-Earth 0.4.1
=================
Expand Down Expand Up @@ -498,9 +520,7 @@ Release Process

* Finalise release notes at ``doc/release_notes.rst``.

* Update ``envs/environment.fixed.yaml`` via
``conda env export -n pypsa-earth -f envs/environment.fixed.yaml --no-builds``
from an up-to-date `pypsa-earth` environment. Add license note at the top of the new yaml.
* Make sure thah pinned versions of the environments ``*-pinned.yaml`` in ``envs`` folder are up-to-date.

* Update version number in ``doc/conf.py`` and ``*config.*.yaml``.

Expand Down
4 changes: 3 additions & 1 deletion envs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dependencies:
- pytables
- lxml
- numpy
# starting from 1.3.5 numpoly requires numpy>2.0 which leads to issues
- numpoly<=1.3.4
- pandas
- geopandas>=0.11.0, <=0.14.3
- fiona<1.10.0
Expand Down Expand Up @@ -84,7 +86,7 @@ dependencies:
- gurobi

- pip:
- earth-osm>=2.2 # until conda release it out for earth-osm
- earth-osm==2.2 # until conda release it out for earth-osm
- git+https://github.com/davide-f/google-drive-downloader@master # google drive with fix for virus scan
- tsam>=1.1.0
- chaospy # lastest version only available on pip
Expand Down
Loading

0 comments on commit 8b70c7f

Please sign in to comment.