コード例 #1
0
 def parseSEED(self, data, expected_length=0):
     """
     If number of FIR coefficients are larger than maximal blockette size of
     9999 chars a follow up blockette with the same blockette id and
     response lookup key is expected - this is checked here.
     """
     # convert to stream for test issues
     if isinstance(data, bytes):
         expected_length = len(data)
         data = io.BytesIO(data)
     elif isinstance(data, (str, native_str)):
         raise TypeError("Data must be bytes, not string")
     # get current lookup key
     pos = data.tell()
     data.read(7)
     global_lookup_key = int(data.read(4))
     data.seek(pos)
     # read first blockette
     temp = io.BytesIO()
     temp.write(data.read(expected_length))
     # check next blockettes
     while True:
         # save position
         pos = data.tell()
         try:
             blockette_id = int(data.read(3))
         except ValueError:
             break
         if blockette_id != 41:
             # different blockette id -> break
             break
         blockette_length = int(data.read(4))
         lookup_key = int(data.read(4))
         if lookup_key != global_lookup_key:
             # different lookup key -> break
             break
         # ok follow up blockette found - skip some unneeded fields
         self.fields[1].read(data)
         self.fields[2].read(data)
         self.fields[3].read(data)
         self.fields[4].read(data)
         self.fields[5].read(data)
         # remaining length in current blockette
         length = pos - data.tell() + blockette_length
         # read follow up blockette and append it to temporary blockette
         temp.write(data.read(length))
     # reposition file pointer
     data.seek(pos)
     # parse new combined temporary blockette
     temp.seek(0, os.SEEK_END)
     _len = temp.tell()
     temp.seek(0)
     Blockette.parseSEED(self, temp, expected_length=_len)
コード例 #2
0
ファイル: blockette041.py プロジェクト: gthompson/obspy
 def parseSEED(self, data, expected_length=0):
     """
     If number of FIR coefficients are larger than maximal blockette size of
     9999 chars a follow up blockette with the same blockette id and
     response lookup key is expected - this is checked here.
     """
     # convert to stream for test issues
     if isinstance(data, bytes):
         expected_length = len(data)
         data = compatibility.BytesIO(data)
     elif isinstance(data, (str, native_str)):
         raise TypeError("Data must be bytes, not string")
     # get current lookup key
     pos = data.tell()
     data.read(7)
     global_lookup_key = int(data.read(4))
     data.seek(pos)
     # read first blockette
     temp = compatibility.BytesIO()
     temp.write(data.read(expected_length))
     # check next blockettes
     while True:
         # save position
         pos = data.tell()
         try:
             blockette_id = int(data.read(3))
         except ValueError:
             break
         if blockette_id != 41:
             # different blockette id -> break
             break
         blockette_length = int(data.read(4))
         lookup_key = int(data.read(4))
         if lookup_key != global_lookup_key:
             # different lookup key -> break
             break
         # ok follow up blockette found - skip some unneeded fields
         self.fields[1].read(data)
         self.fields[2].read(data)
         self.fields[3].read(data)
         self.fields[4].read(data)
         self.fields[5].read(data)
         # remaining length in current blockette
         length = pos - data.tell() + blockette_length
         # read follow up blockette and append it to temporary blockette
         temp.write(data.read(length))
     # reposition file pointer
     data.seek(pos)
     # parse new combined temporary blockette
     temp.seek(0, os.SEEK_END)
     _len = temp.tell()
     temp.seek(0)
     Blockette.parseSEED(self, temp, expected_length=_len)
コード例 #3
0
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         msg = 'The xsd-validation file for XML-SEED version 1.0 does ' + \
             'not support Blockette 62. It will be written but ' + \
             'please be aware that the file cannot be validated.\n' + \
             'If you want to validate your file please use XSEED ' + \
             'version 1.1.\n'
         sys.stdout.write(msg)
     return xml
コード例 #4
0
ファイル: blockette062.py プロジェクト: AntonyButcher/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         msg = 'The xsd-validation file for XML-SEED version 1.0 does ' + \
             'not support Blockette 62. It will be written but ' + \
             'please be aware that the file cannot be validated.\n' + \
             'If you want to validate your file please use XSEED ' + \
             'version 1.1.\n'
         sys.stdout.write(msg)
     return xml
コード例 #5
0
ファイル: blockette041.py プロジェクト: msimon00/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.find('FIR_coefficient').tag = 'fir_coefficient'
     return xml
コード例 #6
0
ファイル: blockette041.py プロジェクト: msimon00/obspy
 def parseXML(self, xml_doc, *args, **kwargs):
     if self.xseed_version == '1.0':
         xml_doc.find('fir_coefficient').tag = 'FIR_coefficient'
     Blockette.parseXML(self, xml_doc, *args, **kwargs)
コード例 #7
0
ファイル: blockette043.py プロジェクト: shineusn/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.tag = 'response_poles_and_zeros'
     return xml
コード例 #8
0
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.tag = 'response_coefficients'
     return xml
コード例 #9
0
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.tag = 'reponse_list'
     return xml
コード例 #10
0
ファイル: blockette043.py プロジェクト: AntonyButcher/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.tag = 'response_poles_and_zeros'
     return xml
コード例 #11
0
ファイル: blockette044.py プロジェクト: CSchwarz1234/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.tag = 'response_coefficients'
     return xml
コード例 #12
0
ファイル: blockette041.py プロジェクト: kasra-hosseini/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == "1.0":
         xml.find("FIR_coefficient").tag = "fir_coefficient"
     return xml
コード例 #13
0
ファイル: blockette041.py プロジェクト: kasra-hosseini/obspy
 def parseXML(self, xml_doc, *args, **kwargs):
     if self.xseed_version == "1.0":
         xml_doc.find("fir_coefficient").tag = "FIR_coefficient"
     Blockette.parseXML(self, xml_doc, *args, **kwargs)
コード例 #14
0
ファイル: blockette041.py プロジェクト: Ciack404/obspy
 def getXML(self, *args, **kwargs):
     xml = Blockette.getXML(self, *args, **kwargs)
     if self.xseed_version == '1.0':
         xml.find('FIR_coefficient').tag = 'fir_coefficient'
     return xml
コード例 #15
0
ファイル: blockette041.py プロジェクト: Ciack404/obspy
 def parseXML(self, xml_doc, *args, **kwargs):
     if self.xseed_version == '1.0':
         xml_doc.find('fir_coefficient').tag = 'FIR_coefficient'
     Blockette.parseXML(self, xml_doc, *args, **kwargs)