[GRASSLIST:1954] Re: topograpic analysis using GRASS and R

Hamish hamish_nospam at yahoo.com
Wed Dec 3 19:32:06 EST 2003


> I'm trying to see the realtion beetwen aspect and slope for a given
> area using R. I have in mind a graph with different scales on the
> axis. For instance, I could have the scales for aspect in the bottom
> (0-360 deg) and left (density) axis , and for slope in the top (0-65
> deg) and right (density) axis. But I don't know how to do this.
> already searched the web, but without luck. Does anyone already made
> something like this? 

be careful with GRASS's aspect, it isn't compass direction (0 deg = North).

use this script to make the conversion if wanted.


#!/bin/sh
# r.cat2compass.sh  by Hamish Bowman 11 April 2003

if [ -z $GISBASE ] ; then
        echo "You have to be in GRASS to use this."
        exit
fi

if [ -z "$1" ]; then
        echo "USAGE: r.cat2compass.sh AspectRaster"
        echo "       Make a cartesian angled aspect raster into a compass angled raster"
        echo "       newfile is oldfile_compass.   (ccw from east -> cw from north)"
        exit
else                    
        INPUT_MAP=$1

        r.mapcalc "$INPUT_MAP"_compass="if(isnull($INPUT_MAP),null(), \
                if(($INPUT_MAP < 90), 90-$INPUT_MAP, 360+90-$INPUT_MAP))"

        ##### lighting for SOUTHERN HEMISPHERE (northern sun) #####
        r.colors "$INPUT_MAP"_compass color=rules << EOF
                0 white
                180 black
                360 white
EOF
fi




More information about the grass-user mailing list