This repository contains a collection of Jupyter notebooks for a workshop on Xarray and Xarray-simlab given in October 2022 at ISTerre, University Grenoble-Alpes.
You can run the notebooks in your browser without installing anything thanks to binder. Just follow the link below or click on the "launch binder" badge above and it will launch remotely a new notebook server for you:
This service is for demo purpose only, do not rely on it for doing more serious work.
Docker images are built automatically for this repository. Those images provide the whole computing environment, pre-installed and pre-configured for running the notebooks. The only requirement is to have Docker installed on your machine. It is available on all platforms Linux/Windows/Mac and it can be installed from the Docker website or using one of your platform's package managers.
Run the command below in a terminal to first pull the latest image (note: the Docker application must be running, you might need to launch it first):
$ docker pull fastscape/workshop-grenoble-2022-10:latest
Then run the command below to start the Jupyterlab application from the Docker
container. Replace short-course-xsimlab
by any other name you want to
give to your local container (optional). Also Replace
/path/to/local-notebook-folder
by the full path to the directory on your
machine where you want to create/copy, edit and permanently store notebooks for
this training course.
$ docker run \
-it \
--name short-course-xsimlab \
-p 8888:8888 \
-v /path/to/local-notebook-folder:/home/jovyan/my-local-folder \
fastscape/workshop-grenoble-2022-10 \
jupyter lab --ip 0.0.0.0
You can then enter in your browser the url and token provided to start using the Jupyterlab application.
You may want to copy the notebooks
folder in your local working folder mounted
in the docker container as my-local-folder
. Open a terminal in Jupyterlab and
run the following command:
$ cp -R notebooks my-local-folder/
When you are done you can stop and remove the container:
$ docker stop short-course-xsimlab
$ docker rm short-course-xsimlab
The url I entered in my browser doesn't point to Jupyterlab
You may already have another application running on localhost using the port
8888
. Try another port when running the docker run
command above, e.g.,
using -p 8889:8888
. You also need to change the port in the entered url
accordingly (e.g., localhost:8889
).
The url I entered in my browser gives a page asking for a token
Copy and paste the token given in the url. If the token is invalid, you may have another Jupyterlab application already running on your machine. Try using another port as described above.
Check Docker's documentation for additional command line help and options.
Assuming that you have git
and conda
installed, you can install all the packages required to run the notebooks in a
new conda environment using the following commands:
$ git clone https://github.com/fastscape-lem/workshop-grenoble-2022-10
$ cd workshop-grenoble-2022-10
$ conda env create -f environment.yml
$ conda activate workshop-grenoble-2022-10
Note: you could use mamba instead of
conda
. mamba
is a faster alternative to conda
.
Finally run the command below to start the Jupyterlab application. It should open a new tab in your browser.
$ jupyter lab
Your contribution is welcome! Your can do so by reporting issues, suggesting new notebook examples or improvements to the current examples.
A few extra steps are required to prepare your contributions. You can first update the conda environment using the following command:
$ conda env update -n workshop-grenoble-2022-10 --file environment-dev.yml
This installs a few additional packages like pre-commit, which is used to ensure that all notebook cell outputs are cleared before adding or updating notebooks in this git repository. Run the command below to enable pre-commit (you only need to do this once):
$ pre-commit install
The script below is useful if you want to ensure that all notebooks are running without error:
$ python execute_all_notebooks.py
This script (as well as a script to build the Docker image) is run each time you open or update a pull-request on GitHub.