[GRASS-dev] patch for v.rast.stats to use multiple percentiles
G. Allegri
giohappy at gmail.com
Mon Sep 29 09:13:37 EDT 2008
A little patch to permit the use of multiple percentiles inside v.rast.stats
http://www.geospatial.it/allegri/v.rast.stats.diff
Giovanni
Index: v.rast.stats
===================================================================
--- v.rast.stats (revisione 33591)
+++ v.rast.stats (copia locale)
@@ -63,6 +63,7 @@
#% options: 0-100
#% answer: 90
#% required : no
+#% multiple : yes
#%end
if [ -z "$GISBASE" ] ; then
@@ -221,12 +222,20 @@
# do extended stats?
if [ $GIS_FLAG_E -eq 1 ] ; then
# namespace is limited in DBF but the % value is important
- if [ $DBFDRIVER -eq 1 ] ; then
- PERCCOL="per$GIS_OPT_PERCENTILE"
- else
- PERCCOL="percentile_$GIS_OPT_PERCENTILE"
- fi
- EXTRACOLS="first_quartile median third_quartile $PERCCOL"
+ PERCOL=""
+ percs=`echo $GIS_OPT_PERCENTILE | sed 's+,+ +g'`
+ if [ $DBFDRIVER -eq 1 ] ; then
+ PERCCOLPREF="per"
+ for p in $percs; do
+ PERCCOL="$PERCCOL $PERCCOLPREF$p"
+ done
+ else
+ PERCCOLPREF="percentile_"
+ for p in $percs; do
+ PERCCOL="$PERCCOL $PERCCOLPREF$p"
+ done
+ fi
+ EXTRACOLS="first_quartile median third_quartile$PERCCOL"
else
EXTRACOLS=""
fi
@@ -298,7 +307,9 @@
cf_var="$coeff_var"
if [ $GIS_FLAG_E -eq 1 ] && [ $DBFDRIVER -eq 1 ] ; then
- eval "$PERCCOL=\$percentile_$GIS_OPT_PERCENTILE"
+ for p in $percs; do
+ eval "$PERCCOLPREF$p=\$percentile_$p"
+ done
fi
for var in $BASECOLS $EXTRACOLS ; do
More information about the grass-dev
mailing list