[GRASS-SVN] r51446 - in grass/trunk/temporal: . t.rast.out.vtk t.vect.univar

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 14 20:58:02 EDT 2012


Author: huhabla
Date: 2012-04-14 17:58:02 -0700 (Sat, 14 Apr 2012)
New Revision: 51446

Added:
   grass/trunk/temporal/t.vect.univar/
   grass/trunk/temporal/t.vect.univar/Makefile
   grass/trunk/temporal/t.vect.univar/t.vect.univar.html
   grass/trunk/temporal/t.vect.univar/t.vect.univar.py
   grass/trunk/temporal/t.vect.univar/test.t.vect.univar.sh
Modified:
   grass/trunk/temporal/Makefile
   grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py
Log:
Space time vector dataset univariate statistics module


Modified: grass/trunk/temporal/Makefile
===================================================================
--- grass/trunk/temporal/Makefile	2012-04-15 00:48:41 UTC (rev 51445)
+++ grass/trunk/temporal/Makefile	2012-04-15 00:58:02 UTC (rev 51446)
@@ -29,6 +29,7 @@
 	t.vect.extract \
 	t.vect.what.strds \
 	t.vect.observe.strds
+	t.vect.univar \
 
 PGM = tgisintro
 

Modified: grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py
===================================================================
--- grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py	2012-04-15 00:48:41 UTC (rev 51445)
+++ grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py	2012-04-15 00:58:02 UTC (rev 51446)
@@ -65,8 +65,6 @@
 #% description: Export files using the space time dataset granularity for equidistant time between maps, where statement will be ignored
 #%end
 
-
-
 import os
 import grass.script as grass
 import grass.temporal as tgis

Added: grass/trunk/temporal/t.vect.univar/Makefile
===================================================================
--- grass/trunk/temporal/t.vect.univar/Makefile	                        (rev 0)
+++ grass/trunk/temporal/t.vect.univar/Makefile	2012-04-15 00:58:02 UTC (rev 51446)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../../
+
+PGM = t.vect.univar
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script $(TEST_DST)

Added: grass/trunk/temporal/t.vect.univar/t.vect.univar.html
===================================================================
Added: grass/trunk/temporal/t.vect.univar/t.vect.univar.py
===================================================================
--- grass/trunk/temporal/t.vect.univar/t.vect.univar.py	                        (rev 0)
+++ grass/trunk/temporal/t.vect.univar/t.vect.univar.py	2012-04-15 00:58:02 UTC (rev 51446)
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+############################################################################
+#
+# MODULE:	t.vect.univar
+# AUTHOR(S):	Soeren Gebbert
+#
+# PURPOSE:	Calculates univariate statistics from the non-null cells for each registered vector map of a space time vector dataset
+# COPYRIGHT:	(C) 2011 by the GRASS Development Team
+#
+#		This program is free software under the GNU General Public
+#		License (version 2). Read the file COPYING that comes with GRASS
+#		for details.
+#
+#############################################################################
+
+#%module
+#% description: Calculates univariate statistics from the non-null cells for each registered vector map of a space time vector dataset
+#% keywords: temporal
+#% keywords: statistics
+#% keywords: vector
+#%end
+
+#%option G_OPT_STRDS_INPUT
+#%end
+
+#%option G_OPT_V_FIELD
+#%end
+
+#%option G_OPT_DB_COLUMN
+#% required: yes
+#%end
+
+#%option G_OPT_T_WHERE
+#% key: twhere
+#%end
+
+#%option G_OPT_DB_WHERE
+#%end
+
+#%option G_OPT_V_TYPE
+#% options: point,line,boundary,centroid,area
+#% multiple: no
+#% answer: point
+#%end
+
+#%option
+#% key: fs
+#% type: string
+#% description: The field separator character between the output columns
+#% required: no
+#% answer: |
+#%end
+
+#%flag
+#% key: e
+#% description: Calculate extended statistics
+#%end
+
+#%flag
+#% key: h
+#% description: Print column names 
+#%end
+
+import grass.script as grass
+import grass.temporal as tgis
+
+############################################################################
+
+def main():
+
+    # Get the options
+    input = options["input"]
+    twhere = options["twhere"]
+    layer = options["layer"]
+    type = options["type"]
+    column = options["column"]
+    where = options["where"]
+    extended = flags["e"]
+    header = flags["h"]
+    fs = options["fs"]
+
+    # Make sure the temporal database exists
+    tgis.create_temporal_database()
+    
+    tgis.print_vector_dataset_univar_statistics(input, twhere, layer, type, column, where, extended, header, fs)
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    main()
+


Property changes on: grass/trunk/temporal/t.vect.univar/t.vect.univar.py
___________________________________________________________________
Added: svn:executable
   + *

Added: grass/trunk/temporal/t.vect.univar/test.t.vect.univar.sh
===================================================================
--- grass/trunk/temporal/t.vect.univar/test.t.vect.univar.sh	                        (rev 0)
+++ grass/trunk/temporal/t.vect.univar/test.t.vect.univar.sh	2012-04-15 00:58:02 UTC (rev 51446)
@@ -0,0 +1,27 @@
+# Test the univar statistics of space time vector datasets
+
+# We need to set a specific region in the
+# @preprocess step of this test. 
+# The region setting should work for UTM and LL test locations
+g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
+# Data generation
+v.random --o -z output=rpoints1 zmin=0 zmax=100 seed=1 column=height n=100 
+v.random --o -z output=rpoints2 zmin=0 zmax=100 seed=2 column=height n=100 
+v.voronoi --o input=rpoints1 output=rvoronoi1
+v.voronoi --o input=rpoints2 output=rvoronoi2
+
+t.create --o type=stvds temporaltype=absolute output=random_data title="A test" descr="A test"
+t.register type=vect --v -i input=random_data maps=rpoints1,rpoints2,rvoronoi1,rvoronoi2 start="2001-01-15 12:05:45" increment="14 days"
+
+# The first @test
+t.vect.univar -h input=random_data column=height where='height > 50' twhere="start_time > '2000-01-01'" layer=1
+t.vect.univar -he input=random_data column=height where='height > 30' twhere="start_time > '2000-01-01'" layer=1
+t.vect.univar -he type=area input=random_data column=height where='height > 10' twhere="start_time > '2000-01-01'" layer=1
+t.vect.univar -he type=centroid input=random_data column=height where='height > 20' twhere="start_time > '2000-01-01'" layer=1
+t.vect.univar -h type=line input=random_data column=height where='height > 20' twhere="start_time > '2000-01-01'" layer=1
+
+# @postprocess
+t.unregister type=vect maps=rpoints1,rpoints2,rvoronoi1,rvoronoi2
+t.remove type=stvds input=random_data
+g.remove vect=rpoints1,rpoints2,rvoronoi1,rvoronoi2
+


Property changes on: grass/trunk/temporal/t.vect.univar/test.t.vect.univar.sh
___________________________________________________________________
Added: svn:executable
   + *



More information about the grass-commit mailing list