本文整理汇总了Python中ecohydrolib.metadata.GenericMetadata.getProcessingHistoryList方法的典型用法代码示例。如果您正苦于以下问题:Python GenericMetadata.getProcessingHistoryList方法的具体用法?Python GenericMetadata.getProcessingHistoryList怎么用?Python GenericMetadata.getProcessingHistoryList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecohydrolib.metadata.GenericMetadata
的用法示例。
在下文中一共展示了GenericMetadata.getProcessingHistoryList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_processing_history
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import getProcessingHistoryList [as 别名]
def test_processing_history(self):
""" Test processing history metadata """
projectDir = "/tmp"
step1 = "mkdir foo; cd foo"
step2 = "touch README.txt"
step3 = "git init"
GenericMetadata.appendProcessingHistoryItem(self.context, step1)
GenericMetadata.appendProcessingHistoryItem(self.context, step2)
GenericMetadata.appendProcessingHistoryItem(self.context, step3)
history = GenericMetadata.getProcessingHistoryList(self.context)
self.assertTrue(len(history) == 3, "Expected history length to be 3, but it is %d" % (len(history),) )
self.assertTrue(history[0] == step1)
self.assertTrue(history[1] == step2)
self.assertTrue(history[2] == step3)
示例2: Context
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import getProcessingHistoryList [as 别名]
context = Context(args.projectDir, None)
# Make sure there's no trailing PATH_SEP_IRODS on the collection
collection = args.collection.rstrip(PATH_SEP_IRODS)
outfilePath = os.path.join(context.projectDir, OUTFILE_NAME)
outfile = codecs.getwriter('utf-8')(open(outfilePath, 'w'))
outfile.write('<?xml version="1.0" encoding="UTF-8" ?>\n')
outfile.write('<metadata>\n')
# Write study area metadata to collection root
writeDictToXMLFile(outfile, collection, GenericMetadata.readStudyAreaEntries(context))
# Write processing history to collection root
history = GenericMetadata.getProcessingHistoryList(context)
i = 1
for entry in history:
attribute = "processing_step_%d" % (i,); i += 1
writeAVUToXMLFile(outfile, collection, attribute, entry)
# Write provenance to each item in the manifest
provenance = GenericMetadata.readAssetProvenanceObjects(context)
for entry in provenance:
target = collection + PATH_SEP_IRODS + entry.dcIdentifier
writeAVUToXMLFile(outfile, target, 'name', entry.name)
writeAVUToXMLFile(outfile, target, 'dc.source', entry.dcSource)
writeAVUToXMLFile(outfile, target, 'dc.title', entry.dcTitle)
writeAVUToXMLFile(outfile, target, 'dc.date', entry.dcDate.strftime(AssetProvenance.FMT_DATE))
writeAVUToXMLFile(outfile, target, 'dc.publisher', entry.dcPublisher)
writeAVUToXMLFile(outfile, target, 'dc.description', entry.dcDescription)