Ejemplo n.º 1
0
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    from mi.logging import config
    config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml'))
    log = get_logger()

    config = {
            DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcps_jln',
            DataSetDriverConfigKeys.PARTICLE_CLASS: 'AdcpsJlnParticle'
        }
    log.trace("My ADCPS JLN Config: %s", config)

    def exception_callback(exception):
        log.debug("ERROR: " + exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()
    
    with open(sourceFilePath, 'rb') as file_handle:
        parser = AdcpPd0Parser(config, None, file_handle,
            lambda state, ingested: None,
            lambda data: None, exception_callback)
        
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream() 
  
    return particleDataHdlrObj
Ejemplo n.º 2
0
    def process(self):

        log = get_logger()

        try:
            file_handle = open(self._sourceFilePath, 'rb')
            filesize = os.path.getsize(file_handle.name)
            state = None
            parser_state = None
            
            def state_callback(state, ingested):
                pass
        
            def pub_callback(data):
                log.trace("Found data: %s", data)
            
            def sample_exception_callback(exception):
                self._particleDataHdlrObj.setParticleDataCaptureFailure()
                    
            parser = CtdpfCklWfpParser(self._config, parser_state, file_handle, lambda state, 
                                       ingested: state_callback(state, ingested), pub_callback, 
                                       sample_exception_callback, filesize)
    
            driver = DataSetDriver(parser, self._particleDataHdlrObj)
        
            driver.processFileStream()  
        finally:
            file_handle.close()
        
        return self._particleDataHdlrObj
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.flord_l_wfp',
        DataSetDriverConfigKeys.PARTICLE_CLASS: 'FlordLWfpInstrumentParserDataParticle'
    }

    def exception_callback(exception):
        log.debug("ERROR: %r", exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()

    with open(sourceFilePath, 'r') as stream_handle:
        parser = GlobalWfpEFileParser(parser_config, None,
                                      stream_handle,
                                      lambda state, ingested: None,
                                      lambda data: log.trace("Found data: %s", data),
                                      exception_callback)

        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()

    return particleDataHdlrObj
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: %r", 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 parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    from mi.logging import config
    config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml'))
    log = get_logger()

    config = {
        DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcps_jln_stc',
        DataSetDriverConfigKeys.PARTICLE_CLASS: None,
        DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: {
            AdcpsJlnStcParticleClassKey.METADATA_PARTICLE_CLASS:
                AdcpsJlnStcMetadataRecoveredDataParticle,
            AdcpsJlnStcParticleClassKey.INSTRUMENT_PARTICLE_CLASS:
                AdcpsJlnStcInstrumentRecoveredDataParticle,
        }
    }
    log.debug("My ADCPS JLN STC Config: %s", config)

    def exception_callback(exception):
        log.debug("ERROR: %r", exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()

    with open(sourceFilePath, 'rb') as file_handle:
        parser = AdcpsJlnStcParser(config,
                                   None,
                                   file_handle,
                                   lambda state, ingested: None,
                                   lambda data: None,
                                   exception_callback)
                
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()  
        
    return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    try:
        if basePythonCodePath is not None:
            pass
    except NameError:
        basePythonCodePath = os.curdir
    sys.path.append(basePythonCodePath)

    from mi.logging import config
    config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml'))
    
    from mi.core.log import get_logger
    log = get_logger()

    """
    Build and return the parser
    """
    config = {
        DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdpf_ckl_wfp_particles',
        DataSetDriverConfigKeys.PARTICLE_CLASS: None,
        DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: {
            'instrument_data_particle_class': CtdpfCklWfpTelemeteredDataParticle,
            'metadata_particle_class': CtdpfCklWfpTelemeteredMetadataParticle
        }
    }
    log.debug("My Config: %s", config)
    driver = CtdpfCklWfpDriver(sourceFilePath, particleDataHdlrObj, config)
        
    return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):
    """
    This is the method called by Uframe
    :param basePythonCodePath This is the file system location of mi-dataset
    :param sourceFilePath This is the full path and filename of the file to be parsed
    :param particleDataHdlrObj Java Object to consume the output of the parser
    :return particleDataHdlrObj
    """

    log = get_logger()

    with open(sourceFilePath, 'rb') as stream_handle:

        def exception_callback(exception):
                log.debug("Exception: %s", exception)
                particleDataHdlrObj.setParticleDataCaptureFailure()

        parser_config = {
            DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdmo_ghqr_sio',
            DataSetDriverConfigKeys.PARTICLE_CLASS: ['CtdmoGhqrSioTelemeteredInstrumentDataParticle',
                                                     'CtdmoGhqrSioTelemeteredOffsetDataParticle']
        }

        parser = CtdmoGhqrSioTelemeteredParser(parser_config, stream_handle, exception_callback)

        # create and instance of the concrete driver class defined below
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()

    return particleDataHdlrObj
Ejemplo n.º 8
0
    def process(self):
        """
        Process a file by opening the file and instantiating a parser and driver
        """
        log = get_logger()

        with open(self._source_file_path, "rb") as file_handle:
            def exception_callback(exception):
                log.debug("Exception %s", exception)
                self._particle_data_hdlr_obj.setParticleDataCaptureFailure()

            # essentially comment out the state and data callbacks by inserting
            # lambda with None functions, so it doesn't complain about not being
            # able to pass arguments
            parser = GliderEngineeringParser(self._parser_config, None,
                                             file_handle,
                                             lambda state, ingested: None,
                                             lambda data: None,
                                             exception_callback)

            # instantiate the driver
            driver = DataSetDriver(parser, self._particle_data_hdlr_obj)
            # start the driver processing the file
            driver.processFileStream()

        return self._particle_data_hdlr_obj
def parse(unused, source_file_path, particle_data_handler):
    """
    This is the method called by Uframe
    :param unused
    :param source_file_path This is the full path and filename of the file to be parsed
    :param particle_data_handler Java Object to consume the output of the parser
    :return particle_data_handler
    """
    log = get_logger()

    with open(source_file_path, 'r') as stream_handle:

        def exception_callback(exception):
                log.debug("Exception: %s", exception)
                particle_data_handler.setParticleDataCaptureFailure()

        # extract the serial number from the file name
        serial_num = get_serial_num_from_filepath(source_file_path)

        parser_config = {
            DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdmo_ghqr_sio',
            DataSetDriverConfigKeys.PARTICLE_CLASS: ['CtdmoGhqrRecoveredInstrumentDataParticle'],
            INDUCTIVE_ID_KEY: serial_num
        }

        parser = CtdmoGhqrRecoveredCtParser(parser_config, stream_handle, exception_callback)

        # create and instance of the concrete driver class defined below
        driver = DataSetDriver(parser, particle_data_handler)
        driver.processFileStream()

    return particle_data_handler
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.nutnr_b_particles',
        DataSetDriverConfigKeys.PARTICLE_CLASS: None
    }

    def exception_callback(exception):
        log.debug("ERROR: " + exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()
    
    with open(sourceFilePath, 'r') as stream_handle:
        parser = NutnrBDclConcRecoveredParser(parser_config,
                                              stream_handle,
                                              lambda state, ingested : None,
                                              lambda data : None,
                                              exception_callback)
        
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()    

        
    return particleDataHdlrObj
Ejemplo n.º 11
0
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    from mi.logging import config
    config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml'))
    log = get_logger()

    config = {
        DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: {
            'velocity': 'VelocityEarth',
            'engineering': 'AdcpsEngineering',
            'config': 'AdcpsConfig',
            'bottom_track': 'EarthBottom',
            'bottom_track_config': 'BottomConfig',
        }
    }
    log.trace("My ADCPS JLN Config: %s", config)

    def exception_callback(exception):
        log.error("ERROR: %r", exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()

    with open(sourceFilePath, 'rb') as file_handle:
        parser = AdcpPd0Parser(config, file_handle, exception_callback)

        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()

    return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):
    from mi.logging import config

    config.add_configuration(os.path.join(basePythonCodePath, "res", "config", "mi-logging.yml"))

    from mi.core.log import get_logger

    log = get_logger()

    from mi.dataset.dataset_driver import DataSetDriver, ParticleDataHandler

    from mi.dataset.parser.parad_k_stc_imodem import Parad_k_stc_imodemParser
    from mi.dataset.dataset_parser import DataSetDriverConfigKeys

    config = {
        DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.parad_k_stc_imodem",
        DataSetDriverConfigKeys.PARTICLE_CLASS: "Parad_k_stc_imodemDataParticle",
    }

    try:
        if particleDataHdlrObj is not None:
            pass
    except NameError:
        particleDataHdlrObj = ParticleDataHandler()

    try:
        if sourceFilePath is not None:
            pass
    except NameError:
        try:
            sourceFilePath = sys.argv[1]
        except IndexError:
            print "Need a source file path"
            sys.exit(1)

    def state_callback(state, ingested):
        pass

    def pub_callback(data):
        log.trace("Found data: %s", data)

    def exception_callback(exception):
        particleDataHdlrObj.setParticleDataCaptureFailure()

    stream_handle = open(sourceFilePath, "rb")

    try:
        parser = Parad_k_stc_imodemParser(config, None, stream_handle, state_callback, pub_callback, exception_callback)

        driver = DataSetDriver(parser, particleDataHdlrObj)

        driver.processFileStream()

    finally:
        stream_handle.close()

    stream_handle = open(sourceFilePath, "rb")
    return particleDataHdlrObj
Ejemplo n.º 13
0
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    log = get_logger()

    with open(sourceFilePath, "r") as stream_handle:

        def exception_callback(exception):
                log.debug("Exception: %s", exception)
                particleDataHdlrObj.setParticleDataCaptureFailure()

        parser = CtdbpCdefCpParser({}, stream_handle, exception_callback)
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()
    return particleDataHdlrObj
    def process(self):
        log = get_logger()

        with open(self._sourceFilePath, "r") as file_handle:
            def exception_callback(exception):
                log.debug("Exception: %s", exception)
                self._particleDataHdlrObj.setParticleDataCaptureFailure()

            parser = FlortDjDclParser(self._parser_config, file_handle, exception_callback)

            driver = DataSetDriver(parser, self._particleDataHdlrObj)

            driver.processFileStream()

        return self._particleDataHdlrObj
    def process(self):
        log = get_logger()

        with open(self._source_file_path, "rb") as file_handle:
            def exception_callback(exception):
                log.debug("Exception: %s", exception)
                self._particle_data_handler.setParticleDataCaptureFailure()

            parser = OptaaDjDclParser(self._parser_config,
                                      file_handle, exception_callback, self._source_file_path, True)

            driver = DataSetDriver(parser, self._particle_data_handler)

            driver.processFileStream()

        return self._particle_data_handler
    def process(self):
        
        log = get_logger()
        
        def exception_callback(exception):
            log.debug("ERROR: %r", exception)
            self._particleDataHdlrObj.setParticleDataCaptureFailure()

        with open(self._sourceFilePath, 'r') as stream_handle:
            parser = CgCpmEngCpmParser(self._parser_config, stream_handle,
                                       exception_callback)
            
            driver = DataSetDriver(parser, self._particleDataHdlrObj)
            driver.processFileStream()    
        
        return self._particleDataHdlrObj
    def process(self):
        
        log = get_logger()
        
        def exception_callback(exception):
            log.debug("ERROR: " + exception)
            self._particleDataHdlrObj.setParticleDataCaptureFailure()

        with open(self._sourceFilePath, 'rb') as stream_handle:
            parser = CgStcEngStcParser(self._parser_config, None, stream_handle,
                                        lambda state, ingested: None,
                                        lambda data: None, exception_callback)
            
            driver = DataSetDriver(parser, self._particleDataHdlrObj)
            driver.processFileStream()    
        
        return self._particleDataHdlrObj
Ejemplo n.º 18
0
    def process(self):
        log = get_logger()

        def exception_callback(exception):
            log.debug("ERROR: %r", exception)
            self._particleDataHdlrObj.setParticleDataCaptureFailure()

        pathList = (self._sourceFilePath.split('/'))
        filename = pathList[len(pathList) - 1]

        with open(self._sourceFilePath, 'rb') as stream_handle:
            parser = MopakODclParser(self._parser_config, stream_handle,
                                     filename, exception_callback)

            driver = DataSetDriver(parser, self._particleDataHdlrObj)
            driver.processFileStream()

        return self._particleDataHdlrObj
    def process(self):
        """
        Process a file by opening the file and instantiating a parser and driver
        @return: processed particle data handler object
        """
        log = get_logger()

        with open(self._sourceFilePath, "r") as file_handle:
            def exception_callback(exception):
                log.warn("Exception: %s", exception)
                self._particleDataHdlrObj.setParticleDataCaptureFailure()

            # instantiate the parser
            parser = WavssADclParser(file_handle, exception_callback, True)
            # instantiate the driver
            driver = DataSetDriver(parser, self._particleDataHdlrObj)
            # start the driver processing the file
            driver.processFileStream()

        return self._particleDataHdlrObj
    def process(self):
        log = get_logger()

        with open(self._sourceFilePath, "r") as file_handle:
            def exception_callback(exception):
                log.debug("Exception: %s", exception)
                self._particleDataHdlrObj.setParticleDataCaptureFailure()

            parser = SpkirAbjDclTelemeteredParser(self._parser_config,
                                                  file_handle,
                                                  None,
                                                  lambda state, ingested: None,
                                                  lambda data: None,
                                                  exception_callback)

            driver = DataSetDriver(parser, self._particleDataHdlrObj)

            driver.processFileStream()

        return self._particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj, serialNumToInductiveIdMapHandler):
    """
    This is the method called by Uframe
    :param basePythonCodePath This is the file system location of mi-dataset
    :param sourceFilePath This is the full path and filename of the file to be parsed
    :param particleDataHdlrObj Java Object to consume the output of the parser
    :return particleDataHdlrObj
    """

    log = get_logger()

    with open(sourceFilePath, 'r') as stream_handle:

        def exception_callback(exception):
                log.debug("Exception: %s", exception)
                particleDataHdlrObj.setParticleDataCaptureFailure()

        # extract the serial number from the file name
        serial_num = get_serial_num_from_filepath(sourceFilePath)

        # retrieve the inductive ID associated with the serial number
        induct_id = serialNumToInductiveIdMapHandler.getInductiveId(serial_num)

        if not induct_id:
            raise DatasetParserException(
                "Unable to obtain the inductive ID associated with serial num %d",
                serial_num)

        parser_config = {
            DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdmo_ghqr_sio',
            DataSetDriverConfigKeys.PARTICLE_CLASS: ['CtdmoGhqrRecoveredInstrumentDataParticle'],
            INDUCTIVE_ID_KEY: induct_id
        }

        parser = CtdmoGhqrRecoveredCtParser(parser_config, stream_handle, exception_callback)

        # create and instance of the concrete driver class defined below
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()

    return particleDataHdlrObj
Ejemplo n.º 22
0
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    log = get_logger()

    with open(sourceFilePath, "r") as stream_handle:

        def exception_callback(exception):
                log.debug("Exception: %s", exception)
                particleDataHdlrObj.setParticleDataCaptureFailure()

        parser = CtdbpCdefCpParser(
            {DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.ctdbp_cdef_cp",
             DataSetDriverConfigKeys.PARTICLE_CLASS: None},
             stream_handle,
             lambda state, ingested: None,
             lambda data: None,
             exception_callback
        )
        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()
    return particleDataHdlrObj
Ejemplo n.º 23
0
    def process(self):
        
        log = get_logger()

        with open(self._source_file_path,"rb") as file_handle:

            def exception_callback(exception):
                log.debug("Exception: %s", exception)
                self._particle_data_handler.setParticleDataCaptureFailure()
                    
            parser = WfpEngStcImodemParser(self._parser_config,
                                           None, file_handle,
                                           lambda state, ingested: None,
                                           lambda data: None,
                                           exception_callback)
    
            driver = DataSetDriver(parser, self._particle_data_handler)

            driver.processFileStream()

        return self._particle_data_handler
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_stc",
        DataSetDriverConfigKeys.PARTICLE_CLASS: ["Vel3dKWfpStcMetadataParticle", "Vel3dKWfpStcInstrumentParticle"],
    }

    def exception_callback(exception):
        log.debug("ERROR: %r", exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()

    with open(sourceFilePath, "rb") as stream_handle:
        parser = Vel3dKWfpStcParser(parser_config, stream_handle, exception_callback)

        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()

    return particleDataHdlrObj
Ejemplo n.º 25
0
def parse(unused, source_file_path, particle_data_handler):

    log = get_logger()

    with open(source_file_path, "r") as stream_handle:

        def exception_callback(exception):
                log.debug("Exception: %s", exception)
                particle_data_handler.setParticleDataCaptureFailure()

        parser = DostaLnWfpParser(
            {DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.dosta_ln_wfp',
             DataSetDriverConfigKeys.PARTICLE_CLASS: 'DostaLnWfpInstrumentParserDataParticle'},
             {StateKey.POSITION: 0},
             stream_handle,
             lambda state, ingested: None,
             lambda data: None,
             exception_callback
        )
        driver = DataSetDriver(parser, particle_data_handler)
        driver.processFileStream()
    return particle_data_handler
Ejemplo n.º 26
0
    def process(self):
    
        log = get_logger()

        with open(self._sourceFilePath, 'rb') as file_handle:

            def exception_callback(exception):
                log.debug('Exception: %s', exception)
                self._particleDataHdlrObj.setParticleDataCaptureFailure()

            parser = GliderParser(self._config,
                                  None,
                                  file_handle,
                                  lambda state, ingested: None,
                                  lambda data: None,
                                  exception_callback)

            driver = DataSetDriver(parser, self._particleDataHdlrObj)

            driver.processFileStream()

        return self._particleDataHdlrObj
Ejemplo n.º 27
0
    def process(self):
    
        log = get_logger()
        stream_handle = open(self._sourceFilePath, 'rb')
        filesize = os.path.getsize(stream_handle.name)
        
        def state_callback(state, ingested):
            pass

        def pub_callback(data):
            log.trace("Found data: %s", data)
        
        def exp_callback(exception):
            self._particleDataHdlrObj.setParticleDataCaptureFailure()
        
        try:
            parser = DofstKWfpParser(self._config, None, stream_handle, state_callback, pub_callback, exp_callback, filesize)
            driver = DataSetDriver(parser, self._particleDataHdlrObj)
            driver.processFileStream()
            
        finally:
            stream_handle.close()
            
        return self._particleDataHdlrObj
Ejemplo n.º 28
0
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):

    from mi.logging import config

    config.add_configuration(os.path.join(basePythonCodePath, "res", "config", "mi-logging.yml"))
    log = get_logger()

    config = {
        DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.adcps_jln",
        DataSetDriverConfigKeys.PARTICLE_CLASS: "AdcpsJlnParticle",
    }
    log.trace("My ADCPS JLN Config: %s", config)

    def exception_callback(exception):
        log.debug("ERROR: %r", exception)
        particleDataHdlrObj.setParticleDataCaptureFailure()

    with open(sourceFilePath, "rb") as file_handle:
        parser = AdcpPd0Parser(config, file_handle, exception_callback)

        driver = DataSetDriver(parser, particleDataHdlrObj)
        driver.processFileStream()

    return particleDataHdlrObj
_author__ = 'jeff roy'

from mi.core.log import get_logger
log = get_logger()

from mi.idk.config import Config

import unittest
import os
from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_telemetered_driver import parse

from mi.dataset.dataset_driver import ParticleDataHandler


class DriverTest(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_one(self):

        sourceFilePath = os.path.join('mi',
                                      'dataset', 'driver', 'ctdbp_p',
                                      'dcl', 'resource',
                                      'ctdbp01_20150804_061734.DAT')

        particle_data_hdlr_obj = ParticleDataHandler()
Ejemplo n.º 30
0
#!/usr/bin/env python

"""
@package mi.dataset.parser.test.test_phsen
@file marine-integrations/mi/dataset/parser/test/test_phsen.py
@author Emily Hahn
@brief Test code for a Phsen data parser
"""
import os
from nose.plugins.attrib import attr

from mi.core.log import get_logger ; log = get_logger()

from mi.dataset.test.test_parser import ParserUnitTestCase
from mi.dataset.parser.mflm import StateKey
from mi.dataset.dataset_driver import DataSetDriverConfigKeys
from mi.core.instrument.data_particle import DataParticleKey
from mi.dataset.parser.phsen import PhsenParser, PhsenParserDataParticle

from mi.idk.config import Config
RESOURCE_PATH = os.path.join(Config().base_dir(), 'mi',
			     'dataset', 'driver', 'mflm',
			     'phsen', 'resource')

@attr('UNIT', group='mi')
class PhsenParserUnitTestCase(ParserUnitTestCase):
    """
    Phsen Parser unit test suite
    """
    def state_callback(self, state):
        """ Call back method to watch what comes in via the position callback """
Ejemplo n.º 31
0
 def __init__(self, label=None, logger=None):
     self.start_time = datetime.datetime.now()
     self.label = label
     self.logger = logger if logger else get_logger().debug
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):
    try:
        if basePythonCodePath is not None:
            pass
    except NameError:
        basePythonCodePath = os.curdir
    
    sys.path.append(basePythonCodePath)
    
    from mi.logging import config
    config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml'))
    
    from mi.core.log import get_logger
    log = get_logger()
    
    from mi.dataset.dataset_driver import DataSetDriver, ParticleDataHandler
    
    from mi.dataset.parser.ctdpf_ckl_mmp_cds import CtdpfCklMmpCdsParser
    from mi.dataset.dataset_parser import DataSetDriverConfigKeys
    
    config = {
        DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdpf_ckl_mmp_cds',
        DataSetDriverConfigKeys.PARTICLE_CLASS: 'CtdpfCklMmpCdsParserDataParticle'
    }
    
    try:
        if particleDataHdlrObj is not None:
            pass
    except NameError:
        particleDataHdlrObj = ParticleDataHandler()
    
    try:
        if sourceFilePath is not None:
            pass
    except NameError:
        try:
            sourceFilePath = sys.argv[1]
        except IndexError:
            print "Need a source file path"
            sys.exit(1)
    
    
    def state_callback(state, ingested):
        pass
    
    
    def pub_callback(data):
        log.trace("Found data: %s", data)
    
    
    stream_handle = open(sourceFilePath, 'rb')
    
    try:
        parser = CtdpfCklMmpCdsParser(config, None, stream_handle,
                                      state_callback, pub_callback)
    
        driver = DataSetDriver(parser, particleDataHdlrObj)
    
        driver.processFileStream()
    
    finally:
        stream_handle.close()
        
    return particleDataHdlrObj
Ejemplo n.º 33
0
   * From the IDK
       $ bin/dsa/test_driver
       $ bin/dsa/test_driver -i [-t testname]
       $ bin/dsa/test_driver -q [-t testname]
"""

__author__ = 'Bill French'
__license__ = 'Apache 2.0'

import gevent
import unittest

from nose.plugins.attrib import attr
from mock import Mock

from mi.core.log import get_logger ; log = get_logger()

from exceptions import Exception

from mi.idk.dataset.unit_test import DataSetTestCase
from mi.idk.dataset.unit_test import DataSetTestConfig
from mi.idk.dataset.unit_test import DataSetUnitTestCase
from mi.idk.dataset.unit_test import DataSetIntegrationTestCase
from mi.idk.dataset.unit_test import DataSetQualificationTestCase

from mi.core.exceptions import ConfigurationException
from mi.core.exceptions import SampleException
from mi.core.exceptions import InstrumentParameterException
from mi.idk.exceptions import SampleTimeout

from mi.dataset.dataset_driver import DataSourceConfigKey, DataSetDriverConfigKeys
Ejemplo n.º 34
0
#!/home/mworden/uframes/ooi/uframe-1.0/python/bin/python

__author__ = 'mworden'

from mi.core.log import get_logger

log = get_logger()

from mi.idk.config import Config

import unittest
import os
from mi.dataset.driver.nutnr_b.nutnr_b_recovered_driver import parse

from mi.dataset.dataset_driver import ParticleDataHandler


class SampleTest(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_one(self):

        sourceFilePath = os.path.join('mi', 'dataset', 'driver', 'nutnr_b',
                                      'resource', 'SCH14178.DAT')
        particle_data_hdlr_obj = ParticleDataHandler()

        particle_data_hdlr_obj = parse(Config().base_dir(), sourceFilePath,