Skip to content

Commit

Permalink
Merge branch 'update_docs' of https://github.com/ekatef/pypsa-distrib…
Browse files Browse the repository at this point in the history
…ution into update_docs
  • Loading branch information
ekatef committed Apr 23, 2024
2 parents 28b7fc1 + 69f4ea1 commit 0a0d360
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

## Checklist

- [ ] I consent to the release of this PR's code under the GPLv3 license and non-code contributions under CC0-1.0 and CC-BY-4.0.
- [ ] I tested my contribution locally and it seems to work fine.
- [ ] Code and workflow changes are sufficiently documented.
- [ ] Newly introduced dependencies are added to the main environment at [PyPSA-Earth repository](https://github.com/pypsa-meets-earth/pypsa-earth)
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:

# Formatting with "black" coding style
- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.3.0
hooks:
# Format Python files
- id: black
Expand All @@ -45,14 +45,14 @@ repos:

# Do YAML formatting (before the linter checks it for misses)
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.13.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --preserve-quotes]

# Use yamllint to check for valid YAML files and list syntax errors
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.34.0
rev: v1.35.1
hooks:
- id: yamllint
args: [--format, parsable, -c=.yamllint]
Expand Down
27 changes: 20 additions & 7 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from snakemake.io import expand
from build_test_configs import create_test_config
from os.path import normpath, exists, isdir
from shutil import copyfile
from _helpers import create_country_list

import sys

Expand All @@ -21,6 +22,8 @@ HTTP = HTTPRemoteProvider()
COSTS = "data/costs.csv"
PROFILE = "data/sample_profile.csv"

PYPSAEARTH_FOLDER = "pypsa-earth"

if "config" not in globals() or not config: # skip when used as sub-workflow
if not exists("config.yaml"):
# prepare pypsa-earth config
Expand All @@ -31,6 +34,8 @@ if "config" not in globals() or not config: # skip when used as sub-workflow

configfile: "config.yaml"

config["countries"] = create_country_list(config["countries"])


ATLITE_NPROCESSES = config["atlite"].get("nprocesses", 5)

Expand All @@ -44,13 +49,21 @@ wildcard_constraints:
discountrate="[-+a-zA-Z0-9\.\s]*",


subworkflow pypsaearth:
workdir:
"./pypsa-earth"
snakefile:
"./pypsa-earth/Snakefile"
configfile:
"./config.yaml"
if not config.get("disable_subworkflow", False):

subworkflow pypsaearth:
workdir:
PYPSAEARTH_FOLDER
snakefile:
PYPSAEARTH_FOLDER + "/Snakefile"
configfile:
"./config.pypsa-earth.yaml"


if config.get("disable_subworkflow", False):

def pypsaearth(path):
return PYPSAEARTH_FOLDER + "/" + path


rule clean:
Expand Down
3 changes: 3 additions & 0 deletions config.distribution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ logging:
level: INFO
format: "%(levelname)s:%(name)s:%(message)s"

# option to disable the subworkflow to ease the analyses
disable_subworkflow: false

scenario:
simpl: ['']
ll: ['copt']
Expand Down

0 comments on commit 0a0d360

Please sign in to comment.