Skip to content

Commit

Permalink
config: add pre-commit yaml (#162)
Browse files Browse the repository at this point in the history
* config: add pre-commit yaml

* docs: modify release notes

* config: modify environment.yaml

* config: add ruff.toml

* code: initial pre-commit changes

* remove license

* config: new licence

* config: modify license

* change license for Makefile

* code: add license

* code : add licenses

* code: changes driven by linter

* data: update outputs

* change conf.py

* change conf.py - 2

* change license

* remove reuse compliance

* fix docs

* pin docs build requirements

---------

Co-authored-by: lkstrp <[email protected]>
  • Loading branch information
finozzifa and lkstrp authored Jan 13, 2025
1 parent 0abf81f commit 2a69b2e
Show file tree
Hide file tree
Showing 33 changed files with 3,264 additions and 2,117 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: PyPSA Mailing List
url: https://groups.google.com/forum/#!forum/pypsa
about: Please ask and answer general usage questions here.
- name: PyPSA Mailing List
url: https://groups.google.com/forum/#!forum/pypsa
about: Please ask and answer general usage questions here.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only

.snakemake
_build
Expand Down
4 changes: 3 additions & 1 deletion .gitignore.save
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only

.snakemake
_build
Expand Down
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only
exclude: "^LICENSES"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=2000"]

# Run ruff to lint and format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.6
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format

# Find common spelling mistakes in comments and docstrings
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ['--ignore-regex="(\b[A-Z]+\b)"', '--ignore-words-list=fom,appartment,bage,ore,setis,tabacco,berfore,vor,pris,WEGE,Wege,Eletricity'] # Ignore capital case words, e.g. country codes
types_or: [python, rst, markdown]
files: ^(scripts|doc)/

# YAML formatting
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-yaml
exclude: pinned\.yaml$
args: [--autofix, --indent, "2", --preserve-quotes]

# Format Snakemake rule / workflow files
- repo: https://github.com/snakemake/snakefmt
rev: v0.10.2
hooks:
- id: snakefmt
7 changes: 7 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only

version: 2

sphinx:
configuration: docs/conf.py

build:
os: ubuntu-22.04
tools:
Expand Down
4 changes: 4 additions & 0 deletions .syncignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only

.snakemake
.git
.pytest_cache
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<!--
SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
SPDX-License-Identifier: GPL-3.0-only
-->

![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/pypsa/technology-data?include_prereleases)
[![Documentation](https://readthedocs.org/projects/technology-data/badge/?version=latest)](https://technology-data.readthedocs.io/en/latest/?badge=latest)
![Licence](https://img.shields.io/github/license/pypsa/technology-data)
Expand Down
62 changes: 36 additions & 26 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only


configfile: "config.yaml"


rule compile_cost_assumptions:
input:
inflation_rate = "inputs/prc_hicp_aind__custom_9928419_spreadsheet.xlsx",
pypsa_costs = "inputs/costs_PyPSA.csv",
fraunhofer_costs = "inputs/Fraunhofer_ISE_costs.csv",
fraunhofer_energy_prices = "inputs/Fraunhofer_ISE_energy_prices.csv",
fraunhofer_vehicles_costs = "inputs/Fraunhofer_ISE_vehicles_costs.csv",
EWG_costs = "inputs/EWG_costs.csv",
dea_transport = "inputs/energy_transport_data_sheet_dec_2017.xlsx",
dea_vehicles = "inputs/data_sheets_for_commercial_freight_and_passenger_transport_0.xlsx",
dea_renewable_fuels = "inputs/data_sheets_for_renewable_fuels.xlsx",
dea_storage = "inputs/technology_data_catalogue_for_energy_storage.xlsx",
dea_generation = "inputs/technology_data_for_el_and_dh.xlsx",
dea_heating = "inputs/technologydatafor_heating_installations_marts_2018.xlsx",
dea_industrial = "inputs/technology_data_for_industrial_process_heat.xlsx",
dea_ship = "inputs/data_sheets_for_maritime_commercial_freight_and_passenger_transport.xlsx",
dea_ccts = "inputs/technology_data_for_carbon_capture_transport_storage.xlsx",
pnnl_energy_storage = "inputs/pnnl-energy-storage-database.xlsx",
manual_input = "inputs/manual_input.csv"
inflation_rate="inputs/prc_hicp_aind__custom_9928419_spreadsheet.xlsx",
pypsa_costs="inputs/costs_PyPSA.csv",
fraunhofer_costs="inputs/Fraunhofer_ISE_costs.csv",
fraunhofer_energy_prices="inputs/Fraunhofer_ISE_energy_prices.csv",
fraunhofer_vehicles_costs="inputs/Fraunhofer_ISE_vehicles_costs.csv",
EWG_costs="inputs/EWG_costs.csv",
dea_transport="inputs/energy_transport_data_sheet_dec_2017.xlsx",
dea_vehicles="inputs/data_sheets_for_commercial_freight_and_passenger_transport_0.xlsx",
dea_renewable_fuels="inputs/data_sheets_for_renewable_fuels.xlsx",
dea_storage="inputs/technology_data_catalogue_for_energy_storage.xlsx",
dea_generation="inputs/technology_data_for_el_and_dh.xlsx",
dea_heating="inputs/technologydatafor_heating_installations_marts_2018.xlsx",
dea_industrial="inputs/technology_data_for_industrial_process_heat.xlsx",
dea_ship="inputs/data_sheets_for_maritime_commercial_freight_and_passenger_transport.xlsx",
dea_ccts="inputs/technology_data_for_carbon_capture_transport_storage.xlsx",
pnnl_energy_storage="inputs/pnnl-energy-storage-database.xlsx",
manual_input="inputs/manual_input.csv",
output:
expand("outputs/costs_{year}.csv", year = config["years"])
expand("outputs/costs_{year}.csv", year=config["years"]),
threads: 1
resources: mem=500
conda: "environment.yaml"
script: "scripts/compile_cost_assumptions.py"
resources:
mem=500,
conda:
"environment.yaml"
script:
"scripts/compile_cost_assumptions.py"


# rule convert_fraunhofer:
Expand All @@ -43,10 +50,13 @@ rule compile_cost_assumptions:

rule convert_EWG:
input:
EWG = "docu/EWG_LUT_100RE_All_Sectors_Global_Report_2019.pdf"
EWG="docu/EWG_LUT_100RE_All_Sectors_Global_Report_2019.pdf",
output:
costs = "inputs/EWG_costs.csv",
costs="inputs/EWG_costs.csv",
threads: 1
resources: mem=500
conda: "environment.yaml"
script: "scripts/convert_pdf_EWG_to_dataframe.py"
resources:
mem=500,
conda:
"environment.yaml"
script:
"scripts/convert_pdf_EWG_to_dataframe.py"
28 changes: 16 additions & 12 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only

version: 0.9.2

# considered years for output data
years : [2020, 2025, 2030, 2035, 2040, 2045, 2050]
years: [2020, 2025, 2030, 2035, 2040, 2045, 2050]

expectation : "" # tech data uncertainty, possible options [None, "optimist", "pessimist"]
expectation: "" # tech data uncertainty, possible options [None, "optimist", "pessimist"]

#year for EUR outputs
eur_year : 2020
eur_year: 2020

# add solar from different source
solar_utility_from_vartiaien : false
solar_rooftop_from_etip : false
solar_utility_from_vartiaien: false
solar_rooftop_from_etip: false

energy_storage_database:
h2_from_budischak: false # add fuel cell/electrolysis efficiencies from Budischak (DEA assumptions very conservative)
ewg_home_battery: true # add home battery data derived from DEA data and EWG study
pnnl_energy_storage:
add_data: true # add storage data mainly from PNNL
approx_beyond_2030: ["same_as_2030"] # ["geometric_series"] or ["same_as_2030"]
h2_from_budischak: false # add fuel cell/electrolysis efficiencies from Budischak (DEA assumptions very conservative)
ewg_home_battery: true # add home battery data derived from DEA data and EWG study
pnnl_energy_storage:
add_data: true # add storage data mainly from PNNL
approx_beyond_2030: ["same_as_2030"] # ["geometric_series"] or ["same_as_2030"]

# remove grid connection costs from DEA for offwind because they are calculated
# separately in pypsa-eur
offwind_no_gridcosts : true
offwind_no_gridcosts: true

desalination:
salinity: 35 # in PSU (Practical Salinity Unit) = kg/m^3
salinity: 35 # in PSU (Practical Salinity Unit) = kg/m^3

ndigits: 4
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
#
# SPDX-License-Identifier: GPL-3.0-only

# Makefile for Sphinx documentation
#

Expand Down
5 changes: 5 additions & 0 deletions docs/addnew.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
..
SPDX-FileCopyrightText: Contributors to technology-data <https://github.com/pypsa/technology-data>
SPDX-License-Identifier: GPL-3.0-only

.. _addnew:

##########################################
Expand Down
Loading

0 comments on commit 2a69b2e

Please sign in to comment.