def setReplayMode(self, mode): super(BrasovIncidentWrapper, self).setReplayMode(mode) # fieldnames of service: "id", "comments", "createdon", "description", "guid", "incidentState", "incidentid", "indsoft_publiclyvisible", "statecode", "ticketnumber", "timestamp", "title", "x", "y" fieldnames = [ "id", "comments", "createdon", "description", "guid", "i", "incidentState", "incidentid", "indsoft_publiclyvisible", "statecode", "ticketnumber", "timestamp", "title", "x", "y", ] try: fobj = AbstractWrapper.getFileObject(__file__, "incidents%d.csv" % self.number, "rU") self.historyreader = CSVHistoryReader(self, fobj, delimiter=",") self.historyreader.multiple_observations = False self.historyparser = CSVParser(self, fieldnames) except Exception as e: Log.e("setReplayMode in Brasov Incident Wrapper", self.number, e) self.historyreader = None
def setReplayMode(self, mode): if mode: try: self.historyreader = CSVHistoryReader(self, AbstractWrapper.getFileObject(__file__, os.path.join("historicdata", "pollution-%s.csv" % self.sensorDescription.sensorID), "rU"), delimiter=';') self.historyparser = CSVParser(self, self.historyreader.headers) except Exception as e: Log.e(e) self.historyreader = None super(InternalBrasovWrapper, self).setReplayMode(mode)
def start(self): if self.replaymode: try: self.historyreader = CSVHistoryReader(self, AbstractWrapper.getFileObject(__file__, os.path.join("historicdata", "weatherAW-%s.csv" % self.sensorDescription.sensorID), "rU"), delimiter=';') self.historyparser = CSVParser(self, self.historyreader.headers) except Exception as e: Log.e(e) self.historyreader = None super(InternalWeatherAWWrapper, self).start()
def setReplayMode(self, mode): if mode: try: Log.i("loading history for", self.sensorDescription.sensorID, "...") self.historyreader = CSVHistoryReader(self, AbstractWrapper.getFileObject(__file__, os.path.join("historicdata", "trafficData%d.csv" % self.sensorDescription.sensorID), "rU")) self.historyreader.multiple_observations = False Log.i("done") self.historyparser = CSVParser(self, self.historyreader.headers) # connection will be set automatically by the AbstractComposedWrapper to SplitterConnection except Exception as e: Log.e(e) self.historyreader = None super(InternalWrapper, self).setReplayMode(mode)
def setReplayMode(self, mode): if mode: try: Log.i("loading history data for", self.sensorDescription.sensorID, "...") self.historyreader = CSVHistoryReader(self, AbstractWrapper.getFileObject(__file__, os.path.join("historicdata", "aarhus_parking-%s.csv" % self.sensorDescription.sensorID), "rU"), timestampfield="updatetime") # Must preserve the order as in the CSV but use the names as in senordescription.fields # vehiclecount,updatetime,_id,totalspaces,garagecode,streamtime self.historyparser = CSVParser(self, ["vehicleCount", "updatetime", "_id", "totalSpaces", "garageCode", "st"], timestampfield="updatetime") Log.i("done") except Exception as e: Log.e(e) self.historyreader = None super(InternalWrapper, self).setReplayMode(mode)