Commit Graph

60 Commits

Author SHA1 Message Date
Fabian Neumann
43f226b2a3 split solve network rules, take summary scripts from Sec 2023-03-06 12:10:23 +01:00
Fabian Neumann
97bbafdd70 Merge remote-tracking branch 'pypsa-eur-sec/master' into merge-pypsa-eur-sec 2023-03-06 11:54:08 +01:00
Fabian Neumann
604d086016 resolve merge conflict 2023-03-06 09:46:56 +01:00
Fabian Neumann
9dbeea17ec fix: handle overlooked merge conflict 2023-03-06 09:45:28 +01:00
pre-commit-ci[bot]
d0e0880b19 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-03-06 08:43:17 +00:00
Fabian Neumann
ad6a490f57 resolve merge conflict 2023-03-06 09:39:10 +01:00
Fabian Neumann
5f61bc4bae fix isort compatibility 2023-03-06 09:35:40 +01:00
pre-commit-ci[bot]
13769f90af [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-03-06 08:27:46 +00:00
virio-andreyana
f75cec93d6
lower log level in plot_summary.py and fix warning
reduce the level of "Dropping technology energy balance smaller than {snakemake.config['plotting']['energy_threshold']/10} {units}" and "Total energy balance for {v} of {round(df.sum()[0],2)} {units}" from INFO-> DEBUG. 

Extra warning fix
Add `plt.cla()` in the `for k, v in balances.items()` and take out fig, ax = plt.subplots(figsize=(12,8)) from that for loop to fix RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
2023-03-01 12:29:36 +01:00
virio-andreyana
379ed0da93 Sentence capitalized 2023-02-24 14:42:51 +01:00
virio-andreyana
d237e60b25 Replacing print statement with logging 2023-02-23 10:30:32 +01:00
Fabian Neumann
9c1182fe96 prepare release 0.7 2023-02-16 11:50:55 +01:00
Fabian
df4eb85a19 fix typos 2022-11-18 09:08:07 +01:00
Fabian Neumann
1611d63a8a
Merge branch 'master' into nh3 2022-10-01 16:01:39 +02:00
nnhjy
d29441d871 update deprecated syntax 2022-09-28 20:33:50 +02:00
pre-commit-ci[bot]
5d1ef8a640 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-09-16 13:04:06 +00:00
lisazeyen
a11f7bc245 remove not needed pop_layout from plot_summary 2022-08-02 08:47:46 +02:00
lisazeyen
f683a93f08 adjust plot_summary to work with myopic, remove update config 2022-08-01 16:04:14 +02:00
Fabian Neumann
a1507124f6 Merge branch 'release-v0.5' into meta 2022-07-27 09:43:36 +02:00
Fabian Neumann
8fc0c57ed6 update copyright years 2022-07-26 15:05:59 +02:00
Fabian Neumann
cb00ba58ce add option to specify any config through sector opts with CF:<label>:...:value 2022-07-20 11:35:12 +02:00
Fabian Neumann
217780263d store config and wildcards in n.meta 2022-06-30 08:39:03 +02:00
Fabian Neumann
9f91af28e7 fix syntax errors 2022-06-23 15:17:41 +02:00
Fabian Neumann
2d562c1349 add coloring for ammonia 2022-06-10 14:57:03 +02:00
martacki
cd92d8092b plot_summary: remove deprecated retrieve_snakemake_keys function 2022-06-08 15:49:06 +02:00
martacki
0da77a7600 remove snakemake dependencies in plot_summary 2022-01-14 13:44:33 +01:00
Fabian Neumann
37e2e53486
Merge branch 'master' into retrofit-gas-pipelines 2021-11-02 19:03:26 +01:00
Fabian Neumann
d26dbcb7fd plot: correct h2 map legend overlap, change aggregation of techs 2021-10-23 21:16:05 +02:00
Fabian Neumann
2e02af8b4b change license 2021-09-14 16:37:41 +02:00
martavp
fab31e6524
Exogenous transition path for shipping, Steel, and Aluminum production (#136)
* Update .gitignore

* Add fictitious load to account for non-transformed shipping emissions

The share of shipping demand that is transformed is defined now for different years to be used with the myopic code.
The carbon emission from the remaining share is treated as a negative load on the atmospheric carbon dioxide bus, just like aviation and land transport emissions.

* Split colours for H2 in Industry and H2 in shipping when plotting balances.

When plotting the balance for H2, the rename dictionary merges all the demands containing H2.
This commit disables such merging and keeps different colours for H2 in shipping and H2 in industry. This is useful when one wants to look at the H2 balance and have an overview of where the H2 is consumed in the model.

* Make transformation of Steel and Aluminum production depends on year

Previously, the transformation of the Steel and Aluminum production was assumed to occur overnight.
This commit enables the definition of a transformation path via the config.yaml file.
This requires adding the {planning_horizon} to the input and output file name of the following rules:
build_industrial_production_per_country_tomorrow
build_industrial_production_per_node
build_industry_energy_demand_per_node
prepare_sector_network

* small follow-up to merge

* Add oil consumed in shipping as a load to EU oil bus

* Update scripts/prepare_sector_network.py

* add planning_horizons wildcard to benchmark paths

* fixup: double fraction_primary for steel

Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-08-04 18:19:02 +02:00
Fabian Neumann
89eccd4f70 merge master 2021-07-02 15:00:19 +02:00
Fabian Neumann
1fc1d2a17d
Revision complete (#139)
* ammonia_production: minor cleaning and move into __main__ (#106)

* biomass_potentials: code cleaning and automatic country index inferral (#107)

* Revision: build energy totals (#111)

* blacken

* energy_totals: preliminaries

* energy_totals: update build_swiss

* energy_totals: update build_eurostat

* energy_totals: update build_idees

* energy_totals: update build_energy_totals

* energy_totals: update build_eea_co2

* energy_totals: update build_eurostat_co2

* energy_totals: update build_co2_totals

* energy_totals: update build_transport_data

* energy_totals: add tqdm progressbar to idees

* energy_totals: adjust __main__ section

* energy_totals: handle inputs via Snakefile and config

* energy_totals: handle data and emissions year via config

* energy_totals: fix reading in eurostat for different years

* energy_totals: fix erroneous drop duplicates
This caused problems for waste management in HU and SI

* energy_totals: make scope selection of CO2 or GHG a config option

* Revision: build industrial production per country (#114)

* industry-ppc: format

* industry-ppc: rewrite for performance

* industry-ppc: move reference year to config

* industry-ppct: tidy up and format (#115)

* remove stale industry demand rules (#116)

* industry-epc: rewrite for performance (#117)

* Revision: industrial distribution key (#118)

* industry-distribution: first tidying

* industry-distribution: first tidying

* industry-distribution: fix syntax

* Revision: industrial energy demand per node today (#119)

* industry-epn: minor code cleaning

* industry-epn: remove accidental artifact

* industry-epn: remove accidental artifact II

* industry-ppn: code cleaning (#120)

* minor code cleaning (#121)

* Revision: industry sector ratios (#122)

* sector-ratios: basic reformatting

* sector-ratios: add new read_excel function that filters year already

* sector-ratios: rename jrc to idees

* sector-ratios: rename conv_factor to toe_to_MWh

* sector-ratios: modularise into functions

* Move overriding of component attributes to function and into data (#123)

* move overriding of component attributes to central function and store in separate folder

* fix return of helper.override_component_attrs

* prepare: fix accidental syntax error

* override_component_attrs: bugfix that aligns with pypsa components

* Revision: build population layout (#108)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* config: change path to atlite cutout

* Revision: build clustered population layouts (#112)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* cl_pop_layout: blacken

* cl_pop_layout: turn GeoDataFrame into GeoSeries + code cleaning

* cl_pop_layout: add fraction column which is repeatedly calculated downstream

* Revision: build various heating-related time series (#113)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* cl_pop_layout: blacken

* cl_pop_layout: turn GeoDataFrame into GeoSeries + code cleaning

* gitignore: add .vscode

* heating_profiles: update to new atlite and move into __main__

* heating_profiles: remove extra cutout

* heating_profiles: load regions with .buffer(0) and remove clean_invalid_geometries

* heating_profiles: load regions with .buffer(0) before squeeze()

* heating_profiles: account for transpose of dataarray

* heating_profiles: account for transpose of dataarray in add_exiting_baseyear

* Reduce verbosity of Snakefile (2) (#128)

* tidy Snakefile light

* Snakefile: fix indents

* Snakefile: add missing RDIR

* tidy config by removing quotes and expanding lists (#109)

* bugfix: reorder squeeze() and buffer()

* plot/summary: cosmetic changes including: (#131)

- matplotlibrc for default style and backend
- remove unused config options
- option to configure geomap colors
- option to configure geomap bounds

* solve: align with pypsa-eur using ilopf (#129)

* tidy myopic code scripts (#132)

* use mock_snakemake from pypsa-eur (#133)

* Snakefile: add benchmark files to each rule

* Snakefile: only run build_retro_cost if endogenously optimised

* Snakefile: remove old {network} wildcard constraints

* WIP: Revision: prepare_sector_network (#124)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* cl_pop_layout: blacken

* cl_pop_layout: turn GeoDataFrame into GeoSeries + code cleaning

* move overriding of component attributes to central function and store in separate folder

* prepare: sort imports and remove six dependency

* prepare: remove add_emission_prices

* prepare: remove unused set_line_s_max_pu
This is a function from prepare_network

* prepare: remove unused set_line_volume_limit
This is a PyPSA-Eur function from prepare_network

* prepare: tidy add_co2limit

* remove six dependency

* prepare: tidy code first batch

* prepare: extend override_component_attrs to avoid hacky madd

* prepare: remove hacky madd() for individual components

* prepare: tidy shift function

* prepare: nodes and countries from n.buses not pop_layout

* prepare: tidy loading of pop_layout

* prepare: fix prepare_costs function

* prepare: optimise loading of traffic data

* prepare: move localizer into generate_periodic profiles

* prepare: some formatting of transport data

* prepare: eliminate some code duplication

* prepare: fix remove_h2_network
- only try to remove EU H2 store if it exists
- remove readding nodal Stores because they are never removed

* prepare: move cost adjustment to own function

* prepare: fix a syntax error

* prepare: add investment_year to get() assuming global variable

* prepare: move co2_totals out of prepare_data()

* Snakefile: remove unused prepare_sector_network inputs

* prepare: move limit p/s_nom of lines/links into function

* prepare: tidy add_co2limit file handling

* Snakefile: fix tabs

* override_component_attrs: add n/a defaults

* README: Add network picture to make scope clear

* README: Fix date of preprint (was too optimistic...)

* prepare: move some more config options to config.yaml

* prepare: runtime bugfixes

* fix benchmark path

* adjust plot ylims

* add unit attribute to bus, correct cement capture efficiency

* bugfix: land usage constrained missed inplace operation

Co-authored-by: Tom Brown <tom@nworbmot.org>

* add release notes

* remove old fix_branches() function

* deps: make geopy optional, remove unused imports

* increase default BarConvTol

* get ready for upcoming PyPSA release

* re-remove ** bug

* amend release notes

Co-authored-by: Tom Brown <tom@nworbmot.org>
2021-07-01 20:09:04 +02:00
lisazeyen
97f041e82c adjust summary and plot functions 2021-06-21 12:36:40 +02:00
Leon
e367f8ae11
Fix error when running without the industry sector (#96)
Fixing that the code stops with an error if running without the industry sector, e.g. only including electricity and heat. When the industry sector is not included, balances_df.index.levels[0] does not include "process emissions". Using the XOR operator "^" does then add it instead of removing it when compared to the co2_carriers list. The XOR operator does only work as intended, i.e. excluding the three emission-related strings, when these strings are already in the original list. The proposed change fixes the issue.
2021-05-24 22:11:24 +02:00
Fabian Neumann
3e3001455a
address FutureWarning regarding set operations on pd.Index (#103) 2021-04-29 17:11:10 +02:00
martavp
e180931ce1 Move ploting of carbon budget distribution to plot_summary.py 2021-01-14 10:06:29 +01:00
Tom Brown
608c9a5ac5 Replace gas and solid biomass CHP CCS with CHP + DEA CC
Use DEA assumptions for post-combustion carbon capture.

Also rename CCS as CC whenever only carbon capture is involved, since
sequestration (or CCU) is a separate step.
2020-12-09 16:38:49 +01:00
Fabian Neumann
2fc1ea0255
some refactoring and code cleaning (#190)
* some refactoring and code cleaning

* execute pre-commit

* pre-commit: limit large files

* add license to .pre-commit

* add pre-commit to env

* solve: tidy memory logger

* travis: add conda list for easier debugging

* undo config test/tutorial without plotting, rm matplotlibrc, .licenses

* remove {networks} wildcard

* unadd pre-commit config

* add release notes

* restore REUSE compliance

* fix docs environment python version

* env: remove gurobi from dependencies

* fix unclean merge block

* fix elif to if

* lighter rtd style

* lighter rtd style II
2020-12-03 19:50:53 +01:00
Tom Brown
abbaa0d098 Move CO2 budgets from data/co2_budget.csv to dict in config.yaml
Strategy is too keep as much of configuration in config.yaml as
possible.

We also aim to allow exogenous investment-year-dependent
configurations to be done in a similar manner (e.g. share of district
heating or FCEV transport).
2020-11-30 13:21:38 +01:00
lisazeyen
7fe7dc381f read config.yaml for testing with yaml.safe_load() 2020-09-22 09:32:24 +02:00
Tom Brown
515416fd75 PyPSA-Eur-Sec Version 0.2.0
Please see the release notes:

https://pypsa-eur-sec.readthedocs.io/en/latest/release_notes.html#pypsa-eur-sec-0-2-0-21st-august-2020

for more information.
2020-08-21 12:34:20 +02:00
Tom Brown
beefb57c25 Fix plotting of maps and balances; move log/benchmark to results/ 2020-08-21 12:15:01 +02:00
martavp
201e4d2f57 simplify make_summary and plot_summary since now overnight also includes planning_horizons and carbon_budget_name 2020-07-08 16:35:50 +02:00
martavp
8c53506897 include dependence of the number of header lines in csv files based on if overnigh or mypic option is selected 2020-07-07 18:46:12 +02:00
Fabian Neumann
5ea29551b9
add REUSE.software license information (#160)
* add REUSE.software license information

* add release note on licensing

* Update doc/index.rst

Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>

* Update doc/index.rst

Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>

* Update doc/release_notes.rst [skip travis]

Co-authored-by: euronion <42553970+euronion@users.noreply.github.com>
2020-05-29 09:50:55 +02:00
Tom Brown
2bee13fe40 plot_summary: Plot energy / CO2 balances for each carrier
Take data from supply_energy.csv and plot the balances for each
carrier.

One summary for energy excludes CO2 flows (unlike graphs/energy.pdf).
2020-05-13 13:40:00 +02:00
Tom Brown
eb2fa1b24e Adjust plotting for new CCS scheme 2019-12-19 11:39:38 +01:00
FabianHofmann
eaf30a9b65
Introduce mocksnakemake which acutally parses Snakefile (#107)
* rewrite mocksnakemake for parsing real Snakefile

* continue add function to scripts

* going through all scripts, setting new mocksnakemake

* fix plotting scripts

* fix build_country_flh

* fix build_country_flh II

* adjust config files

* fix make_summary for tutorial network

* create dir also for output

* incorporate suggestions

* consistent import of mocksnakemake

* consistent import of mocksnakemake II

* Update scripts/_helpers.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* Update scripts/_helpers.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* Update scripts/_helpers.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* Update scripts/_helpers.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* Update scripts/plot_network.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* Update scripts/plot_network.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* Update scripts/retrieve_databundle.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* use pathlib for mocksnakemake

* rename mocksnakemake into mock_snakemake

* revert change in data

* Update scripts/_helpers.py

Co-Authored-By: euronion <42553970+euronion@users.noreply.github.com>

* remove setting logfile in mock_snakemake, use Path in configure_logging

* fix fallback path and base_dir
fix return type of make_io_accessable

* reformulate mock_snakemake

* incorporate suggestion, fix typos

* mock_snakemake: apply absolute paths again, add assertion error
*.py: make hard coded io path accessable for mock_snakemake

* retrieve_natura_raster: use snakemake.output for fn_out

* include suggestion

* Apply suggestions from code review

Co-Authored-By: Jonas Hörsch <jonas.hoersch@posteo.de>

* linting, add return ad end of file

* Update scripts/plot_p_nom_max.py

Co-Authored-By: Jonas Hörsch <jonas.hoersch@posteo.de>

* Update scripts/plot_p_nom_max.py

fixes #112

Co-Authored-By: Jonas Hörsch <jonas.hoersch@posteo.de>

* plot_p_nom_max: small correction

* config.tutorial.yaml fix snapshots end

* use techs instead of technology

* revert try out from previous commit, complete replacing

* change clusters -> clusts in plot_p_nom_max due to wildcard constraints of clusters

* change clusters -> clusts in plot_p_nom_max due to wildcard constraints of clusters II
2019-12-09 21:29:15 +01:00
euronion
85c356297a Add logging to logfiles to all snakemake workflow scripts. (#102)
* Add logging to logfiles to all snakemake workflow scripts.

* Fix missing quotation marks in Snakefile.

* Apply suggestions from code review

Co-Authored-By: Fabian Neumann <fabian.neumann@outlook.de>

* Apply suggestions from code review

Co-Authored-By: Fabian Neumann <fabian.neumann@outlook.de>

* doc: fix _ec_ filenames in docs

* Allow logging message format to be specified in config.yaml.

* Add logging for Snakemake rule 'retrieve_databundle '.

* Add limited logging to STDERR only for retrieve_*.py scripts.

* Import progressbar module only on demand.

* Fix logging to file and enable concurrent printing to STDERR for most scripts.

* Add new 'logging_format' option to Travis CI test config.yaml.

* Add missing parenthesis (bug fix) and cross-os compatible paths.

* Fix typos in messages.

* Use correct log files for logging (bug fix).

* doc: fix line references

* config: logging_format in all configs

* doc: add doc for logging_format

* environment: update to powerplantmatching 0.4.3

* doc: update line references for tutorial.rst

* Change logging configuration scheme for config.yaml.

* Add helper function for doing basic logging configuration.

* Add logpath for prepare_links_p_nom rule.

* Outsource basic logging configuration for all scripts to _helper submodule.

* Update documentation for changed config.yaml structure.

Instead of 'logging_level' and 'logging_format', now 'logging' with subcategories is used.

* _helpers: Change configure_logging signature.
2019-11-28 08:22:52 +01:00
Fabian Neumann
a5d9bc9c7c add input/output descriptions (WIP) 2019-08-11 22:34:18 +02:00