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


Python IBCCVLMetadata.update方法代码示例

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


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

示例1: setUpApiTests

# 需要导入模块: from org.bccvl.site.interfaces import IBCCVLMetadata [as 别名]
# 或者: from org.bccvl.site.interfaces.IBCCVLMetadata import update [as 别名]
def setUpApiTests(doctest):
    """
    set up some test data for api doctests as test user
    """
    layer = doctest.globs['layer']
    # layer: app, portal, request,
    #        configurationContext, host, port, zodbDB
    portal = layer['portal']
    # create a fake sdm experiment
    sdm = portal.experiments.invokeFactory('org.bccvl.content.sdmexperiment',
                                           id='sdm',
                                           title=u'Test SDM')
    sdm = portal.experiments[sdm]
    result = sdm.invokeFactory('Folder',
                               id='sdmresult')
    result = sdm[result]
    result.job_params = {
        'function': 'bioclim',
    }
    sdmds = result.invokeFactory('org.bccvl.content.dataset',
                                 id='sdmrds',
                                 title=u'Result Test SDM RData',
                                 file=NamedFile(filename=u'Result_file.Rdata'))
    sdmds = result[sdmds]
    md = IBCCVLMetadata(sdmds)
    md.update({
        'genre': 'DataGenreCP',
        'species': {
            'scientificName': u'Result species',
        }
    })
    sdmds.reindexObject()

    # create a fake projection experiment
    proj = portal.experiments.invokeFactory('org.bccvl.content.projectionexperiment',
                                            id='proj',
                                            title=u'Test Projection')
    proj = portal.experiments[proj]
    # create a result folder
    result = proj.invokeFactory('Folder',
                                id='projresult')
    result = proj[result]
    result.job_params = {
        'species_distribution_models': [IUUID(sdmds)],
    }
    # create a result dataset
    rds = result.invokeFactory('org.bccvl.content.dataset',
                               id='rds',
                               title=u'Result Test',
                               file=NamedFile(filename=u'Result_file.tiff'))
    rds = result[rds]
    # set metadata on rds
    md = IBCCVLMetadata(rds)
    md.update({
        'genre': 'DataGenreFP',
        'temporal': u"start=2014;",
        'gcm': 'cccma-cgcm31',
        'emsc': 'RCP3PD',
        'species': {
            'scientificName': u'Result species',
        }
    })
    # update index with data from graph
    rds.reindexObject()

    # we have to commit here because doctests run in a different
    # thread because they connect via test-broswer.
    transaction.commit()
开发者ID:sarahrichmond,项目名称:org.bccvl.site,代码行数:70,代码来源:test_api.py


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