当前位置: 首页>>代码示例>>Python>>正文


Python ParameterContext.load方法代码示例

本文整理汇总了Python中ion.services.dm.utility.granule_utils.ParameterContext.load方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterContext.load方法的具体用法?Python ParameterContext.load怎么用?Python ParameterContext.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ion.services.dm.utility.granule_utils.ParameterContext的用法示例。


在下文中一共展示了ParameterContext.load方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _compare_pc

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def _compare_pc(cls, pc1, pc2):
     if pc1:
         pc1 = ParameterContext.load(pc1) or {}
     if pc2:
         pc2 = ParameterContext.load(pc2) or {}
     if hasattr(pc1,'lookup_value') or hasattr(pc2,'lookup_value'):
         if hasattr(pc1,'lookup_value') and hasattr(pc2,'lookup_value'):
             return bool(pc1 == pc2) and pc1.document_key == pc2.document_key
         return False
     return bool(pc1 == pc2)
开发者ID:edwardhunter,项目名称:coi-services,代码行数:12,代码来源:dataset_management_service.py

示例2: create_dataset

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
    def create_dataset(self, name='', datastore_name='', view_name='', stream_id='', parameter_dict=None, spatial_domain=None, temporal_domain=None, parameter_dictionary_id='', description=''):
        validate_true(parameter_dict or parameter_dictionary_id, 'A parameter dictionary must be supplied to register a new dataset.')
        validate_is_not_none(spatial_domain, 'A spatial domain must be supplied to register a new dataset.')
        validate_is_not_none(temporal_domain, 'A temporal domain must be supplied to register a new dataset.')
        
        if parameter_dictionary_id:
            pd = self.read_parameter_dictionary(parameter_dictionary_id)
            pcs = self.read_parameter_contexts(parameter_dictionary_id, id_only=False)
            parameter_dict = self._merge_contexts([ParameterContext.load(i.parameter_context) for i in pcs], pd.temporal_context)
            parameter_dict = parameter_dict.dump()

        dataset                      = Dataset()
        dataset.description          = description
        dataset.name                 = name
        dataset.primary_view_key     = stream_id or None
        dataset.datastore_name       = datastore_name or self.DEFAULT_DATASTORE
        dataset.view_name            = view_name or self.DEFAULT_VIEW
        dataset.parameter_dictionary = parameter_dict
        dataset.temporal_domain      = temporal_domain
        dataset.spatial_domain       = spatial_domain
        dataset.registered           = False


        dataset_id, _ = self.clients.resource_registry.create(dataset)
        if stream_id:
            self.add_stream(dataset_id,stream_id)

        log.debug('creating dataset: %s', dataset_id)

        cov = self._create_coverage(dataset_id, description or dataset_id, parameter_dict, spatial_domain, temporal_domain) 
        self._save_coverage(cov)
        cov.close()

        return dataset_id
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:36,代码来源:dataset_management_service.py

示例3: add_parameter_to_dataset

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def add_parameter_to_dataset(self, parameter_context_id='', dataset_id=''):
     cov = self._get_simplex_coverage(dataset_id, mode='r+')
     parameter_ctx_res = self.read_parameter_context(parameter_context_id)
     pc = ParameterContext.load(parameter_ctx_res.parameter_context)
     cov.append_parameter(pc)
     cov.close()
     return True
开发者ID:ednad,项目名称:coi-services,代码行数:9,代码来源:dataset_management_service.py

示例4: get_parameter_context

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def get_parameter_context(cls, parameter_context_id=''):
     '''
     Preferred client-side class method for constructing a parameter context
     from a service call.
     '''
     dms_cli = DatasetManagementServiceClient()
     pc_res = dms_cli.read_parameter_context(parameter_context_id=parameter_context_id)
     pc = ParameterContext.load(pc_res.parameter_context)
     pc._identifier = pc_res._id
     return pc
开发者ID:edwardhunter,项目名称:coi-services,代码行数:12,代码来源:dataset_management_service.py

示例5: add_parameter_to_dataset

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def add_parameter_to_dataset(self, parameter_context_id='', dataset_id=''):
     cov = self._get_simplex_coverage(dataset_id, mode='r+')
     parameter_ctx_res = self.read_parameter_context(parameter_context_id)
     pc = ParameterContext.load(parameter_ctx_res.parameter_context)
     cov.append_parameter(pc)
     cov.close()
     dataset = self.read_dataset(dataset_id)
     pdict = cov.parameter_dictionary
     dataset.parameter_dictionary = pdict.dump()
     self.update_dataset(dataset)
     return True
开发者ID:birdage,项目名称:coi-services,代码行数:13,代码来源:dataset_management_service.py

示例6: get_parameter_dictionary

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
    def get_parameter_dictionary(cls, parameter_dictionary_id=''):
        '''
        Preferred client-side class method for constructing a parameter dictionary
        from a service call.
        '''
        dms_cli = DatasetManagementServiceClient()
        pd  = dms_cli.read_parameter_dictionary(parameter_dictionary_id)
        pcs = dms_cli.read_parameter_contexts(parameter_dictionary_id=parameter_dictionary_id, id_only=False)

        pdict = cls._merge_contexts([ParameterContext.load(i.parameter_context) for i in pcs], pd.temporal_context)
        pdict._identifier = parameter_dictionary_id

        return pdict
开发者ID:blazetopher,项目名称:coi-services,代码行数:15,代码来源:dataset_management_service.py

示例7: create_dataset

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
    def create_dataset(self, name='', datastore_name='', view_name='', stream_id='', parameter_dict=None, parameter_dictionary_id='', description='', parent_dataset_id=''):
        
        validate_true(parameter_dict or parameter_dictionary_id, 'A parameter dictionary must be supplied to register a new dataset.')
        
        if parameter_dictionary_id:
            pd = self.read_parameter_dictionary(parameter_dictionary_id)
            pcs = self.read_parameter_contexts(parameter_dictionary_id, id_only=False)
            parameter_dict = self._merge_contexts([ParameterContext.load(i.parameter_context) for i in pcs], pd.temporal_context)
            parameter_dict = parameter_dict.dump()

        parameter_dict = self.numpy_walk(parameter_dict)

        dataset                      = Dataset()
        dataset.description          = description
        dataset.name                 = name
        dataset.primary_view_key     = stream_id or None
        dataset.datastore_name       = datastore_name or self.DEFAULT_DATASTORE
        dataset.view_name            = view_name or self.DEFAULT_VIEW
        dataset.parameter_dictionary = parameter_dict
        dataset.registered           = False

        

        dataset_id, _ = self.clients.resource_registry.create(dataset)
        if stream_id:
            self.add_stream(dataset_id, stream_id)

        log.debug('creating dataset: %s', dataset_id)
        if parent_dataset_id:
            vcov = self._create_view_coverage(dataset_id, description or dataset_id, parent_dataset_id)
            vcov.close()
            return dataset_id

        cov = self._create_coverage(dataset_id, description or dataset_id, parameter_dict)
        self._save_coverage(cov)
        cov.close()

        #table loader create resource
        if self._get_eoi_service_available():
            log.debug('DM:create dataset: %s -- dataset_id: %s', name, dataset_id)
            self._create_single_resource(dataset_id, parameter_dict)


        return dataset_id
开发者ID:wbollenbacher,项目名称:coi-services,代码行数:46,代码来源:dataset_management_service.py

示例8: build_parameter_dictionary

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
    def build_parameter_dictionary(cls, parameter_dictionary_obj, parameter_contexts):
        pdict = cls._merge_contexts([ParameterContext.load(i.parameter_context) for i in parameter_contexts],
                                    parameter_dictionary_obj.temporal_context)
        pdict._identifier = parameter_dictionary_obj._id

        return pdict
开发者ID:edwardhunter,项目名称:coi-services,代码行数:8,代码来源:dataset_management_service.py

示例9: get_parameter_context_by_name

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def get_parameter_context_by_name(cls, name=''):
     dms_cli = DatasetManagementServiceClient()
     pc_res = dms_cli.read_parameter_context_by_name(name=name, id_only=False)
     pc = ParameterContext.load(pc_res.parameter_context)
     pc._identifier = pc_res._id
     return pc
开发者ID:edwardhunter,项目名称:coi-services,代码行数:8,代码来源:dataset_management_service.py

示例10: _compare_pc

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def _compare_pc(cls, pc1, pc2):
     if pc1:
         pc1 = ParameterContext.load(pc1) or {}
     if pc2:
         pc2 = ParameterContext.load(pc2) or {}
     return bool(pc1 == pc2)
开发者ID:blazetopher,项目名称:coi-services,代码行数:8,代码来源:dataset_management_service.py

示例11: _coverage_parameter_dictionary

# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import load [as 别名]
 def _coverage_parameter_dictionary(self, parameter_dictionary_id):
     pd = self.read_parameter_dictionary(parameter_dictionary_id)
     pcs = self.read_parameter_contexts(parameter_dictionary_id, id_only=False)
     parameter_dict = self._merge_contexts([ParameterContext.load(i.parameter_context) for i in pcs], pd.temporal_context)
     return parameter_dict
开发者ID:ednad,项目名称:coi-services,代码行数:7,代码来源:dataset_management_service.py


注:本文中的ion.services.dm.utility.granule_utils.ParameterContext.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。