def read(self, reclen=-1, dataflag=1, skipnotdata=1, verbose=0, raise_flag=True): """ Read MSRecord using the ms_readmsr_r function. The following parameters are directly passed to ms_readmsr_r. :param ms: _MSStruct (actually consists of a LP_MSRecord, LP_MSFileParam and an attached file pointer). Given an existing ms the function is much faster. :param reclen: If reclen is 0 the length of the first record is auto- detected. All subsequent records are then expected to have the same record length. If reclen is negative the length of every record is automatically detected. Defaults to -1. :param dataflag: Controls whether data samples are unpacked, defaults to 1. :param skipnotdata: If true (not zero) any data chunks read that to do not have valid data record indicators will be skipped. Defaults to True (1). :param verbose: Controls verbosity from 0 to 2. Defaults to None (0). :param record_number: Number of the record to be read. The first record has the number 0. Negative numbers will start counting from the end of the file, e.g. -1 is the last complete record. """ errcode = clibmseed.ms_readmsr_r(C.pointer(self.msf), C.pointer(self.msr), self.file.encode('ascii', 'strict'), reclen, None, None, skipnotdata, dataflag, verbose) if raise_flag: if errcode != MS_NOERROR: raise Exception("Error %d in ms_readmsr_r" % errcode) return errcode
def __del__(self): """ Method for deallocating MSFileParam and MSRecord structure. """ errcode = clibmseed.ms_readmsr_r(C.pointer(self.msf), C.pointer(self.msr), None, -1, None, None, 0, 0, 0) if errcode != MS_NOERROR: raise Exception("Error %d in ms_readmsr_r" % errcode)