Commit 0181ca4d authored by Tantet Alexis (M.)'s avatar Tantet Alexis (M.)
Browse files

initialize book

parent d4f26a10
Pipeline #131628 failed with stage
in 57 seconds
*~
*.egg-info
build
dist
__pycache__
**/#*#
**/.#*
.ipynb*
book/_build
flycheck_setup.py
image: python:3.8
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
before_script:
- python -V # Print out python version for debugging
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
pages:
script:
- pip install -r requirements.txt
- pip install 'sphinxcontrib-bibtex>=2.1.4' 'jupyter-book>=0.11.1' 'Sphinx>=3.4.0' 'sphinx_book_theme>=0.0.41'
- bash cleanbuild_book.sh
- mv book/_build/html/ public/
artifacts:
paths:
- public
only:
- master
# Code of Conduct
## Our Pledge
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.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
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.
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.
## Scope
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.
## Enforcement
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.
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.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant, version 1.4](http://contributor-covenant.org/version/1/4).
# Contributing
Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given. You can contribute in the ways listed below.
## Report Bugs
Report bugs using GitHub issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
## Fix Bugs
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.
## Implement Features
Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.
## Write Documentation
climate-change-and-energy-transition could always use more documentation, whether as part of the
official climate-change-and-energy-transition docs, in docstrings, or even on the web in blog posts,
articles, and such.
## Submit Feedback
The best way to send feedback is to file an issue on GitHub.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)
## Get Started
Ready to contribute? Here's how to set up `climate-change-and-energy-transition` for local development.
1. Fork the repo on GitHub.
2. Clone your fork locally.
3. Install your local copy into a virtualenv, e.g., using `conda`.
4. Create a branch for local development and make changes locally.
5. Commit your changes and push your branch to GitHub.
6. Submit a pull request through the GitHub website.
## Code of Conduct
Please note that the climate-change-and-energy-transition project is released with a [Contributor Code of Conduct](CONDUCT.md). By contributing to this project you agree to abide by its terms.
This diff is collapsed.
#######################################################################################
# A default configuration that will be loaded for all jupyter books
# See the documentation for help and more options:
# https://jupyterbook.org/customize/config.html
#######################################################################################
# Book settings
title : "Machine Learning for Climate and Energy" # The title of the book. Will be placed in the left navbar.
author : "Bruno Deremble and Alexis Tantet" # The author of the book
copyright : " Attribution-ShareAlike 4.0 International" # Copyright year to be placed in the footer
logo: images/logos/logo_e4c_final.png
execute:
execute_notebooks: auto
stderr_output: show
only_build_toc_files: true
# sphinx:
# config:
# bibtex_bibfiles:
# - 'references.bib'
# Information about where the book exists on the web
repository:
url : "https://gitlab.in2p3.fr/energy4climate/public/education/machine_learning_for_climate_and_energy/"
path_to_book : "book/"
branch : "master"
# Configure your Binder links, such as the URL of the BinderHub.
# launch_buttons:
# binderhub_url : https://mybinder.org
# jupyterhub_url: "https://www.lmd.polytechnique.fr/jupyterhub/"
html:
use_repository_button: true
use_issues_button: true
parse:
myst_enable_extensions:
- amsmath
- colon_fence
- deflist
- dollarmath
- html_admonition
- html_image
- linkify
- replacements
- smartquotes
- substitution
format: jb-article
root: chapters/intro
sections:
- file: notebooks/class2.ipynb
# sections:
# - file: notebooks/class2.ipynb
# Introduction
<!-- ```{bibliography} references.bib -->
<!-- ``` -->
# Notebooks Guide
## General guidelines for MEC666
- Each session includes a course chapter (correspondant: Philippe Drobinski) and a tutorial (correspondant: Alexis Tantet).
- We use Moodle to share course/tutorial material with you (course book, this guide, links, etc.).
- Some of the tutorials are based on notebooks to be run interactively on the LMD's JupyterHub:
- Instructions on how to run the notebooks interactively are given below (Section 2).
- Your credentials to login to the JupyterHub have been sent to you by e-mail.
- If not, ask your correspondant before the tutorial.
- A link to a webpage corresponding to the notebook accessible by anyone but without interaction is also provided on the session's section on Moodle.
- Otherwise, a PDF of the session's tutorial is provided on Moodle.
Please download it before the tutorial.
## Getting a notebook ready for the tutorial on the JupyterHub from IPSL
To get the notebooks on the JupyterHub ready for the tutorials, please follow the instructions bellow with the help of the following figures:
- Log in to your account at [https://www1.lmd.polytechnique.fr/jupyterhub/](https://www1.lmd.polytechnique.fr/jupyterhub/).
This may take a few minutes (refresh the page from time to time to make sure that you are redirected to the hub).
:::{figure} logging_in
<img src="../images/notebooks_guide/login.png" alt="Logging in" width="800px">
Logging in.
:::
- Open a Terminal from the launcher (if needed, choose `File/New Launcher` in the top menu).
:::{figure} open_terminal
<img src="../images/notebooks_guide/open_terminal.png" alt="Open a terminal" width="800px">
Open a terminal.
:::
- Ensure that you are in the home directory by entering this command in the terminal:
```
cd ~
```
- Enter this command in the terminal to install the Python packages (it may take a while):
```
pip install --src=. -e git+https://gitlab.in2p3.fr/energy4climate/public/education/climate_change_and_energy_transition.git#egg=simclimat
```
:::{figure} install_packages
<img src="../images/notebooks_guide/install_packages.png" alt="Install pakages" width="800px">
Install Python packages.
:::
<!-- - Enter this command in the terminal to activate the pyviz jupyterlab extension (this may take a while): -->
<!-- ``` -->
<!-- jupyter labextension install @pyviz/jupyterlab_pyviz -->
<!-- ``` -->
<!-- :::{figure} install_extensions -->
<!-- <img src="../images/notebooks_guide/install_extension.png" alt="Install extensions" width="800px"> -->
<!-- Install `pyviz` extension for jupyterlab. -->
<!-- ::: -->
<!-- - Log out (`File/Log Out` in the top menu) and log in again. -->
- Open the notebook by following the path `simclimat/book/notebooks/**/*.ipynb` in the side bar on the left (replace the stars by the directory and the name of the notebook).
:::{figure} open_notebook
<img src="../images/notebooks_guide/open_notebook.png" alt="Open a notebook" width="800px">
Open a notebook.
:::
- `Run/Restart Kernel and Run All Cells` to run all cells while making sure that the last installation of the package is used.
- Select the first cell and type `Shift Enter` or press the `Play` button in the toolbar repeatedly to execute one cell after the other.
## Getting a notebook ready for the tutorial on your machine using `conda`
To get the notebooks on your computer ready for the tutorials using `conda`, please make sure you have [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/products/individual) for Python 3 installed on your machine and follow the instructions bellow:
- Use one of the following methods to get the package on your machine:
- Download with you browser using this link as shown on the following figure and decompress the package: [https://gitlab.in2p3.fr/energy4climate/public/education/climate_change_and_energy_transition](https://gitlab.in2p3.fr/energy4climate/public/education/climate_change_and_energy_transition)
- Clone the package using `git` by entering the following command in a terminal:
```
git clone https://gitlab.in2p3.fr/energy4climate/public/education/climate_change_and_energy_transition.git
```
:::{figure} open_notebook
<img src="../images/notebooks_guide/download_with_browser.png" alt="Download package with browser" width="800px">
Download the package with your browser.
:::
- Create an automatic conda environment for the tutorials:
```
conda env create -f environment.yml
```
- Activate the environment:
```
conda activate climate_energy_tutorials
```
- Install `jupyter`:
```
conda install jupyter
```
- Run `jupyter` in the `book/notebooks/` directory:
```
jupyter notebook book/notebooks/
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment