[GRASS-SVN] r49100 - in grass-addons/raster/LandDyn: . r.png.out.py
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 4 19:03:30 EDT 2011
Author: isaacullah
Date: 2011-11-04 16:03:30 -0700 (Fri, 04 Nov 2011)
New Revision: 49100
Added:
grass-addons/raster/LandDyn/r.png.out.py/
grass-addons/raster/LandDyn/r.png.out.py/r.pngout.py
Log:
A new tool to loop through a series of maps sequentially numbered maps and output png files of them suitable for making animations.
Added: grass-addons/raster/LandDyn/r.png.out.py/r.pngout.py
===================================================================
--- grass-addons/raster/LandDyn/r.png.out.py/r.pngout.py (rev 0)
+++ grass-addons/raster/LandDyn/r.png.out.py/r.pngout.py 2011-11-04 23:03:30 UTC (rev 49100)
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+############################################################################
+#
+# MODULE: r.pngmap
+# AUTHOR(S): iullah
+# COPYRIGHT: (C) 2007 GRASS Development Team/iullah
+#
+# description: quickly outout a png of any map to a specified location and filename
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+#############################################################################/
+
+#%Module
+#% description: quickly outout a png of any map to a specified location and filename
+#%End
+#%option
+#% key: inmap
+#% type: string
+#% gisprompt: old,cell,raster
+#% description: map write to png
+#% required : yes
+#%END
+#%option
+#% key: outpath
+#% type: string
+#% gisprompt: old,cell,raster
+#% description: output path and file name
+#% answer: ~/output.png
+#% required : yes
+#%END
+
+import sys
+import os
+import subprocess
+
+# m is a message (as a string) one wishes to have printed in the output window
+def grass_print(m):
+ subprocess.Popen('g.message message="%s"' % m, shell='bash').wait()
+ return
+
+def main():
+ os.environ['GRASS_PNGFILE'] = os.getenv("GIS_OPT_outpath")
+ os.environ['GRASS_TRANSPARENT'] = 'TRUE'
+ os.environ['GRASS_RENDER_IMMEDIATE'] = 'TRUE'
+ os.environ['GRASS_TRUECOLOR'] = 'TRUE'
+ subprocess.Popen('d.rast -o %s' % os.getenv("GIS_OPT_inmap"), shell='bash').wait()
+
+if __name__ == "__main__":
+ if ( len(sys.argv) <= 1 or sys.argv[1] != "@ARGS_PARSED@" ):
+ os.execvp("g.parser", [sys.argv[0]] + sys.argv)
+ else:
+ main()
+
+
Property changes on: grass-addons/raster/LandDyn/r.png.out.py/r.pngout.py
___________________________________________________________________
Added: svn:executable
+ *
More information about the grass-commit
mailing list