[GRASS-SVN] r48848 - grass/trunk/temporal/t.topology
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 18 10:20:37 EDT 2011
Author: huhabla
Date: 2011-10-18 07:20:37 -0700 (Tue, 18 Oct 2011)
New Revision: 48848
Modified:
grass/trunk/temporal/t.topology/t.topology.py
Log:
Added temporal granularity computation to t.topology.
Modified: grass/trunk/temporal/t.topology/t.topology.py
===================================================================
--- grass/trunk/temporal/t.topology/t.topology.py 2011-10-18 14:19:55 UTC (rev 48847)
+++ grass/trunk/temporal/t.topology/t.topology.py 2011-10-18 14:20:37 UTC (rev 48848)
@@ -37,11 +37,18 @@
#% answer: strds
#%end
+#%option G_OPT_DB_WHERE
+#%end
+
#%flag
#% key: c
#% description: Check temporal topology
#%end
+#%flag
+#% key: g
+#% description: Compute granularity
+#%end
#%flag
#% key: t
@@ -68,10 +75,12 @@
# Get the options
name = options["input"]
type = options["type"]
+ where = options["where"]
tmatrix = flags['t']
relation = flags['r']
map_types = flags['m']
check_topo = flags['c']
+ comp_gran = flags['g']
# Make sure the temporal database exists
tgis.create_temporal_database()
@@ -91,7 +100,8 @@
# Insert content from db
sp.select()
- maps = sp.get_registered_maps_as_objects()
+ # Get ordered map list
+ maps = sp.get_registered_maps_as_objects(where=where, order="start_time", dbif=None)
if check_topo:
check = sp.check_temporal_topology(maps)
@@ -115,11 +125,15 @@
for key in dict.keys():
print key, dict[key]
- if dict["interval"] > 0 and dict["point"] == 0 and dict["invalid"] == 0:
- print "Gaps", sp.count_gaps(maps, True)
+ if dict["invalid"] == 0:
+ print "Gaps", sp.count_gaps(maps)
else:
- print "Gaps", sp.count_gaps(maps, False)
+ print "Gaps", None
+ if comp_gran:
+ gran = tgis.compute_absolute_time_granularity(maps)
+ print "Granularity", gran
+
if __name__ == "__main__":
options, flags = grass.parser()
main()
More information about the grass-commit
mailing list