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


Python GenericMetadata.getProcessingHistoryList方法代码示例

本文整理汇总了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)
开发者ID:dblodgett-usgs,项目名称:EcohydroLib,代码行数:19,代码来源:test_metadata.py

示例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)
开发者ID:dblodgett-usgs,项目名称:EcohydroLib,代码行数:32,代码来源:DumpMetadataToiRODSXML.py


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