From 447a6dc9798faf4cd13a5429ba1738e6be709dda Mon Sep 17 00:00:00 2001 From: Aidan Heerdegen Date: Wed, 5 Jul 2023 12:04:59 +1000 Subject: [PATCH] Fix serialisation of Namelist objects by converting to dict type --- run_summary.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run_summary.py b/run_summary.py index 77a1280..79c5c83 100755 --- a/run_summary.py +++ b/run_summary.py @@ -42,6 +42,8 @@ import warnings warnings.simplefilter('ignore', np.RankWarning) +yaml.add_representer(OrderedDict, lambda dumper, data: dumper.represent_mapping('tag:yaml.org,2002:map', data.items())) + def num(s): """ @@ -458,7 +460,7 @@ def parse_nml(paths): for fname in fnames: if os.path.isfile(fname): # no accessom2.nml for non-YATM run parsed_items[fname.split(path)[1].strip('/')] \ - = f90nml.read(fname) + = f90nml.read(fname).todict() return parsed_items