Commit 8d2cd963 authored by Martin Claus's avatar Martin Claus
Browse files

Added small example for Nemo ref and cfg namelists

parent 4f085959
Loading
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -3,3 +3,19 @@ import json

in_file_ref = "namelist_ref"
in_file_cfg = "namelist_cfg"

with open(in_file_ref) as f:
    ref_nmls = namelist.parse_namelist_file(f)

with open(in_file_cfg) as f:
    cfg_nmls = namelist.parse_namelist_file(f)

nmls = ref_nmls.copy()

for k in cfg_nmls:
    if k in nmls:
        nmls[k].update(cfg_nmls[k])
    else:
        nmls[k] = cfg_nmls[k]

print(json.dumps(nmls, indent=4))