當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。