當前位置: 首頁>>代碼示例>>Python>>正文


Python granule_utils.ParameterDictionary類代碼示例

本文整理匯總了Python中ion.services.dm.utility.granule_utils.ParameterDictionary的典型用法代碼示例。如果您正苦於以下問題:Python ParameterDictionary類的具體用法?Python ParameterDictionary怎麽用?Python ParameterDictionary使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ParameterDictionary類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: validate_stream_defs

    def validate_stream_defs(self, in_stream_definition_id, out_stream_definition_id):
        stream_def_in = self.read_stream_definition(in_stream_definition_id)
        stream_def_out = self.read_stream_definition(out_stream_definition_id)
        
        if not stream_def_in.available_fields:
            log.info("no available fields on input stream definition")
            return False
        
        incoming_pdict_dump = stream_def_in.parameter_dictionary
        outgoing_pdict_dump = stream_def_out.parameter_dictionary

        incoming_pdict = ParameterDictionary.load(incoming_pdict_dump)
        outgoing_pdict = ParameterDictionary.load(outgoing_pdict_dump)

        incoming_ctxt = [pc for name,(n,pc) in incoming_pdict.iteritems()]
        outgoing_ctxt = [pc for name,(n,pc) in outgoing_pdict.iteritems()]
        
        incoming_ctxt_af = [pc for name,(n,pc) in incoming_pdict.iteritems() if name in stream_def_in.available_fields]
        
        pfv = ParameterFunctionValidator(incoming_ctxt_af, incoming_ctxt, outgoing_ctxt)
        try:
            for name in stream_def_out.available_fields:
                pfv.validate(name)
        except ParameterFunctionException, e:
            log.info('validation failed %s to %s is not reachable' % (stream_def_in.available_fields,stream_def_out.available_fields))
            log.info(e)
            return False
開發者ID:Bobfrat,項目名稱:coi-services,代碼行數:27,代碼來源:pubsub_management_service.py

示例2: _merge_contexts

 def _merge_contexts(cls, contexts, temporal):
     pdict = ParameterDictionary()
     for context in contexts:
         if context.name == temporal:
             context.axis = AxisTypeEnum.TIME
             pdict.add_context(context, is_temporal=True)
         else:
             pdict.add_context(context)
     return pdict
開發者ID:edwardhunter,項目名稱:coi-services,代碼行數:9,代碼來源:dataset_management_service.py

示例3: _create_coverage

 def _create_coverage(self, dataset_id, description, parameter_dict, spatial_domain,temporal_domain):
     pdict = ParameterDictionary.load(parameter_dict)
     sdom = GridDomain.load(spatial_domain)
     tdom = GridDomain.load(temporal_domain)
     file_root = FileSystem.get_url(FS.CACHE,'datasets')
     scov = SimplexCoverage(file_root,dataset_id,description or dataset_id,parameter_dictionary=pdict, temporal_domain=tdom, spatial_domain=sdom, inline_data_writes=self.inline_data_writes)
     return scov
開發者ID:blazetopher,項目名稱:coi-services,代碼行數:7,代碼來源:dataset_management_service.py

示例4: _create_coverage

 def _create_coverage(self, dataset_id, description, parameter_dict):
     #file_root = FileSystem.get_url(FS.CACHE,'datasets')
     temporal_domain, spatial_domain = time_series_domain()
     pdict = ParameterDictionary.load(parameter_dict)
     scov = self._create_simplex_coverage(dataset_id, pdict, spatial_domain, temporal_domain, self.inline_data_writes)
     #vcov = ViewCoverage(file_root, dataset_id, description or dataset_id, reference_coverage_location=scov.persistence_dir)
     scov.close()
     return scov
開發者ID:wbollenbacher,項目名稱:coi-services,代碼行數:8,代碼來源:dataset_management_service.py

示例5: _create_coverage

 def _create_coverage(self, dataset_id, parameter_dict_id, time_dom, spatial_dom):
     pd = self.dataset_management_client.read_parameter_dictionary(parameter_dict_id)
     pdict = ParameterDictionary.load(pd)
     sdom = GridDomain.load(spatial_dom.dump())
     tdom = GridDomain.load(time_dom.dump())
     file_root = FileSystem.get_url(FS.CACHE,'datasets')
     scov = SimplexCoverage(file_root, dataset_id, dataset_id, parameter_dictionary=pdict, temporal_domain=tdom, spatial_domain=sdom)
     return scov
開發者ID:wbollenbacher,項目名稱:coi-services,代碼行數:8,代碼來源:test_stream_ingestion_worker.py

示例6: _create_coverage

 def _create_coverage(self, dataset_id, description, parameter_dict, spatial_domain,temporal_domain):
     file_root = FileSystem.get_url(FS.CACHE,'datasets')
     pdict = ParameterDictionary.load(parameter_dict)
     sdom = GridDomain.load(spatial_domain)
     tdom = GridDomain.load(temporal_domain)
     scov = self._create_simplex_coverage(dataset_id, pdict, sdom, tdom, self.inline_data_writes)
     vcov = ViewCoverage(file_root, dataset_id, description or dataset_id, reference_coverage_location=scov.persistence_dir)
     scov.close()
     return vcov
開發者ID:edwardhunter,項目名稱:coi-services,代碼行數:9,代碼來源:dataset_management_service.py

示例7: _create_coverage

    def _create_coverage(self, description, parameter_dict, spatial_domain,temporal_domain):
        #--------------------------------------------------------------------------------
        # Create coversions and deserialization then craft the coverage
        #--------------------------------------------------------------------------------

        pdict = ParameterDictionary.load(parameter_dict)
        sdom = GridDomain.load(spatial_domain)
        tdom = GridDomain.load(temporal_domain)

        scov = SimplexCoverage(description, parameter_dictionary=pdict, spatial_domain=sdom, temporal_domain=tdom)
        return scov
開發者ID:pombredanne,項目名稱:coi-services,代碼行數:11,代碼來源:dataset_management_service.py

示例8: dataset_temporal_bounds

 def dataset_temporal_bounds(self, dataset_id):
     dataset = self.read_dataset(dataset_id)
     if not dataset:
         return {}
     pdict = ParameterDictionary.load(dataset.parameter_dictionary)
     temporal_parameter = pdict.temporal_parameter_name
     units = pdict.get_temporal_context().uom
     bounds = self.dataset_bounds(dataset_id)
     if not bounds:
         return {}
     bounds = bounds[temporal_parameter or 'time']
     bounds = [TimeUtils.units_to_ts(units, i) for i in bounds]
     return bounds
開發者ID:edwardhunter,項目名稱:coi-services,代碼行數:13,代碼來源:dataset_management_service.py

示例9: has_lookup_values

    def has_lookup_values(self, stream_definition_id=''):
        stream_definition = self.read_stream_definition(stream_definition_id)
        pdict = ParameterDictionary.load(stream_definition.parameter_dictionary)

        ret = []
        for key in pdict.keys():
            p_context = pdict.get_context(key)
            if hasattr(p_context, 'lookup_value'):
                if stream_definition.available_fields and key in stream_definition.available_fields:
                    ret.append(p_context.name)
                elif not stream_definition.available_fields:
                    ret.append(p_context.name)

        return ret
開發者ID:Bobfrat,項目名稱:coi-services,代碼行數:14,代碼來源:pubsub_management_service.py

示例10: _create_parameter

    def _create_parameter(self):

        pdict = ParameterDictionary()

        pdict = self._add_location_time_ctxt(pdict)

        pres_ctxt = ParameterContext('pressure', param_type=QuantityType(value_encoding=numpy.float32))
        pres_ctxt.uom = 'Pascal'
        pres_ctxt.fill_value = 0x0
        pdict.add_context(pres_ctxt)

        temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=numpy.float32))
        temp_ctxt.uom = 'degree_Celsius'
        temp_ctxt.fill_value = 0e0
        pdict.add_context(temp_ctxt)

        cond_ctxt = ParameterContext('conductivity', param_type=QuantityType(value_encoding=numpy.float32))
        cond_ctxt.uom = 'unknown'
        cond_ctxt.fill_value = 0e0
        pdict.add_context(cond_ctxt)

        raw_fixed_ctxt = ParameterContext('raw_fixed', param_type=QuantityType(value_encoding=numpy.float32))
        raw_fixed_ctxt.uom = 'unknown'
        raw_fixed_ctxt.fill_value = 0e0
        pdict.add_context(raw_fixed_ctxt)

        raw_blob_ctxt = ParameterContext('raw_blob', param_type=QuantityType(value_encoding=numpy.float32))
        raw_blob_ctxt.uom = 'unknown'
        raw_blob_ctxt.fill_value = 0e0
        pdict.add_context(raw_blob_ctxt)

        return pdict
開發者ID:Bobfrat,項目名稱:coi-services,代碼行數:32,代碼來源:example_data_producer.py

示例11: _compare_pdicts

 def _compare_pdicts(cls, pdict1, pdict2):
     if pdict1:
         pdict1 = ParameterDictionary.load(pdict1) or {}
     if pdict2:
         pdict2 = ParameterDictionary.load(pdict2) or {}
     return bool(pdict1 == pdict2)
開發者ID:kerfoot,項目名稱:coi-services,代碼行數:6,代碼來源:pubsub_management_service.py

示例12: _create_complex_coverage

 def _create_complex_coverage(cls, dataset_id, description, parameter_dict):
     pdict = ParameterDictionary.load(parameter_dict)
     file_root = FileSystem.get_url(FS.CACHE, 'datasets')
     ccov = ComplexCoverage(file_root, dataset_id, 'Complex Coverage for %s' % dataset_id, parameter_dictionary=pdict, complex_type=ComplexCoverageType.TEMPORAL_AGGREGATION)
     return ccov
開發者ID:ednad,項目名稱:coi-services,代碼行數:5,代碼來源:dataset_management_service.py


注:本文中的ion.services.dm.utility.granule_utils.ParameterDictionary類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。