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
|
Rev | Line | |
---|
[3646] | 1 | def 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 | |
---|
| 8 | file = open ("fortran_input", "r") |
---|
| 9 | xml = [] |
---|
| 10 | lines = file.readlines() |
---|
| 11 | for 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 | |
---|
| 17 | with 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.