[GRASS-SVN] r34701 - in grass/branches/develbranch_6/scripts: . d.frame.split r.colors.stddev v.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 4 04:43:41 EST 2008


Author: hamish
Date: 2008-12-04 04:43:41 -0500 (Thu, 04 Dec 2008)
New Revision: 34701

Added:
   grass/branches/develbranch_6/scripts/d.frame.split/
   grass/branches/develbranch_6/scripts/d.frame.split/Makefile
   grass/branches/develbranch_6/scripts/d.frame.split/description.html
   grass/branches/develbranch_6/scripts/r.colors.stddev/
   grass/branches/develbranch_6/scripts/r.colors.stddev/Makefile
   grass/branches/develbranch_6/scripts/r.colors.stddev/description.html
   grass/branches/develbranch_6/scripts/r.colors.stddev/r.colors.stddev
Removed:
   grass/branches/develbranch_6/scripts/d.frame.split/d.frame.quarter
   grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split.html
Modified:
   grass/branches/develbranch_6/scripts/Makefile
   grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split
   grass/branches/develbranch_6/scripts/v.colors/description.html
Log:
bring in v.colors, r.colors.stddev, d.frame.split from addons

Modified: grass/branches/develbranch_6/scripts/Makefile
===================================================================
--- grass/branches/develbranch_6/scripts/Makefile	2008-12-04 09:41:44 UTC (rev 34700)
+++ grass/branches/develbranch_6/scripts/Makefile	2008-12-04 09:43:41 UTC (rev 34701)
@@ -17,6 +17,7 @@
 	d.shadedmap \
 	d.slide.show \
 	d.split \
+	d.split.frame \
 	d.text.freetype \
 	d.vect.thematic \
 	db.dropcol \
@@ -36,6 +37,7 @@
 	p.out.vrml \
 	r.blend \
 	r.cats \
+	r.colors.stddev \
 	r.fillnulls \
 	r.in.aster \
 	r.in.srtm \
@@ -64,6 +66,7 @@
 	v.db.univar \
 	v.db.update \
 	v.dissolve \
+	v.colors \
 	v.in.e00 \
 	v.in.garmin \
 	v.in.geonames \

Copied: grass/branches/develbranch_6/scripts/d.frame.split (from rev 34697, grass-addons/display/d.frame.split)

Added: grass/branches/develbranch_6/scripts/d.frame.split/Makefile
===================================================================
--- grass/branches/develbranch_6/scripts/d.frame.split/Makefile	                        (rev 0)
+++ grass/branches/develbranch_6/scripts/d.frame.split/Makefile	2008-12-04 09:43:41 UTC (rev 34701)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = d.split.frame
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass/branches/develbranch_6/scripts/d.frame.split/Makefile
___________________________________________________________________
Name: svn:mime-type
   + text/x-sh
Name: svn:eol-style
   + native

Deleted: grass/branches/develbranch_6/scripts/d.frame.split/d.frame.quarter
===================================================================
--- grass-addons/display/d.frame.split/d.frame.quarter	2008-12-04 08:57:27 UTC (rev 34697)
+++ grass/branches/develbranch_6/scripts/d.frame.split/d.frame.quarter	2008-12-04 09:43:41 UTC (rev 34701)
@@ -1,67 +0,0 @@
-#!/bin/sh
-############################################################################
-#
-# MODULE:       d.frame.quarter
-# AUTHOR:       M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,
-#                 New Zealand
-# PURPOSE:      Split the display into quarter frames
-#		  (This script is superseded by d.frame.split)
-#
-# COPYRIGHT:    (c) 2007 Hamish Bowman, and the GRASS Development Team
-#               This program is free software released to the public domain
-#
-#############################################################################
-
-#%Module
-#% description: Split the display into quarters.
-#%End
-#%flag
-#% key: 6
-#% description: Split the display into sixths
-#%end
-
-
-if  [ -z "$GISBASE" ] ; then
-    echo "You must be in GRASS GIS to run this program." 1>&2
-    exit 1
-fi
-
-# skip parser if no args are given
-if [ "$#" -gt 0 ] ; then
-  if [ "$1" != "@ARGS_PARSED@" ] ; then
-    exec g.parser "$0" "$@"
-  fi
-else
-  GIS_FLAG_6=0
-fi
-
-
-if [ `d.mon -p | cut -f1 -d' '` != "Currently" ] ; then
-   echo "No monitor currently selected for output"
-   exit 1
-fi
-
-d.erase -f
-if [ $? -ne 0 ] ; then
-   echo "Error clearing display monitor"
-   exit 1
-fi
-
-if [ "$GIS_FLAG_6" -eq 0 ] ; then
-   d.frame -c frame=uno at=50,100,0,50
-   d.frame -c frame=dos at=50,100,50,100
-   d.frame -c frame=tres at=0,50,0,50
-   d.frame -c frame=cuatro at=0,50,50,100
-else
-   d.frame -c frame=uno at=66.6667,100,0,50
-   d.frame -c frame=dos at=66.6667,100,50,100
-   d.frame -c frame=tres at=33.3333,66.6667,0,50
-   d.frame -c frame=cuatro at=33.3333,66.6667,50,100
-   d.frame -c frame=cinco at=0,33.3333,0,50
-   d.frame -c frame=seis at=0,33.3333,50,100
-fi
-
-d.frame -s uno
-
-exit 0
-

Modified: grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split
===================================================================
--- grass-addons/display/d.frame.split/d.frame.split	2008-12-04 08:57:27 UTC (rev 34697)
+++ grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split	2008-12-04 09:43:41 UTC (rev 34701)
@@ -1,11 +1,11 @@
 #!/bin/sh
 ############################################################################
 #
-# MODULE:       d.frame.split
+# MODULE:       d.split.frame
 # AUTHOR:       M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,
 #                 New Zealand
 # PURPOSE:      Split the display into quarter frames, etc
-#		  (This script should replace d.split for GRASS 7)
+#		  (This script is a replacement for d.split from GRASS 5,6)
 #
 # COPYRIGHT:    (c) 2007 Hamish Bowman, and the GRASS Development Team
 #               This program is free software released to the public domain
@@ -44,13 +44,13 @@
 
 
 if [ `d.mon -p | cut -f1 -d' '` != "Currently" ] ; then
-   echo "No monitor currently selected for output"
+   g.message -e "No monitor currently selected for output"
    exit 1
 fi
 
 d.erase -f
 if [ $? -ne 0 ] ; then
-   echo "Error clearing display monitor"
+   g.message -e "Error clearing display monitor"
    exit 1
 fi
 
@@ -169,6 +169,6 @@
 
 d.frame -s uno
 
-echo "Use 'd.erase -f' to clear frames from display monitor."  1>&2
+g.message "Use 'd.erase -f' to clear frames from display monitor."
 
 exit


Property changes on: grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split
___________________________________________________________________
Name: svn:mime-type
   + text/x-sh
Name: svn:eol-style
   + native

Deleted: grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split.html
===================================================================
--- grass-addons/display/d.frame.split/d.frame.split.html	2008-12-04 08:57:27 UTC (rev 34697)
+++ grass/branches/develbranch_6/scripts/d.frame.split/d.frame.split.html	2008-12-04 09:43:41 UTC (rev 34701)
@@ -1,43 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>d.split</EM> divides the active display into a number of equal frames,
-either horizontally or vertically.
-
-
-<H2>NOTES</H2>
-
-Frame labels are created as Spanish numbers to distinguish them from
-monitor numbers, etc. These are "<i>uno, dos, tres, cuatro, cinco,
-seis, siete, ocho, nueve, diez, once, doce, trece, catorce, quince,
-and dieciseis</i>" for frames 1-16.
-The background frame is called <i>full_screen</i>.
-
-<P>
-Commands such as <em>d.rast.leg</em> will interfere with the frame creation
-and cannot be used.
-
-<H2>EXAMPLE</H2>
-
-Split the display monitor into six frames (3x2), jump to the third frame,
-and draw a map.
-<div class="code"><pre>
-  d.split -h frames=6 
-  d.frame -s tres
-  d.rast elevation.dem
-</pre></div>
-<BR>
-
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="d.frame.html">d.frame</A>
-</EM>
-
-
-<H2>AUTHOR</H2>
-
-Hamish Bowman<BR>
-<i>Dunedin, New Zealand</i>
-<p>
-<i>Last changed: $Date$</i>

Added: grass/branches/develbranch_6/scripts/d.frame.split/description.html
===================================================================
--- grass/branches/develbranch_6/scripts/d.frame.split/description.html	                        (rev 0)
+++ grass/branches/develbranch_6/scripts/d.frame.split/description.html	2008-12-04 09:43:41 UTC (rev 34701)
@@ -0,0 +1,46 @@
+<H2>DESCRIPTION</H2>
+
+<EM>d.split.frame</EM> divides the active display into a number of equal
+frames, either horizontally or vertically.
+
+
+<H2>NOTES</H2>
+
+Frame labels are created as Spanish numbers to distinguish them from
+monitor numbers, etc. These are "<i>uno, dos, tres, cuatro, cinco,
+seis, siete, ocho, nueve, diez, once, doce, trece, catorce, quince,
+and dieciseis</i>" for frames 1-16.
+The background frame is called <i>full_screen</i>.
+
+<P>
+Commands such as <em>d.rast.leg</em> will interfere with the frame creation
+and cannot be used.
+
+
+<H2>EXAMPLE</H2>
+
+Split the display monitor into six frames (3x2), jump to the third frame,
+and draw a map.
+<div class="code"><pre>
+  d.split.frame -h frames=6 
+  d.frame -s tres
+  d.rast elevation.dem
+</pre></div>
+<BR>
+
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="d.frame.html">d.frame</A>,
+<A HREF="d.frame.html">d.split</A>
+</EM>
+
+
+<H2>AUTHOR</H2>
+
+Hamish Bowman<BR>
+<i>Dunedin, New Zealand</i>
+
+<p>
+<i>Last changed: $Date$</i>


Property changes on: grass/branches/develbranch_6/scripts/d.frame.split/description.html
___________________________________________________________________
Name: svn:mime-type
   + text/html
Name: svn:keywords
   + Date
Name: svn:eol-style
   + native

Copied: grass/branches/develbranch_6/scripts/r.colors.stddev/Makefile (from rev 34697, grass/branches/develbranch_6/scripts/v.colors/Makefile)
===================================================================
--- grass/branches/develbranch_6/scripts/r.colors.stddev/Makefile	                        (rev 0)
+++ grass/branches/develbranch_6/scripts/r.colors.stddev/Makefile	2008-12-04 09:43:41 UTC (rev 34701)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.colors.stddev
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script

Copied: grass/branches/develbranch_6/scripts/r.colors.stddev/description.html (from rev 34697, grass/branches/develbranch_6/scripts/v.colors/description.html)
===================================================================
--- grass/branches/develbranch_6/scripts/r.colors.stddev/description.html	                        (rev 0)
+++ grass/branches/develbranch_6/scripts/r.colors.stddev/description.html	2008-12-04 09:43:41 UTC (rev 34701)
@@ -0,0 +1,38 @@
+<H2>DESCRIPTION</H2>
+
+<EM>r.colors.stddev</EM> set raster map color rules based on standard
+deviations from a map's mean value, either as a continuous color gradient
+or in color bands per standard deviation from the mean.
+
+<p>
+With the color band option values less that 1 S.D. from the mean are
+colored green, within 1-2 S.D. are colored yellow, within 2-3 S.D. are
+colored red, and beyond 3 S.D. are colored black.
+<p>
+For a differences map there is an option to lock the center of the color
+table at zero. Values more than two S.D. below the mean will be colored blue;
+values below the mean but less than 2 S.D. away will transition to white,
+and above the mean the colors will simularly transition to full red at +2 S.D.
+
+
+<!--
+<h2>EXAMPLES</h2>
+-->
+
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="r.colors.html">r.colors</A><BR>
+<A HREF="r.univar.html">r.univar</A><BR>
+<A HREF="v.colors.html">v.colors</A><BR>
+</EM>
+
+
+<H2>AUTHOR</H2>
+
+Hamish Bowman<BR>
+<i>Dunedin, New Zealand</i>
+
+<p>
+<i>Last changed: $Date$</i>

Copied: grass/branches/develbranch_6/scripts/r.colors.stddev/r.colors.stddev (from rev 34697, grass-addons/raster/r.colors.tools/r.colors.stddev)
===================================================================
--- grass/branches/develbranch_6/scripts/r.colors.stddev/r.colors.stddev	                        (rev 0)
+++ grass/branches/develbranch_6/scripts/r.colors.stddev/r.colors.stddev	2008-12-04 09:43:41 UTC (rev 34701)
@@ -0,0 +1,145 @@
+#!/bin/sh
+############################################################################
+#
+# MODULE:       r.colors.stddev
+# AUTHOR:       M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,
+#                 New Zealand
+# PURPOSE:      Set color rules based on stddev from a map's mean value.
+#
+# COPYRIGHT:    (c) 2007 Hamish Bowman, and the GRASS Development Team
+#               This program is free software under the GNU General Public
+#               License (>=v2). Read the file COPYING that comes with GRASS
+#               for details.
+#
+#############################################################################
+
+#%Module
+#% description: Set color rules based on stddev from a map's mean value.
+#% keywords: raster
+#%End
+#% option
+#% key: input
+#% type: string
+#% gisprompt: old,cell,raster
+#% key_desc: name
+#% description: Name of input raster map 
+#% required: yes
+#%end
+#%flag
+#% key: b
+#% description: Color using standard deviation bands
+#%end
+#%flag
+#% key: z
+#% description: Force center at zero
+#%end
+
+
+if  [ -z "$GISBASE" ] ; then
+    echo "You must be in GRASS GIS to run this program." 1>&2
+    exit 1
+fi
+
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+    exec g.parser "$0" "$@"
+fi
+
+
+eval `r.univar -g "$GIS_OPT_INPUT"`
+# $? is result of the eval not r.univar (???)
+#if [ $? -ne 0 ] ; then
+#   g.region -e "Problem running r.univar"
+#   exit 1
+#fi
+
+
+if [ $GIS_FLAG_Z -eq 0 ] ; then
+
+   MEAN_MINUS_2STDEV=`echo "$mean $stddev" | awk '{print $1 - 2*$2}'`
+   MEAN_PLUS_2STDEV=`echo "$mean $stddev" | awk '{print $1 + 2*$2}'`
+
+   if [ $GIS_FLAG_B -eq 0 ] ; then
+     # smooth free floating blue/white/red
+     r.colors "$GIS_OPT_INPUT" color=rules << EOF
+       0% blue
+       $MEAN_MINUS_2STDEV blue
+       $mean white
+       $MEAN_PLUS_2STDEV red
+       100% red
+EOF
+   else
+     # banded free floating  black/red/yellow/green/yellow/red/black
+     MEAN_MINUS_1STDEV=`echo "$mean $stddev" | awk '{print $1 - $2}'`
+     MEAN_MINUS_3STDEV=`echo "$mean $stddev" | awk '{print $1 - 3*$2}'`
+     MEAN_PLUS_1STDEV=`echo "$mean $stddev" | awk '{print $1 + $2}'`
+     MEAN_PLUS_3STDEV=`echo "$mean $stddev" | awk '{print $1 + 3*$2}'`
+
+     # reclass with labels only works for category (integer) based maps
+     #r.reclass input="$GIS_OPT_INPUT" output="${GIS_OPT_INPUT}.stdevs" << EOF
+
+     # >3 S.D. outliers colored black so they show up in d.histogram w/ white background
+     r.colors "$GIS_OPT_INPUT" color=rules << EOF
+       0% black
+       $MEAN_MINUS_3STDEV black
+       $MEAN_MINUS_3STDEV red
+       $MEAN_MINUS_2STDEV red
+       $MEAN_MINUS_2STDEV yellow
+       $MEAN_MINUS_1STDEV yellow
+       $MEAN_MINUS_1STDEV green
+       $MEAN_PLUS_1STDEV green
+       $MEAN_PLUS_1STDEV yellow
+       $MEAN_PLUS_2STDEV yellow
+       $MEAN_PLUS_2STDEV red
+       $MEAN_PLUS_3STDEV red
+       $MEAN_PLUS_3STDEV black
+       100% black
+EOF
+   fi
+
+
+else 
+   # data centered on 0  (e.g. map of deviations)
+   r.mapcalc "r_col_stdev_abs_$$ = abs($GIS_OPT_INPUT)"
+   eval `r.info -r "r_col_stdev_abs_$$"`
+
+   # current r.univar truncates percentage to the base integer
+   STDDEV2=`r.univar -eg "r_col_stdev_abs_$$" perc=95.4500 | grep ^percentile | cut -f2 -d=`
+
+   if [ $GIS_FLAG_B -eq 0 ] ; then
+     # zero centered smooth blue/white/red
+     r.colors "$GIS_OPT_INPUT" color=rules << EOF
+       -$max blue
+       -$STDDEV2 blue
+       0 white
+       $STDDEV2 red
+       $max red
+EOF
+   else
+     # zero centered banded  black/red/yellow/green/yellow/red/black
+
+     # current r.univar truncates percentage to the base integer
+     STDDEV1=`r.univar -eg "r_col_stdev_abs_$$" perc=68.2689 | grep ^percentile | cut -f2 -d=`
+     STDDEV3=`r.univar -eg "r_col_stdev_abs_$$" perc=99.7300 | grep ^percentile | cut -f2 -d=`
+
+     # >3 S.D. outliers colored black so they show up in d.histogram w/ white background
+     r.colors "$GIS_OPT_INPUT" color=rules << EOF
+       -$max black
+       -$STDDEV3 black
+       -$STDDEV3 red
+       -$STDDEV2 red
+       -$STDDEV2 yellow
+       -$STDDEV1 yellow
+       -$STDDEV1 green
+       $STDDEV1 green
+       $STDDEV1 yellow
+       $STDDEV2 yellow
+       $STDDEV2 red
+       $STDDEV3 red
+       $STDDEV3 black
+       $max black
+EOF
+   fi
+
+   g.remove rast="r_col_stdev_abs_$$" --quiet
+fi
+


Property changes on: grass/branches/develbranch_6/scripts/r.colors.stddev/r.colors.stddev
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + text/x-sh
Name: svn:eol-style
   + native

Modified: grass/branches/develbranch_6/scripts/v.colors/description.html
===================================================================
--- grass/branches/develbranch_6/scripts/v.colors/description.html	2008-12-04 09:41:44 UTC (rev 34700)
+++ grass/branches/develbranch_6/scripts/v.colors/description.html	2008-12-04 09:43:41 UTC (rev 34701)
@@ -62,6 +62,7 @@
 
 <EM>
 <A HREF="r.colors.html">r.colors</A><BR>
+<A HREF="r.colors.stddev.html">r.colors.stddev</A><BR>
 <A HREF="r.what.color.html">r.what.color</A><BR>
 <A HREF="v.db.addcol">v.db.addcol</A><BR>
 <A HREF="v.db.select.html">v.db.select</A><BR>



More information about the grass-commit mailing list