|
Last change
on this file since 3983 was
3873,
checked in by afalco, 5 months ago
|
|
XIOS: code->xml parser handles xios_send_field too.
AF
|
|
File size:
905 bytes
|
| Line | |
|---|
| 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 | try: |
|---|
| 13 | # case write_output() |
|---|
| 14 | split_line = line.split("(")[1].split(")")[0].split(",") |
|---|
| 15 | name, long_name, unit, data = split_line |
|---|
| 16 | print(name, long_name, unit, data) |
|---|
| 17 | except: |
|---|
| 18 | # case xios_send_field() |
|---|
| 19 | try: |
|---|
| 20 | name, data = split_line |
|---|
| 21 | print(name, data) |
|---|
| 22 | long_name = "\"\"" |
|---|
| 23 | unit = "\"\"" |
|---|
| 24 | except: |
|---|
| 25 | continue |
|---|
| 26 | |
|---|
| 27 | field = xml_field(name, long_name, unit) |
|---|
| 28 | xml.append(field) |
|---|
| 29 | |
|---|
| 30 | with open("tmp_field_def_physics.xml", "w") as f: |
|---|
| 31 | for field in xml: |
|---|
| 32 | f.write(field) |
|---|
| 33 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.