GRASS GIS Jupyter notebooks

From GRASS-Wiki
Revision as of 09:33, 24 October 2017 by Madi (talk | contribs) (added instructions how to run grass from jupyter)
Jump to navigation Jump to search

A Jupyter Notebook is a web application that allows you to create and share documents that contain scripts and code, equations, visualizations and explanatory text, combined.

You can even change the code and explore your modified script(s).

How to run GRASS GIS from Jupyter notebook

Running GRASS from Jupyter notebook requires that Jupyter notebook is installed on your system, and that you set up the environment variables for using GRASS. For example you can create a script called that contains the following lines:

# directory where GRASS lives
export GISBASE=/usr/local/grass-7.3.svn # Change this path to reflect your own

# generate GISRC
# Defines the system wide value while in a GRASS session
MYGISDBASE=$HOME/grassdata # Change this path to reflect your own 
MYLOC=MyLoc # Change this location name to reflect your own 

# Set the global grassrc file to individual file name

echo "GRASS_GUI: text" >> "$MYGISRC"

# path to GRASS settings file

export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH

# start the notebook in the notebook folder
cd $HOME/notebooks # change this path to reflect your own path to notebooks folder

nohup jupyter notebook --ip= --port=8888 --debug &

Add this line in your .bashrc file

alias grass_notebook='sh'

From terminal, in your home directory:

source .bashrc

Now you can start your notebook typing in the terminal:


List of selected GRASS GIS Jupyter notebooks

(please expand!)

See also