コード例 #1
0
    def __init__(self,
                 filename,
                 startoffset=0,
                 reclen=-1,
                 dataflag=0,
                 skipnotdata=1,
                 verbose=0,
                 raise_errors=True):

        self.msr = clibmseed.msr_init(C.POINTER(MSRecord)())
        self.msf = C.POINTER(MSFileParam)()  # NULL pointer
        self.file = filename

        # Best guess at off_t type
        self._c_off_t = C.c_long

        self.fpos = self._c_off_t(0)
        if startoffset != 0:
            self.fpos = self._c_off_t(-startoffset)

        self.reclen = reclen
        self.dataflag = 1 if dataflag else 0
        self.skipnotdata = 1 if skipnotdata else 0
        self.verbose = verbose
        self.raise_errors = raise_errors
コード例 #2
0
ファイル: slpacket.py プロジェクト: xinzhou1006/obspy
 def get_ms_record(self):
     # following from obspy.io.mseed.tests.test_libmseed.py -> test_msrParse
     msr = clibmseed.msr_init(None)
     pyobj = from_buffer(self.msrecord, dtype=np.int8)
     errcode = \
         clibmseed.msr_parse(pyobj, len(pyobj), C.pointer(msr), -1, 1, 1)
     if errcode != 0:
         msg = "failed to decode mini-seed record: msr_parse errcode: %s"
         raise SeedLinkException(msg % (errcode))
     # print "DEBUG: msr:", msr
     msrecord_py = msr.contents
     # print "DEBUG: msrecord_py:", msrecord_py
     return msr, msrecord_py
コード例 #3
0
ファイル: slpacket.py プロジェクト: Brtle/obspy
 def get_ms_record(self):
     # following from obspy.io.mseed.tests.test_libmseed.py -> test_msrParse
     msr = clibmseed.msr_init(None)
     pyobj = from_buffer(self.msrecord, dtype=np.int8)
     errcode = \
         clibmseed.msr_parse(pyobj, len(pyobj), C.pointer(msr), -1, 1, 1)
     if errcode != 0:
         msg = "failed to decode mini-seed record: msr_parse errcode: %s"
         raise SeedLinkException(msg % (errcode))
     # print "DEBUG: msr:", msr
     msrecord_py = msr.contents
     # print "DEBUG: msrecord_py:", msrecord_py
     return msr, msrecord_py