Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
py-namelist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Claus
py-namelist
Commits
7aa86d68
Commit
7aa86d68
authored
Oct 05, 2018
by
Martin Claus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added example for merging two namelists
parent
3eceda0a
Pipeline
#1898
passed with stage
in 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
examples/merge_NEMO_namelists.py
examples/merge_NEMO_namelists.py
+21
-0
No files found.
examples/merge_NEMO_namelists.py
0 → 100644
View file @
7aa86d68
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
]))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment