def remove_network(self, code, start): try: del self.network[code][start] if len(self.network[code]) == 0: del self.network[code] except KeyError: raise DBError("Network [%s][%s] not found" % (code, start))
def insert_responseFAP(self, name, **args): if name in self.responseFAP: raise DBError("ResponseFAP %s already defined" % name) obj = _ResponseFAP(self, name, args) self.responseFAP[name] = obj self.object[obj.publicID] = obj return obj
def remove_decimation(self, sampleRateNumerator, sampleRateDenominator): try: del self.decimation[sampleRateNumerator][sampleRateDenominator] if len(self.decimation[sampleRateNumerator]) == 0: del self.decimation[sampleRateNumerator] except KeyError: raise DBError("Decimation [%s][%s] not found" % (sampleRateNumerator, sampleRateDenominator))
def remove_auxStream(self, code, start): try: del self.auxStream[code][start] if len(self.auxStream[code]) == 0: del self.auxStream[code] except KeyError: raise DBError("AuxStream [%s][%s] not found" % (code, start))
def insert_datalogger(self, name, **args): if name in self.datalogger: raise DBError("Datalogger %s already defined" % name) obj = _Datalogger(self, name, args) self.datalogger[name] = obj self.object[obj.publicID] = obj return obj
def insert_sensor(self, name, **args): if name in self.sensor: raise DBError("Sensor %s already defined" % name) obj = _Sensor(self, name, args) self.sensor[name] = obj self.object[obj.publicID] = obj return obj
def insert_auxDevice(self, name, **args): if name in self.auxDevice: raise DBError("AuxDevice %s already defined" % name) obj = _AuxDevice(self, name, args) self.auxDevice[name] = obj self.object[obj.publicID] = obj return obj
def close(self): root = self.__p.close() if root.tag != _root_tag: raise DBError("unrecognized root element: " + root.tag) xinventory = _xmlwrap.xml_Inventory(root) _xmldoc_in(xinventory, self.__inventory)
def insert_stationGroup(self, code, **args): if code in self.stationGroup: raise DBError("StationGroup %s already defined" % code) obj = _StationGroup(self, code, args) self.stationGroup[code] = obj self.object[obj.publicID] = obj return obj
def remove_station(self, code, start): try: del self.station[code][start] if len(self.station[code]) == 0: del self.station[code] except KeyError: raise DBError("Station [%s][%s] not found" % (code, start))
def insert_decimation(self, sampleRateNumerator, sampleRateDenominator, **args): if sampleRateNumerator not in self.decimation: self.decimation[sampleRateNumerator] = {} if sampleRateDenominator in self.decimation[sampleRateNumerator]: raise DBError("Decimation [%s][%s] already defined" % (sampleRateNumerator, sampleRateDenominator)) obj = _Decimation(self, sampleRateNumerator, sampleRateDenominator, args) self.decimation[sampleRateNumerator][sampleRateDenominator] = obj return obj
def insert_auxStream(self, code, start, **args): if code not in self.auxStream: self.auxStream[code] = {} if start in self.auxStream[code]: raise DBError("AuxStream [%s][%s] already defined" % (code, start)) obj = _AuxStream(self, code, start, args) self.auxStream[code][start] = obj return obj
def xml_in(inventory, src): doc = ET.parse(src) root = doc.getroot() if root.tag != _root_tag: raise DBError("unrecognized root element: " + root.tag) xinventory = _xmlwrap.xml_Inventory(root) _xmldoc_in(xinventory, inventory)
def insert_network(self, code, start, **args): if code not in self.network: self.network[code] = {} if start in self.network[code]: raise DBError("Network [%s][%s] already defined" % (code, start)) obj = _Network(self, code, start, args) self.network[code][start] = obj self.object[obj.publicID] = obj return obj
def insert_sensorLocation(self, code, start, **args): if code not in self.sensorLocation: self.sensorLocation[code] = {} if start in self.sensorLocation[code]: raise DBError("SensorLocation [%s][%s] already defined" % (code, start)) obj = _SensorLocation(self, code, start, args) self.sensorLocation[code][start] = obj self.object[obj.publicID] = obj return obj
def insert_stream(self, code, start, **args): if code not in self.stream: self.stream[code] = {} if start in self.stream[code]: raise DBError("Stream [%s][%s] already defined" % (code, start)) obj = _Stream(self, code, start, args) self.stream[code][start] = obj self.object[obj.publicID] = obj return obj
def remove_calibration(self, serialNumber, channel, start): try: del self.calibration[serialNumber][channel][start] if len(self.calibration[serialNumber][channel]) == 0: del self.calibration[serialNumber][channel] if len(self.calibration[serialNumber]) == 0: del self.calibration[serialNumber] except KeyError: raise DBError("DataloggerCalibration [%s][%s][%s] not found" % (serialNumber, channel, start))
def insert_calibration(self, serialNumber, channel, start, **args): if serialNumber not in self.calibration: self.calibration[serialNumber] = {} if channel not in self.calibration[serialNumber]: self.calibration[serialNumber][channel] = {} if start in self.calibration[serialNumber][channel]: raise DBError("DataloggerCalibration [%s][%s][%s] already defined" % (serialNumber, channel, start)) obj = _DataloggerCalibration(self, serialNumber, channel, start, args) self.calibration[serialNumber][channel][start] = obj return obj
def remove_stationGroup(self, code): try: del self.stationGroup[code] except KeyError: raise DBError("StationGroup [%s] not found" % (code))
def remove_auxDevice(self, name): try: del self.auxDevice[name] except KeyError: raise DBError("AuxDevice [%s] not found" % (name))
def remove_sensor(self, name): try: del self.sensor[name] except KeyError: raise DBError("Sensor [%s] not found" % (name))
def remove_comment(self, id): try: del self.comment[id] except KeyError: raise DBError("Comment [%s] not found" % (id))
def insert_comment(self, id, **args): if id in self.comment: raise DBError("Comment %s already defined" % id) obj = _Comment(self, id, args) self.comment[id] = obj return obj
def remove_datalogger(self, name): try: del self.datalogger[name] except KeyError: raise DBError("Datalogger [%s] not found" % (name))
def insert_stationReference(self, stationID, **args): if stationID in self.stationReference: raise DBError("StationReference %s already defined" % stationID) obj = _StationReference(self, stationID, args) self.stationReference[stationID] = obj return obj
def remove_source(self, name): try: del self.source[name] except KeyError: raise DBError("AuxSource [%s] not found" % (name))
def insert_source(self, name, **args): if name in self.source: raise DBError("AuxSource %s already defined" % name) obj = _AuxSource(self, name, args) self.source[name] = obj return obj
def remove_responsePolynomial(self, name): try: del self.responsePolynomial[name] except KeyError: raise DBError("ResponsePolynomial [%s] not found" % (name))
def remove_responseFAP(self, name): try: del self.responseFAP[name] except KeyError: raise DBError("ResponseFAP [%s] not found" % (name))
def remove_stationReference(self, stationID): try: del self.stationReference[stationID] except KeyError: raise DBError("StationReference [%s] not found" % (stationID))