def create_parser(self, file_handle): """ This function creates a Vel3d_k_Wfp parser. """ parser = Vel3dKWfpParser(self.config, file_handle, self.exception_callback) return parser
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.vel3d_k_wfp', DataSetDriverConfigKeys.PARTICLE_CLASS: [ 'Vel3dKWfpMetadataParticle', 'Vel3dKWfpInstrumentParticle', 'Vel3dKWfpStringParticle' ] } def exception_callback(exception): log.debug("ERROR: " + exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = Vel3dKWfpParser(parser_config, None, stream_handle, lambda state, file: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def create_parser(self, file_handle, new_state): """ This function creates a Vel3d_k_Wfp parser. """ if new_state is None: new_state = self.state parser = Vel3dKWfpParser(self.config, new_state, file_handle, self.state_callback, self.pub_callback, self.exception_callback) return parser
def build_vel3d_k_wfp_parser(self, parser_state, file_handle): """ Build and return the vel3d_k_wfp parser. """ config = self._parser_config config.update({ 'particle_module': 'mi.dataset.parser.vel3d_k_wfp', 'particle_class': [ 'Vel3dKWfpInstrumentParticle', 'Vel3dKWfpMetadataParticle', 'Vel3dKWfpStringParticle' ] }) parser = Vel3dKWfpParser( config, parser_state, file_handle, lambda state, ingested: self._save_parser_state( state, DataTypeKey.VEL3D_K_WFP, ingested), self._data_callback, self._sample_exception_callback) return parser
def parse(unused, source_file_path, particle_data_handler): parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.vel3d_k_wfp', DataSetDriverConfigKeys.PARTICLE_CLASS: [ 'Vel3dKWfpMetadataParticle', 'Vel3dKWfpInstrumentParticle', 'Vel3dKWfpStringParticle' ] } def exception_callback(exception): log.debug("ERROR: %r", exception) particle_data_handler.setParticleDataCaptureFailure() with open(source_file_path, 'rb') as stream_handle: parser = Vel3dKWfpParser(parser_config, stream_handle, exception_callback) driver = DataSetDriver(parser, particle_data_handler) driver.processFileStream() return particle_data_handler