[GRASS-SVN] r58536 - in grass-addons/grass6/raster: . r.convergence_angle

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 26 23:49:47 PST 2013


Author: hamish
Date: 2013-12-26 23:49:47 -0800 (Thu, 26 Dec 2013)
New Revision: 58536

Added:
   grass-addons/grass6/raster/r.convergence_angle/
   grass-addons/grass6/raster/r.convergence_angle/Makefile
   grass-addons/grass6/raster/r.convergence_angle/r.convergence_angle
Log:
+ module to create a raster map containing the convergence angle at all cells

Copied: grass-addons/grass6/raster/r.convergence_angle/Makefile (from rev 57519, grass-addons/grass6/raster/r.cog/Makefile)
===================================================================
--- grass-addons/grass6/raster/r.convergence_angle/Makefile	                        (rev 0)
+++ grass-addons/grass6/raster/r.convergence_angle/Makefile	2013-12-27 07:49:47 UTC (rev 58536)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.convergence_angle
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script

Added: grass-addons/grass6/raster/r.convergence_angle/r.convergence_angle
===================================================================
--- grass-addons/grass6/raster/r.convergence_angle/r.convergence_angle	                        (rev 0)
+++ grass-addons/grass6/raster/r.convergence_angle/r.convergence_angle	2013-12-27 07:49:47 UTC (rev 58536)
@@ -0,0 +1,81 @@
+#!/bin/sh
+############################################################################
+#
+# MODULE:       r.convergence_angle
+# AUTHOR:       M. Hamish Bowman, Dept. Geology Dept., Otago Univeristy,
+#                 New Zealand
+# PURPOSE:      Creates a raster map containing the convergence angle at
+#               each grid cell.
+#
+# COPYRIGHT:    (c) 2013 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: Creates a raster map containing the convergence angle at each grid cell.
+#% keywords: raster, projection
+#%End
+#%option
+#% key: output
+#% gisprompt: new,cell,raster
+#% type: string
+#% description: Output raster map
+#% required : no
+#%end
+#%flag
+#% key: m
+#% description: Also create u,v multiplier maps
+#%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
+
+TEMPFILE="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TEMPFILE" ] ; then
+    g.message -e "Unable to create temporary files"
+    exit 1
+fi
+
+
+#GRASS_VERBOSE=0; export GRASS_VERBOSE
+
+
+TMPMAP="tmp.rconvrg.$$"
+r.mapcalc "$TMPMAP = 0"
+
+r.out.xyz "$TMPMAP" fs=tab | cut -f1,2 > "$TEMPFILE.xyz"
+
+m.proj -od in="$TEMPFILE.xyz" | cut -f1 -d' ' | \
+  proj -V `g.proj -jf` | grep Convergence | awk '{print $4}' \
+  > "$TEMPFILE.cnv"
+
+paste "$TEMPFILE.xyz" "$TEMPFILE.cnv" > "$TEMPFILE"
+
+r.in.xyz in="$TEMPFILE" out="$GIS_OPT_OUTPUT" fs=tab
+
+# cleanup
+rm "$TEMPFILE" "$TEMPFILE.xyz" "$TEMPFILE.cnv"
+g.remove rast="$TMPMAP"
+
+
+if [ "$GIS_FLAG_M" -eq 1 ] ; then
+    r.mapcalc "$GIS_OPT_OUTPUT.sinalpha = sin($GIS_OPT_OUTPUT)"
+    r.mapcalc "$GIS_OPT_OUTPUT.cosalpha = cos($GIS_OPT_OUTPUT)"
+fi
+
+
+# rotate u,v relative to grid north to be relative to true north
+#r.mapcalc "u_earth = sin(rot)*v_grid + cos(rot)*u_grid"
+#r.mapcalc "v_earth = cos(rot)*v_grid - sin(rot)*u_grid"
+
+


Property changes on: grass-addons/grass6/raster/r.convergence_angle/r.convergence_angle
___________________________________________________________________
Added: svn:executable
   + *



More information about the grass-commit mailing list