Commit 7aa86d68 authored by Martin Claus's avatar Martin Claus

Added example for merging two namelists

parent 3eceda0a
Pipeline #1898 passed with stage
in 48 seconds
from context import namelist
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]
for nml in nmls:
print(str(nmls[nml]))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment