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


Python Table.processOutputInstructions方法代码示例

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


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

示例1: main

# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import processOutputInstructions [as 别名]
def main ():
  
  prog = sys.argv[1]
  ## open program to parse (read whole program into memory, it's small enough)
  with open(prog,'r') as f:
    towerProgram = Program.removeCommentedText(f.read())
    
  ### parse instrumentlibrary for additional metadata
  insLib = parse('instrumentlibrary.xml')  
    
  ## parse program to get aliases, constants, and units
  aliases = Program.getAliases(towerProgram)  
  constants = Program.getConstants(towerProgram)
  units = Program.getUnits(towerProgram)

  ## start and initialize new xml for this program
  doc = xmlutils.createNewProgramXML()
  xmlutils.addTextNodeToRoot(doc,"progName",prog)
  tablesNode = xmlutils.addNode(doc,'root','tables')
 
  ### put datatable info in the progxml
  tables = Program.getTables(towerProgram)
  for text in tables:
    ### use text and program info to construct Table object
    table = Table(text,aliases,constants,units)

    ### add table info (name and interval) to xml
    tableNode = doc.createElement("table")
    table.addTableInfo(doc,tableNode)

    ### process output instructions and store variable info
    ### to the progxml
    variablesNode = xmlutils.addNode(doc,tableNode,'variables')
    table.processOutputInstructions(doc,variablesNode,insLib)
   
    tablesNode.appendChild(tableNode)


  #do some cleaning up of xml (so it's easy for humans to view in texteditor)
  progxml = xmlutils.cleanupXML(doc)
  ### save progxml
  xmlout = open(prog + '.xml','w')
  print >>xmlout, progxml
开发者ID:mbo12,项目名称:campbellNetCDF,代码行数:45,代码来源:makeProgXML.py


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