Beispiel #1
0
    def setUp(self):
        """
        Setup test cases.
        """
        parsed_tx = TaxyTool()
        parsed_tx.add_taxonomy_set('temp', 'long name for temp', 't')
        parsed_tx.add_taxonomy_set('cond', 'long name for cond', 'c')
        parsed_tx.add_taxonomy_set('pres', 'long name for pres', 'd')
        parsed_tx.add_taxonomy_set('lat', 'long name for latitude', 'lt')
        parsed_tx.add_taxonomy_set('lon', 'long name for longitude', 'ln')
        parsed_tx.add_taxonomy_set('time', 'long name for time', 'tm')

        # This is an example of using groups it is not a normative statement about how to use groups
        parsed_tx.add_taxonomy_set('coordinates',
                                   'This group contains coordinates...')
        parsed_tx.add_taxonomy_set('data', 'This group contains data...')

        self._parsed_taxonomy = parsed_tx

        raw_tx = TaxyTool()
        raw_tx.add_taxonomy_set('raw_fixed',
                                'Fixed length bytes in an array of records')
        raw_tx.add_taxonomy_set('raw_blob',
                                'Unlimited length bytes in an array')

        self._raw_taxonomy = raw_tx

        log.debug("_parsed_taxonomy = %s" % self._parsed_taxonomy.dump())
        log.debug("_raw_taxonomy = %s" % self._raw_taxonomy.dump())

        self.packet_factory = PacketFactory.get_packet_factory(
            PacketFactoryType.R2LCAFormat)
        self.assertIsInstance(self.packet_factory, LCAPacketFactory)
    def setUp(self):
        """
        Setup test cases.
        """
        parsed_tx = TaxyTool()
        parsed_tx.add_taxonomy_set("temp", "long name for temp", "t")
        parsed_tx.add_taxonomy_set("cond", "long name for cond", "c")
        parsed_tx.add_taxonomy_set("pres", "long name for pres", "d")
        parsed_tx.add_taxonomy_set("lat", "long name for latitude", "lt")
        parsed_tx.add_taxonomy_set("lon", "long name for longitude", "ln")
        parsed_tx.add_taxonomy_set("time", "long name for time", "tm")

        # This is an example of using groups it is not a normative statement about how to use groups
        parsed_tx.add_taxonomy_set("coordinates", "This group contains coordinates...")
        parsed_tx.add_taxonomy_set("data", "This group contains data...")

        self._parsed_taxonomy = parsed_tx

        raw_tx = TaxyTool()
        raw_tx.add_taxonomy_set("raw_fixed", "Fixed length bytes in an array of records")
        raw_tx.add_taxonomy_set("raw_blob", "Unlimited length bytes in an array")

        self._raw_taxonomy = raw_tx

        log.debug("_parsed_taxonomy = %s" % self._parsed_taxonomy.dump())
        log.debug("_raw_taxonomy = %s" % self._raw_taxonomy.dump())

        self.packet_factory = PacketFactory.get_packet_factory(PacketFactoryType.R2LCAFormat)
        self.assertIsInstance(self.packet_factory, LCAPacketFactory)
    def setUp(self):
        """
        Setup test cases.
        """
        parsed_tx = TaxyTool()
        parsed_tx.add_taxonomy_set('temp','long name for temp', 't')
        parsed_tx.add_taxonomy_set('cond','long name for cond', 'c')
        parsed_tx.add_taxonomy_set('pres','long name for pres', 'd')
        parsed_tx.add_taxonomy_set('lat','long name for latitude', 'lt')
        parsed_tx.add_taxonomy_set('lon','long name for longitude', 'ln')
        parsed_tx.add_taxonomy_set('time','long name for time', 'tm')

        # This is an example of using groups it is not a normative statement about how to use groups
        parsed_tx.add_taxonomy_set('coordinates','This group contains coordinates...')
        parsed_tx.add_taxonomy_set('data','This group contains data...')

        self._parsed_taxonomy = parsed_tx

        raw_tx = TaxyTool()
        raw_tx.add_taxonomy_set('raw_fixed','Fixed length bytes in an array of records')
        raw_tx.add_taxonomy_set('raw_blob','Unlimited length bytes in an array')

        self._raw_taxonomy = raw_tx

        log.debug("_parsed_taxonomy = %s" % self._parsed_taxonomy.dump())
        log.debug("_raw_taxonomy = %s" % self._raw_taxonomy.dump())

        self.packet_factory = PacketFactory.get_packet_factory( PacketFactoryType.R2LCAFormat)
        self.assertIsInstance(self.packet_factory, LCAPacketFactory)
def _create_builder(taxonomy, data_producer_id, packet_factory_type):
    """
    Creates a builder function corresponding to the given parameters.
    """

    packet_factory = PacketFactory.get_packet_factory(packet_factory_type)

    def builder(**sample_data):
        granule = packet_factory.build_packet(data_producer_id=data_producer_id, taxonomy=taxonomy, data=sample_data)

        log.debug("Granule created %s" % granule)
        return granule

    return builder
Beispiel #5
0
def _create_builder(taxonomy, data_producer_id, packet_factory_type):
    """
    Creates a builder function corresponding to the given parameters.
    """

    packet_factory = PacketFactory.get_packet_factory(packet_factory_type)
    
    def builder(**sample_data):
        granule = packet_factory.build_packet(data_producer_id=data_producer_id,
                                              taxonomy=taxonomy,
                                              data=sample_data)

        log.debug("Granule created %s" % granule)
        return granule

    return builder