def to_granule(self, data_producer_id='',provider_metadata_update={}, connection_id='', connection_index=''):
     granule = Granule()
     granule.record_dictionary = {}
     
     for key,val in self._rd.iteritems():
         if val is not None:
             granule.record_dictionary[self._pdict.ord_from_key(key)] = self[key]
         else:
             granule.record_dictionary[self._pdict.ord_from_key(key)] = None
     
     granule.param_dictionary = self._stream_def or self._pdict.dump()
     granule.locator = self._locator
     granule.domain = self.domain.shape
     granule.data_producer_id=data_producer_id
     granule.provider_metadata_update=provider_metadata_update
     granule.creation_timestamp = time.time()
     granule.connection_id = connection_id
     granule.connection_index = connection_index
     return granule
 def to_granule(self, data_producer_id='',provider_metadata_update={}):
     granule = Granule()
     granule.record_dictionary = {}
     
     for key,val in self._rd.iteritems():
         if val is not None:
             granule.record_dictionary[key] = val._storage._storage
         else:
             granule.record_dictionary[key] = None
     
     granule.param_dictionary = self._stream_def or self._pdict.dump()
     granule.locator = self._locator
     granule.domain = self.domain.shape
     granule.data_producer_id=data_producer_id
     granule.provider_metadata_update=provider_metadata_update
     return granule
    def to_granule(self, data_producer_id='', provider_metadata_update={}):
        granule = Granule()
        granule.record_dictionary = {}

        for key, val in self._rd.iteritems():
            if val is not None:
                granule.record_dictionary[self._pdict.ord_from_key(
                    key)] = self[key]
            else:
                granule.record_dictionary[self._pdict.ord_from_key(key)] = None

        granule.param_dictionary = self._stream_def or self._pdict.dump()
        granule.locator = self._locator
        granule.domain = self.domain.shape
        granule.data_producer_id = data_producer_id
        granule.provider_metadata_update = provider_metadata_update
        granule.creation_timestamp = time.time()
        return granule
Example #4
0
def build_granule(data_producer_id, taxonomy, record_dictionary):
    """
    This method is a simple wrapper that knows how to produce a granule IonObject from a RecordDictionaryTool and a TaxonomyTool

    A granule is a unit of information which conveys part of a coverage.

    A granule contains a record dictionary. The record dictionary is composed of named value sequences.
    We want the Granule Builder to have a dictionary like behavior for building record dictionaries, using the taxonomy
    as a map from the name to the ordinal in the record dictionary.
    """

    #@todo If the taxonomy has an id_ and rev_ send only that.
    return Granule(data_producer_id=data_producer_id,
                   record_dictionary=record_dictionary._rd,
                   taxonomy=taxonomy._t)
    def to_granule(self, data_producer_id="", provider_metadata_update={}, connection_id="", connection_index=""):
        granule = Granule()
        granule.record_dictionary = {}

        for key, val in self._rd.iteritems():
            if val is not None:
                granule.record_dictionary[self.to_ordinal(key)] = self[key]
            else:
                granule.record_dictionary[self.to_ordinal(key)] = None

        granule.param_dictionary = {} if self._stream_def else self._pdict.dump()
        if self._definition:
            granule.stream_definition = self._definition
        else:
            granule.stream_definition = None
            granule.stream_definition_id = self._stream_def
        granule.locator = self._locator
        granule.domain = self.domain.shape
        granule.data_producer_id = data_producer_id
        granule.provider_metadata_update = provider_metadata_update
        granule.creation_timestamp = time.time()
        granule.connection_id = connection_id
        granule.connection_index = connection_index
        return granule
    def to_granule(self,
                   data_producer_id='',
                   provider_metadata_update={},
                   connection_id='',
                   connection_index=''):
        granule = Granule()
        granule.record_dictionary = {}

        for key, val in self._rd.iteritems():
            if val is not None:
                granule.record_dictionary[self.to_ordinal(key)] = self[key]
            else:
                granule.record_dictionary[self.to_ordinal(key)] = None

        granule.param_dictionary = {} if self._stream_def else self._pdict.dump(
        )
        if self._definition:
            granule.stream_definition = self._definition
        else:
            granule.stream_definition = None
            granule.stream_definition_id = self._stream_def
        granule.locator = self._locator
        granule.domain = self.domain.shape
        granule.data_producer_id = data_producer_id
        granule.provider_metadata_update = provider_metadata_update
        granule.creation_timestamp = time.time()
        granule.connection_id = connection_id
        granule.connection_index = connection_index
        return granule