소스 검색

Added temporal granularity computation to t.topology.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48848 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 13 년 전
부모
커밋
f540355cb5
1개의 변경된 파일18개의 추가작업 그리고 4개의 파일을 삭제
  1. 18 4
      temporal/t.topology/t.topology.py

+ 18 - 4
temporal/t.topology/t.topology.py

@@ -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 @@ def main():
     # 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 @@ def main():
     # 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,10 +125,14 @@ def main():
         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()