本文整理汇总了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()