Changeset 1349
- Timestamp:
- 08/30/16 14:33:07 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_post/xios_parser.py
r1346 r1349 40 40 printRecur(root) 41 41 42 def tsquery(args): 43 """query timeseries related parameters from an XIOS xml file.""" 44 if args.verbosity >= 1: print 'Reading timeseries_def_xml=',args.file[0] 45 try: 46 tree = ET.parse(args.file[0]) 47 except: 48 print "Parse error. Please fix so that it can be parsed." 49 traceback.print_exc(file=sys.stdout) 50 return 51 root=tree.getroot() 52 if args.verbosity >= 3: print root.tag, root.attrib 53 findTimeSeries(root) 54 42 55 def printRecur(root): 43 56 """Recursively prints the tree.""" … … 55 68 indent -= 4 56 69 70 def findTimeSeries(root): 71 """Recursively find and list field tag with "timeseries", "id", "output_freq" and enable=.TRUE. attribute.""" 72 if root.tag == 'file' and root.attrib.get('timeseries'): 73 if root.attrib.get('enabled') == '.TRUE.': 74 print 'id=%s,output_freq=%s' % (root.attrib.get('id'), root.attrib.get('output_freq')) 75 else: 76 for elem in list(root): 77 findTimeSeries(elem) 78 57 79 def findField(root): 58 80 """Recursively find and list field tag with "id" or "field_ref" attribute.""" … … 165 187 parser_dump.set_defaults(func=dump) 166 188 189 # create the parser for the "tsquery" command 190 parser_check = subparsers.add_parser('tsquery', help='query timeseries related parameters from an xml file') 191 parser_check.add_argument('--file', nargs=1, required=True, help='XIOS xml timeseries_def type') 192 parser_check.set_defaults(func=tsquery) 193 167 194 # create the parser for the "check" command 168 195 parser_check = subparsers.add_parser('check', help='Check consistency between field_def and file_def files') … … 170 197 parser_check.add_argument('--file', nargs='+', required=True, help='XIOS xml file_def type') 171 198 parser_check.set_defaults(func=check, correction=False) 172 199 173 200 # create the parser for the "modify" command 174 201 parser_check = subparsers.add_parser('modify', help='Will make sure field_def is a superset of file_def')
Note: See TracChangeset
for help on using the changeset viewer.