Jupyter Notebooks are documents which can contain live (Python) code, equations, visualizations and narrative text and can be used as an intuitive interface for OGS projects. The following video gives an introduction to using OpenGeoSys with Jupyter Notebooks:
You can use a pre-defined container environment which currently contains:
docker run --rm -p 8888:8888 -v $PWD:/home/jovyan/work --user `id -u $USER` \ --group-add users registry.opengeosys.org/ogs/ogs/ogs-serial-jupyter
This mounts your current directory into
~/work inside the container.
The above command only works when you run Docker from within a WSL2 Linux shell!
... -v /c/Users/My\ Name/working/directory:/home/jovyan/work ...
singularity run docker://registry.opengeosys.org/ogs/ogs/ogs-serial-jupyter
Open the specified URL shown in the command output in your browser, e.g.
You may have to modify the IP address if this is running on a remote machine.
You can append a version number to the image name (applies both to Docker and Singularity) to get an image for a specific OGS release (starting with 6.4.1):
singularity run docker://registry.opengeosys.org/ogs/ogs/ogs-serial-jupyter:6.4.1
Available images are listed on GitLab.
In the file browser on the left-hand side of the Jupyter Lab interface there is a GitLab-tab which allows for browsing and opening notebooks from the ogs/ogs-repository. You can directly modify and execute a notebook, but the notebook is not saved back to GitLab. You can change the browsed repository by typing into the top text field.
If you would like to us this with private repositories you have to supply an access token at container start-up:
docker run --rm -p 8888:8888 -v $PWD:/home/jovyan/work --user `id -u $USER` \ --group-add users registry.opengeosys.org/ogs/ogs/ogs-serial-jupyter \ --GitLabConfig.access_token="< YOUR_ACCESS_TOKEN >"
In a running container you can install additional Python packages with the Jupyter magic command
%pip install [package name]
Please note that this is a temporary installation. If you stop the container the environment is destroyed.
When using PyVista the container uses the (interactive) pythreejs rendering backend per default. If you want to output static images there are a couple of ways to configure the ‘static’ rendering backend:
PYVISTA_JUPYTER_BACKEND=static. This can be defined when starting the container:
docker run ... -e PYVISTA_JUPYTER_BACKEND=static ...
import pyvista as pv pv.set_jupyter_backend('static')
import pyvista as pv ... pv.show(jupyter_backend='static')