Difference between revisions of "GRASS GIS Jupyter notebooks"
(Wildfire Modeling in Yosemite National Park Jupyter notebook added)
(+GRASS GIS: From Beginner to Power User (FOSS4G 2021 workshop) https://github.com/ncsu-geoforall-lab/grass-gis-workshop-FOSS4G-2021)
|Line 8:||Line 8:|
Revision as of 22:00, 1 February 2022
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.
List of selected GRASS GIS Jupyter notebooks
- GRASS GIS: From Beginner to Power User (FOSS4G 2021 workshop) https://github.com/ncsu-geoforall-lab/grass-gis-workshop-FOSS4G-2021
PyGRASS and Python:
- Workshop on PyGRASS using IPython notebook
- How to write a Python GRASS GIS 7 addon
- Jupyter Notebook Geospatial Python Stack
R and GRASS GIS:
Running a Jupyter notebook locally
You can even change the code and explore your modified script(s).
You need to have a working Jupyter installation:
pip install jupyter
How to run GRASS GIS from Jupyter notebook
(this section needs to be updated)
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 grass_jupyter.sh that contains the following lines:
# directory where GRASS GIS lives export GISBASE=`grass78 --config path` # or define path to binaries like /usr/local/grass-7.8.dev echo $GISBASE # 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 MYMAPSET=PERMANENT # Set the global grassrc file to individual file name MYGISRC="$HOME/.grassrc.$$" echo "GISDBASE: $MYGISDBASE" > "$MYGISRC" echo "LOCATION_NAME: $MYLOC" >> "$MYGISRC" echo "MAPSET: $MYMAPSET" >> "$MYGISRC" echo "GRASS_GUI: text" >> "$MYGISRC" # path to GRASS settings file export GISRC=$MYGISRC export LD_LIBRARY_PATH=$GISBASE/lib:$LD_LIBRARY_PATH export PYTHONPATH=$GISBASE/etc/python:$PYTHONPATH export PATH=$GISBASE/bin:$GISBASE/scripts:$PATH # start the notebook in the notebook folder cd $HOME/notebooks # change to notebooks folder (example; update to your path) nohup jupyter notebook --ip=0.0.0.0 --port=8888 --debug &
To easily use this script, add this line to your $HOME/.bashrc file:
# update path to script accordingly alias grass_notebook='sh $HOME/grass_jupyter.sh'
From terminal, in your home directory:
Now you can start easily your notebook typing in the terminal:
- GRASS GIS focused converter from HTML with pre code tags to Jupyter Notebook
- RISE: Jupyter/IPython Slideshow Extension, https://rise.readthedocs.io/en/stable/