Skip to content

Commit 58ec53c

Browse files
committed
initial commit
0 parents  commit 58ec53c

14 files changed

+564
-0
lines changed

.github/workflows/deploy.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: deploy
2+
3+
on:
4+
# Trigger the workflow on push to main branch
5+
push:
6+
branches:
7+
- main
8+
9+
# This job installs dependencies, build the book, and pushes it to `gh-pages`
10+
jobs:
11+
build-and-deploy-book:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
python-version: [3.8]
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
# Install dependencies
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
pip install -r requirements.txt
28+
29+
# Build the book
30+
- name: Build the book
31+
run: |
32+
jupyter-book build data-science-for-esm
33+
34+
# Deploy the book's HTML to gh-pages branch
35+
- name: GitHub Pages action
36+
uses: peaceiris/[email protected]
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
publish_dir: data-science-for-esm/_build/html

CONDUCT.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
# Code of Conduct
3+
4+
## Our Pledge
5+
6+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
7+
8+
## Our Standards
9+
10+
Examples of behavior that contributes to creating a positive environment include:
11+
12+
* Using welcoming and inclusive language
13+
* Being respectful of differing viewpoints and experiences
14+
* Gracefully accepting constructive criticism
15+
* Focusing on what is best for the community
16+
* Showing empathy towards other community members
17+
18+
Examples of unacceptable behavior by participants include:
19+
20+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
21+
* Trolling, insulting/derogatory comments, and personal or political attacks
22+
* Public or private harassment
23+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
24+
* Other conduct which could reasonably be considered inappropriate in a professional setting
25+
26+
## Our Responsibilities
27+
28+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
29+
30+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
31+
32+
## Scope
33+
34+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
35+
36+
## Enforcement
37+
38+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
39+
40+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
41+
42+
## Attribution
43+
44+
This Code of Conduct is adapted from the [Contributor Covenant, version 1.4](http://contributor-covenant.org/version/1/4).

CONTRIBUTING.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Contributing
2+
3+
Contributions are welcome, and they are greatly appreciated! Every little bit
4+
helps, and credit will always be given. You can contribute in the ways listed below.
5+
6+
## Report Bugs
7+
8+
Report bugs using GitHub issues.
9+
10+
If you are reporting a bug, please include:
11+
12+
* Your operating system name and version.
13+
* Any details about your local setup that might be helpful in troubleshooting.
14+
* Detailed steps to reproduce the bug.
15+
16+
## Fix Bugs
17+
18+
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
19+
wanted" is open to whoever wants to implement it.
20+
21+
## Implement Features
22+
23+
Look through the GitHub issues for features. Anything tagged with "enhancement"
24+
and "help wanted" is open to whoever wants to implement it.
25+
26+
## Write Documentation
27+
28+
Data Science for Energy System Modelling could always use more documentation, whether as part of the
29+
official Data Science for Energy System Modelling docs, in docstrings, or even on the web in blog posts,
30+
articles, and such.
31+
32+
## Submit Feedback
33+
34+
The best way to send feedback is to file an issue on GitHub.
35+
36+
If you are proposing a feature:
37+
38+
* Explain in detail how it would work.
39+
* Keep the scope as narrow as possible, to make it easier to implement.
40+
* Remember that this is a volunteer-driven project, and that contributions
41+
are welcome :)
42+
43+
## Get Started
44+
45+
Ready to contribute? Here's how to set up `Data Science for Energy System Modelling` for local development.
46+
47+
1. Fork the repo on GitHub.
48+
2. Clone your fork locally.
49+
3. Install your local copy into a virtualenv, e.g., using `conda`.
50+
4. Create a branch for local development and make changes locally.
51+
5. Commit your changes and push your branch to GitHub.
52+
6. Submit a pull request through the GitHub website.
53+
54+
## Code of Conduct
55+
56+
Please note that the Data Science for Energy System Modelling project is released with a [Contributor Code of Conduct](CONDUCT.md). By contributing to this project you agree to abide by its terms.

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2022, Fabian Neumann
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Data Science for Energy System Modelling
2+
3+
Course at TU Berlin to learn energy system modelling with data.-
4+
5+
## Usage
6+
7+
### Building the book
8+
9+
If you'd like to develop and/or build the Data Science for Energy System Modelling book, you should:
10+
11+
1. Clone this repository
12+
2. Run `pip install -r requirements.txt` (it is recommended you do this within a virtual environment)
13+
3. (Optional) Edit the books source files located in the `data-science-for-esm/` directory
14+
4. Run `jupyter-book clean data-science-for-esm/` to remove any existing builds
15+
5. Run `jupyter-book build data-science-for-esm/`
16+
17+
A fully-rendered HTML version of the book will be built in `data-science-for-esm/_build/html/`.
18+
19+
### Hosting the book
20+
21+
Please see the [Jupyter Book documentation](https://jupyterbook.org/publish/web.html) to discover options for deploying a book online using services such as GitHub, GitLab, or Netlify.
22+
23+
For GitHub and GitLab deployment specifically, the [cookiecutter-jupyter-book](https://github.com/executablebooks/cookiecutter-jupyter-book) includes templates for, and information about, optional continuous integration (CI) workflow files to help easily and automatically deploy books online with GitHub or GitLab. For example, if you chose `github` for the `include_ci` cookiecutter option, your book template was created with a GitHub actions workflow file that, once pushed to GitHub, automatically renders and pushes your book to the `gh-pages` branch of your repo and hosts it on GitHub Pages when a push or pull request is made to the main branch.
24+
25+
## Contributors
26+
27+
We welcome and recognize all contributions. You can see a list of current contributors in the [contributors tab](https://github.com/fneum/data-science-for-esm/graphs/contributors).
28+
29+
## Credits
30+
31+
This project is created using the excellent open source [Jupyter Book project](https://jupyterbook.org/) and the [executablebooks/cookiecutter-jupyter-book template](https://github.com/executablebooks/cookiecutter-jupyter-book).

data-science-for-esm/_config.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#######################################################################################
2+
# A default configuration that will be loaded for all jupyter books
3+
# See the documentation for help and more options:
4+
# https://jupyterbook.org/customize/config.html
5+
6+
#######################################################################################
7+
# Book settings
8+
title : Data Science for Energy System Modelling # The title of the book. Will be placed in the left navbar.
9+
author : Fabian Neumann # The author of the book
10+
copyright : "2022" # Copyright year to be placed in the footer
11+
logo : logo.png # A path to the book logo
12+
13+
# Force re-execution of notebooks on each build.
14+
# See https://jupyterbook.org/content/execute.html
15+
execute:
16+
execute_notebooks: force
17+
18+
# Define the name of the latex output file for PDF builds
19+
latex:
20+
latex_documents:
21+
targetname: book.tex
22+
23+
# Add a bibtex file so that we can create citations
24+
bibtex_bibfiles:
25+
- references.bib
26+
27+
# Information about where the book exists on the web
28+
repository:
29+
url: https://github.com/fneum/Data Science for Energy System Modelling # Online location of your book
30+
path_to_book: docs # Optional path to your book, relative to the repository root
31+
branch: main # Which branch of the repository should be used when creating links (optional)
32+
33+
# Add GitHub buttons to your book
34+
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
35+
html:
36+
use_issues_button: true
37+
use_repository_button: true

data-science-for-esm/_toc.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Table of contents
2+
# Learn more at https://jupyterbook.org/customize/toc.html
3+
4+
format: jb-book
5+
root: intro
6+
chapters:
7+
- file: markdown
8+
- file: notebooks

data-science-for-esm/content.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Content in Jupyter Book
2+
=======================
3+
4+
There are many ways to write content in Jupyter Book. This short section
5+
covers a few tips for how to do so.

data-science-for-esm/intro.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Welcome to your Jupyter Book
2+
3+
This is a small sample book to give you a feel for how book content is
4+
structured.
5+
6+
:::{note}
7+
Here is a note!
8+
:::
9+
10+
And here is a code block:
11+
12+
```
13+
e = mc^2
14+
```
15+
16+
Check out the content pages bundled with this sample book to see more.

data-science-for-esm/logo.png

9.62 KB
Loading

data-science-for-esm/markdown.md

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Markdown Files
2+
3+
Whether you write your book's content in Jupyter Notebooks (`.ipynb`) or
4+
in regular markdown files (`.md`), you'll write in the same flavor of markdown
5+
called **MyST Markdown**.
6+
7+
## What is MyST?
8+
9+
MyST stands for "Markedly Structured Text". It
10+
is a slight variation on a flavor of markdown called "CommonMark" markdown,
11+
with small syntax extensions to allow you to write **roles** and **directives**
12+
in the Sphinx ecosystem.
13+
14+
## What are roles and directives?
15+
16+
Roles and directives are two of the most powerful tools in Jupyter Book. They
17+
are kind of like functions, but written in a markup language. They both
18+
serve a similar purpose, but **roles are written in one line**, whereas
19+
**directives span many lines**. They both accept different kinds of inputs,
20+
and what they do with those inputs depends on the specific role or directive
21+
that is being called.
22+
23+
### Using a directive
24+
25+
At its simplest, you can insert a directive into your book's content like so:
26+
27+
````
28+
```{mydirectivename}
29+
My directive content
30+
```
31+
````
32+
33+
This will only work if a directive with name `mydirectivename` already exists
34+
(which it doesn't). There are many pre-defined directives associated with
35+
Jupyter Book. For example, to insert a note box into your content, you can
36+
use the following directive:
37+
38+
````
39+
```{note}
40+
Here is a note
41+
```
42+
````
43+
44+
This results in:
45+
46+
```{note}
47+
Here is a note
48+
```
49+
50+
In your built book.
51+
52+
For more information on writing directives, see the
53+
[MyST documentation](https://myst-parser.readthedocs.io/).
54+
55+
56+
### Using a role
57+
58+
Roles are very similar to directives, but they are less-complex and written
59+
entirely on one line. You can insert a role into your book's content with
60+
this pattern:
61+
62+
```
63+
Some content {rolename}`and here is my role's content!`
64+
```
65+
66+
Again, roles will only work if `rolename` is a valid role's name. For example,
67+
the `doc` role can be used to refer to another page in your book. You can
68+
refer directly to another page by its relative path. For example, the
69+
role syntax `` {doc}`intro` `` will result in: {doc}`intro`.
70+
71+
For more information on writing roles, see the
72+
[MyST documentation](https://myst-parser.readthedocs.io/).
73+
74+
75+
### Adding a citation
76+
77+
You can also cite references that are stored in a `bibtex` file. For example,
78+
the following syntax: `` {cite}`holdgraf_evidence_2014` `` will render like
79+
this: {cite}`holdgraf_evidence_2014`.
80+
81+
Moreover, you can insert a bibliography into your page with this syntax:
82+
The `{bibliography}` directive must be used for all the `{cite}` roles to
83+
render properly.
84+
For example, if the references for your book are stored in `references.bib`,
85+
then the bibliography is inserted with:
86+
87+
````
88+
```{bibliography}
89+
```
90+
````
91+
92+
Resulting in a rendered bibliography that looks like:
93+
94+
```{bibliography}
95+
```
96+
97+
98+
### Executing code in your markdown files
99+
100+
If you'd like to include computational content inside these markdown files,
101+
you can use MyST Markdown to define cells that will be executed when your
102+
book is built. Jupyter Book uses *jupytext* to do this.
103+
104+
First, add Jupytext metadata to the file. For example, to add Jupytext metadata
105+
to this markdown page, run this command:
106+
107+
```
108+
jupyter-book myst init markdown.md
109+
```
110+
111+
Once a markdown file has Jupytext metadata in it, you can add the following
112+
directive to run the code at build time:
113+
114+
````
115+
```{code-cell}
116+
print("Here is some code to execute")
117+
```
118+
````
119+
120+
When your book is built, the contents of any `{code-cell}` blocks will be
121+
executed with your default Jupyter kernel, and their outputs will be displayed
122+
in-line with the rest of your content.
123+
124+
For more information about executing computational content with Jupyter Book,
125+
see [The MyST-NB documentation](https://myst-nb.readthedocs.io/).

0 commit comments

Comments
 (0)