-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from calliope-project/feature-templates
Feature: templates for modules and wrappers
- Loading branch information
Showing
37 changed files
with
276 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,5 @@ out/ | |
output/ | ||
tmp/ | ||
results/ | ||
report/ | ||
|
||
!modules/_example_module/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module_name: | ||
type: str | ||
help: What is your module's name? | ||
placeholder: transport_road | ||
validator: >- | ||
{% if not (module_name | regex_search('^[a-z][a-z0-9_]+$')) %} | ||
"Must be a single word in lowercase. Letters, digits and underscores are valid characters." | ||
{% endif %} | ||
module_description: | ||
type: str | ||
help: Please give a brief sentence describing your module. | ||
placeholder: A module to estimate energy demand of road vehicles at a subnational level. | ||
author_name: | ||
type: str | ||
help: We auto-generate an MIT license for you. Please provide your full name. | ||
placeholder: Laura Patricia Orellana | ||
author_institution: | ||
type: str | ||
help: We auto-generate an MIT license for you. Please provide the name of your institution. | ||
placeholder: TU Delft | ||
author_email: | ||
type: str | ||
help: We auto-generate an MIT license for you. Please provide an email address. | ||
placeholder: yourname@university.edu | ||
validator: >- | ||
{% if not (author_email | regex_search('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')) %} | ||
"This email does not seem valid... did you forget to add a dot?" | ||
{% endif %} | ||
year: | ||
type: str | ||
help: We auto-generate an MIT license for you. What year is this? | ||
placeholder: "2024" |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Authors | ||
|
||
This is the list of contributors to the '{{module_name}}' module for copyright purposes. | ||
|
||
- {{author_name}}, {{author_institution}} <{{author_email}}> | ||
|
||
This does not necessarily list everyone who has contributed to the '{{module_name}}' module code or documentation. | ||
For a full contributor list, see: | ||
|
||
<https://github.com/calliope-project/ec_modules/commits/main/modules/{{module_name}}> |
2 changes: 1 addition & 1 deletion
2
modules/_template/LICENSE → ...s/_template/{{module_name}}/LICENSE.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Easy Energy Modules - {{module_name}} | ||
|
||
{{module_description}} | ||
|
||
## Input-Ouput | ||
|
||
Here is a brief IO diagram of the module's operation. | ||
|
||
```mermaid | ||
--- | ||
title: {{module_name}} | ||
--- | ||
flowchart LR | ||
D1[("`**Databases** | ||
database1 | ||
... | ||
`")] --> |Download| M | ||
C1[/"`**User input** | ||
shapefile.geojson | ||
... | ||
`"/] --> |Resources| M(({{module_name}})) | ||
M --> O1(" | ||
output1.csv | ||
") | ||
M --> O2(" | ||
output2.nc | ||
") | ||
``` | ||
|
||
## DAG | ||
|
||
Here is a brief example of the module's steps. | ||
|
||
![DAG](rulegraph.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Module input files by users go here. | ||
resources: | ||
download: True | ||
shapefile: "resources/shapefile.geojson" | ||
# Any other user configuration goes below |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
modules/_template/{{module_name}}/workflow/Snakefile.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import yaml | ||
|
||
from snakemake.utils import min_version, validate | ||
|
||
# Limit the snakemake version to a modern one. | ||
min_version("8.10") | ||
|
||
# Load the default configuration. This will be overridden by users. | ||
configfile: "config/default.yaml" | ||
# Validate the configuration using the schema file. | ||
validate(config, workflow.source_path("schemas/config.schema.yaml")) | ||
|
||
# Load internal settings separately so users cannot modify them. | ||
with open(workflow.source_path("resources/internal_config.yaml"), "r") as f: | ||
internal = yaml.safe_load(f) | ||
|
||
# Add all your includes here. | ||
include: "rules/downloads.smk" | ||
|
||
rule all: | ||
message: "Generate all outputs for '{{module_name}}'." | ||
input: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ channels: | |
- conda-forge | ||
- nodefaults | ||
dependencies: | ||
- curl=8.6.0 | ||
- curl=8.9.1 | ||
- unzip=6.0 | ||
- rsync=3.2.3 |
Oops, something went wrong.