Demo GRASS GIS script examples

Open Source GIS: A GRASS GIS Approach
Markus Neteler, Helena Mitasova
3. Edition 2008, 406 pages, 80 illus.
Springer, New York
ISBN-10: 038735767X | ISBN-13: 978-0-387-35767-6 | e-ISBN-13: 978-0-387-68574-8

Demo examples to easily explore GRASS and the NC data set

Run some examples using the commands from the following scripts (based on NC data set):

Installation of NC data set as user in your HOME directory (see book chapter 3 for more details):

# for Unix based systems (winGRASS native comes with data set installer)

# copy the package 'nc_spm_XX_YYYY_ZZZZZ.tar.gz' into your HOME directory, 
# then go into it, just to be sure:
cd $HOME

# create new directory to keep all your GRASS data inside:
mkdir grassdata

# go into the newly created folder:
cd grassdata

# expand the package within this 'grassdata/' folder:
tar xvfz $HOME/nc_spm_XX_YYYY_ZZZZZ.tar.gz
cd $HOME

# now launch GRASS and
#  - select as 'GIS Data Directory' the 'grassdata' folder in your HOME
#  - select as 'Location' the NC location 'nc_spm_XX'
#  - select as 'Mapset' either 'user1' or create a new mapset using the user interface

Inside GRASS, you can run a couple of demo scripts (see book, too):

Additional scripts

CHAPTER 6: Various code snippets

Please see here: How to define database connections; Linear reference system (LRS) including screenshots

CHAPTER 6: Script to perform cross validation in GRASS/RST splines interpolation

Related comment:
Question: (from GRASS user list, 9 May 2007)
Just to verify, I should be looking for the lowest mean cross-validation difference to choose my tension/smoothing parameter?

Not mean – that should be close to zero (positive and negative differences should cancel out) – if it is not, interpolate the crossvalidation differences to a raster map and overlay it with your input points to see whether you may have an isolated point(s) with value significantly below or above the rest of your data that is causing the bias (in that area you need more samples to support that extreme value).

Use mean of absolute values of differences as a measure of predictive interpolation accuracy – so you chose the parameters that give you the lowest mean of absolute values (you need to use as the most optimal. There are some papers that explain why for this particular case mean of absolute values is better than RMSE. Reference:

  • Hofierka J., Cebecauer T., Suri M., 2007. Optimisation of Interpolation Parameters Using Cross-validation. In: Peckham R.J., Jordan G. (eds.) Digital Terrain Modelling, Development and Applications in a Policy Support Environment, Series: Lecture Notes in Geoinformation and Cartography, Springer, ISBN: 3-540-36730-6 [PDF]

CHAPTER 8: Scripts to bulk import LANDSAT-TM5/LANDSAT-TM7 scenes from GLCF Maryland into GRASS

The North Carolina OSGeo Edu data set contains three LANDSAT-TM5/LANDSAT-TM7 scenes reprojected and reduced to a spatial subset. The following shell scripts were used to import the original data sets into a GRASS NC State Plane Metric location. The scripts extract relevant metadata and add them to the history file of the imported maps: