[GRASS-SVN] r48787 - grass/trunk/temporal/t.topology
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 13 18:36:08 EDT 2011
Author: huhabla
Date: 2011-10-13 15:36:08 -0700 (Thu, 13 Oct 2011)
New Revision: 48787
Modified:
grass/trunk/temporal/t.topology/t.topology.py
Log:
More temporal topology info
Modified: grass/trunk/temporal/t.topology/t.topology.py
===================================================================
--- grass/trunk/temporal/t.topology/t.topology.py 2011-10-13 21:58:30 UTC (rev 48786)
+++ grass/trunk/temporal/t.topology/t.topology.py 2011-10-13 22:36:08 UTC (rev 48787)
@@ -31,7 +31,7 @@
#%option
#% key: type
#% type: string
-#% description: Type of the space time dataset, default is strds (space time raster dataset)
+#% description: Type of the space time dataset, default is space time raster dataset (strds)
#% required: no
#% options: strds, str3ds, stvds
#% answer: strds
@@ -39,9 +39,19 @@
#%flag
#% key: t
-#% description: Print temporal relation matrix for space time datasets
+#% description: Print temporal relation matrix and exit
#%end
+#%flag
+#% key: r
+#% description: Print temporal relation count
+#%end
+
+#%flag
+#% key: m
+#% description: Print temporal map type count
+#%end
+
import grass.script as grass
import grass.temporal as tgis
@@ -53,6 +63,8 @@
name = options["input"]
type = options["type"]
tmatrix = flags['t']
+ relation = flags['r']
+ map_types = flags['m']
# Make sure the temporal database exists
tgis.create_temporal_database()
@@ -70,15 +82,6 @@
sp = tgis.space_time_raster3d_dataset(id)
if type == "stvds":
sp = tgis.space_time_vector_dataset(id)
- if type == "rast":
- sp = tgis.raster_dataset(id)
- tmatrix = False
- if type == "rast3d":
- sp = tgis.raster3d_dataset(id)
- tmatrix = False
- if type == "vect":
- sp = tgis.vector_dataset(id)
- tmatrix = False
if sp.is_in_db() == False:
grass.fatal("Dataset <" + name + "> not found in temporal database")
@@ -86,15 +89,30 @@
# Insert content from db
sp.select()
+ maps = sp.get_registered_maps_as_objects()
+
if tmatrix:
- matrix = sp.get_temporal_relation_matrix()
+ matrix = sp.get_temporal_relation_matrix(maps)
for row in matrix:
for col in row:
print col,
print " "
print " "
+ return
+ if relation:
+ dict = sp.get_temporal_relations_count(maps)
+
+ for key in dict.keys():
+ print key, dict[key]
+
+ if map_types:
+ dict = sp.get_temporal_map_type_count(maps)
+
+ for key in dict.keys():
+ print key, dict[key]
+
if __name__ == "__main__":
options, flags = grass.parser()
main()
More information about the grass-commit
mailing list