[GRASS-SVN] r35904 - in grass/trunk/scripts: . r.rgb

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 16 09:56:00 EST 2009


Author: glynn
Date: 2009-02-16 09:56:00 -0500 (Mon, 16 Feb 2009)
New Revision: 35904

Added:
   grass/trunk/scripts/r.rgb/
   grass/trunk/scripts/r.rgb/Makefile
   grass/trunk/scripts/r.rgb/r.rgb.html
   grass/trunk/scripts/r.rgb/r.rgb.py
Log:
Add r.rgb


Added: grass/trunk/scripts/r.rgb/Makefile
===================================================================
--- grass/trunk/scripts/r.rgb/Makefile	                        (rev 0)
+++ grass/trunk/scripts/r.rgb/Makefile	2009-02-16 14:56:00 UTC (rev 35904)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.rgb
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script

Added: grass/trunk/scripts/r.rgb/r.rgb.html
===================================================================
--- grass/trunk/scripts/r.rgb/r.rgb.html	                        (rev 0)
+++ grass/trunk/scripts/r.rgb/r.rgb.html	2009-02-16 14:56:00 UTC (rev 35904)
@@ -0,0 +1,20 @@
+<H2>DESCRIPTION</H2>
+
+<EM>r.rgb</EM> is a script that generates separate red, green and blue
+maps from a raster map and its associated color table.
+
+<H2>SEE ALSO</H2>
+
+<P>
+<EM>
+<A HREF="r.composite.html">r.composite</A>,<br>
+<A HREF="r.blend.html">r.blend</A>,<br>
+<A HREF="r.colors.html">r.colors</A>,<br>
+<A HREF="r.mapcalc.html">r.mapcalc</A>,<br>
+</EM>
+
+<H2>AUTHOR</H2>
+
+Glynn Clements
+
+<p><i>Last changed: $Date: 2008-08-15 07:16:42 +0100 (Fri, 15 Aug 2008) $</i>

Added: grass/trunk/scripts/r.rgb/r.rgb.py
===================================================================
--- grass/trunk/scripts/r.rgb/r.rgb.py	                        (rev 0)
+++ grass/trunk/scripts/r.rgb/r.rgb.py	2009-02-16 14:56:00 UTC (rev 35904)
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+############################################################################
+#
+# MODULE:       r.rgb
+# AUTHOR(S):	Glynn Clements
+# PURPOSE:	Split a raster map into red, green and blue maps
+# COPYRIGHT:	(C) 2009 Glynn Clements 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: Split a raster map into red, green and blue maps
+#%  keywords: raster
+#% End
+#% option
+#%  key: input
+#%  type: string
+#%  gisprompt: old,cell,raster
+#%  description: Input map
+#%  required : yes
+#% end
+#% option
+#%  key: output
+#%  type: string
+#%  description: Base name for output maps
+#%  required : no
+#% end
+
+import sys
+import os
+import string
+import grass
+
+def main():
+    input = options['input']
+    output = options['output']
+
+    if not grass.find_file(input)['file']:
+	grass.fatal("Map <%s> not found." % input)
+
+    if not output:
+	output = input
+
+    expr = ';'.join(["${output}.r = r#${input}",
+		     "${output}.g = g#${input}",
+		     "${output}.b = b#${input}"])
+    grass.mapcalc(expr, input = input, output = output)
+
+    for ch in ['r', 'g', 'b']:
+	name = "%s.%s" % (output, ch)
+	grass.run_command('r.colors', map = name, color = 'grey255')
+	grass.raster_history(name)
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    main()


Property changes on: grass/trunk/scripts/r.rgb/r.rgb.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the grass-commit mailing list