Commit 8b94fbba authored by Martin Claus's avatar Martin Claus

Merge branch '5-create-example-for-parsing-nemo-namelists' into 'develop'

Resolve "Create example for parsing nemo namelists"

Closes #5

See merge request !7
parents c6d57bd2 8d2cd963
Pipeline #1895 passed with stage
in 40 seconds
"""Context for examples."""
import os
import sys
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')
)
)
import namelist
This diff is collapsed.
This diff is collapsed.
from context import namelist
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))
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