minimum size script
Scott Tweddale
tweddale at murphy.gis.uiuc.edu
Fri May 29 15:37:08 EDT 1992
Due to popular demand, here is a simple but very useful script written by
Michael Shapiro of USA-CERL which analyzes an input raster map and "filters"
out any continous areas which are not above a minimum size specified by the
user. In this case, the areal units are square meters, but this can
obviously be changed within the script to suit your specific applications.
:
g.ask element=cell type=old prompt="Rasterfile to be analyzed" unixfile=/tmp/$$
. /tmp/$$
rm -f /tmp/$$
if [ "$name" = "" ]
then
exit
fi
input="$fullname"
g.ask element=cell type=new prompt="Result map" unixfile=/tmp/$$
. /tmp/$$
rm -f /tmp/$$
if [ "$name" = "" ]
then
exit
fi
output="$name"
echo -n "Minimum size (in meters): "
read meters
set -x
r.stats -a "$input" | awk "\$2 > $meters { print \$1 \"=\" \$1 }" | r.reclass in="$input" out="$output"
Scott Tweddale
U. of Illinois GIS Lab/USA-CERL
More information about the grass-user
mailing list