def _getCommonGranularity(self): allMaps = [] for dataset in self.timeseriesList: maps = self.timeseriesInfo[dataset]['maps'] allMaps.extend(maps) if self.temporalType == TemporalType.ABSOLUTE: gran = tgis.compute_absolute_time_granularity(allMaps) granNum, unit = gran.split() if self.granularityMode == GranularityMode.ONE_UNIT: granNum = 1 return int(granNum), unit if self.temporalType == TemporalType.RELATIVE: unit = self.timeseriesInfo[self.timeseriesList[0]]['unit'] granNum = tgis.compute_relative_time_granularity(allMaps) if self.granularityMode == GranularityMode.ONE_UNIT: granNum = 1 return (granNum, unit)
def main(): # Get the options name = options["input"] type = options["type"] where = options["where"] temporal_relations = flags['m'] spatio_temporal_relations = flags['s'] # Make sure the temporal database exists tgis.init() sp = tgis.open_old_stds(name, type) # Get ordered map list maps = sp.get_registered_maps_as_objects( where=where, order="start_time", dbif=None) spatial = None if spatio_temporal_relations: if sp.get_type() == "strds": spatial = "2D" else: spatial = "3D" if temporal_relations or spatio_temporal_relations: sp.print_spatio_temporal_relationships(maps=maps, spatial=spatial) return sp.base.print_info() # 0123456789012345678901234567890 print " +-------------------- Temporal topology -------------------------------------+" if where: print " | Is subset of dataset: ...... True" else: print " | Is subset of dataset: ...... False" check = sp.check_temporal_topology(maps) if check: # 0123456789012345678901234567890 print " | Temporal topology is: ...... valid" else: # 0123456789012345678901234567890 print " | Temporal topology is: ...... invalid" dict_ = sp.count_temporal_types(maps) for key in dict_.keys(): if key == "interval": # 0123456789012345678901234567890 print " | Number of intervals: ....... %s" % (dict_[key]) if key == "point": print " | Number of points: .......... %s" % (dict_[key]) if key == "invalid": print " | Invalid time stamps: ....... %s" % (dict_[key]) # 0123456789012345678901234567890 print " | Number of gaps: ............ %i" % sp.count_gaps(maps) if sp.is_time_absolute(): gran = tgis.compute_absolute_time_granularity(maps) else: gran = tgis.compute_relative_time_granularity(maps) print " | Granularity: ............... %s" % str(gran) print " +-------------------- Topological relations ---------------------------------+" dict_ = sp.count_temporal_relations(maps) if dict_: for key in dict_.keys(): if key == "equal": # 0123456789012345678901234567890 print " | Equal:...................... %s" % (dict_[key]) if key == "during": print " | During: .................... %s" % (dict_[key]) if key == "contains": print " | Contains: .................. %s" % (dict_[key]) if key == "overlaps": print " | Overlaps: .................. %s" % (dict_[key]) if key == "overlapped": print " | Overlapped: ................ %s" % (dict_[key]) if key == "after": print " | After: ..................... %s" % (dict_[key]) if key == "before": print " | Before: .................... %s" % (dict_[key]) if key == "starts": print " | Starts: .................... %s" % (dict_[key]) if key == "finishes": print " | Finishes: .................. %s" % (dict_[key]) if key == "started": print " | Started: ................... %s" % (dict_[key]) if key == "finished": print " | Finished: .................. %s" % (dict_[key]) if key == "follows": print " | Follows: ................... %s" % (dict_[key]) if key == "precedes": print " | Precedes: .................. %s" % (dict_[key]) print " +----------------------------------------------------------------------------+"