[GRASS-SVN] r48778 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 13 08:42:15 EDT 2011
Author: huhabla
Date: 2011-10-13 05:42:15 -0700 (Thu, 13 Oct 2011)
New Revision: 48778
Modified:
grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
Log:
New function to print the temporal relationship matrix
Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2011-10-13 12:23:08 UTC (rev 48777)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2011-10-13 12:42:15 UTC (rev 48778)
@@ -107,6 +107,38 @@
return granularity, temporal_type, semantic_type, title, description
+ def print_temporal_relation_matrix(self, dbif=None):
+ """Print the temporal relation matrix of all registered maps to stdout
+
+ The temproal relation matrix includes the temporal relations between
+ all registered maps. The relations are strings stored in a list of lists.
+
+ @param dbif: The database interface to be used
+ """
+
+ connect = False
+
+ if dbif == None:
+ dbif = sql_database_interface()
+ dbif.connect()
+ connect = True
+
+ matrix = []
+
+ maps = self.get_registered_maps_as_objects(where=None, order="start_time", dbif=dbif)
+
+ for map in maps:
+ print map.get_id(),
+ print " "
+
+ for mapA in maps:
+ for mapB in maps:
+ print mapA.temporal_relation(mapB),
+ print " "
+
+ if connect == True:
+ dbif.close()
+
def get_temporal_relation_matrix(self, dbif=None):
"""Return the temporal relation matrix of all registered maps as listof lists
More information about the grass-commit
mailing list