source: trunk/UTIL/convert_diagfi_to_xml.py @ 3646

Last change on this file since 3646 was 3646, checked in by afalco, 4 months ago

Added a python script to generate XML code for field_def_physics.xml for variables added in the outputs of physiq_mod. Added a README in UTIL/
AF

File size: 599 bytes
Line 
1def xml_field(name, long_name, unit):
2    field =  '            <field id=' + name + '\n'
3    field += '                   long_name=' + long_name + '\n'
4    field += '                   unit=' + unit + ' />\n'
5    return field
6
7
8file = open ("fortran_input", "r")
9xml = []
10lines = file.readlines()
11for line in lines:
12    name, long_name, unit, data = line.split("(")[1].split(")")[0].split(",")
13    print(name, long_name, unit, data)
14    field = xml_field(name, long_name, unit)
15    xml.append(field)
16
17with open("tmp_field_def_physics.xml", "w") as f:
18    for field in xml:
19        f.write(field)
20
Note: See TracBrowser for help on using the repository browser.