Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
6a2e88e
Refactor wet model drivers and controllers
Pierre-siddall May 11, 2026
f5fb6e4
Merge branch 'main' into refactor-wet-model
Pierre-siddall May 11, 2026
f2bdff5
Typo correction and unused function removal
Pierre-siddall May 12, 2026
5e5f650
Replace aprun for MPI launcher
Pierre-siddall May 12, 2026
4211325
copy in relevant files using dependency checker
Pierre-siddall May 12, 2026
2e65232
Add mocilib to source extraction
Pierre-siddall May 12, 2026
d1ca747
Update copyright in run model
Pierre-siddall May 13, 2026
6410782
add new mct setup
Pierre-siddall May 13, 2026
627f7c6
Add um_tools to ex1a site
Pierre-siddall May 13, 2026
710ff5c
Add terminator to module command
Pierre-siddall May 13, 2026
688a666
Remove redundant methods
Pierre-siddall May 13, 2026
ea9ff20
Update check drivers function
Pierre-siddall May 13, 2026
b3303d5
Add MPI usage to link drivers
Pierre-siddall May 13, 2026
c8bb236
Correct empty separator
Pierre-siddall May 13, 2026
3ed3bd5
Update error codes
Pierre-siddall May 13, 2026
f661446
Add import error
Pierre-siddall May 13, 2026
0a4d489
Add hist dirs to common
Pierre-siddall May 13, 2026
e136e3d
Rejig imports
Pierre-siddall May 13, 2026
9040656
Update driver configs
Pierre-siddall May 13, 2026
6ffcb43
Update ocean environment variables
Pierre-siddall May 13, 2026
7756b31
Add unit test groups
Pierre-siddall May 13, 2026
41a100f
Update driver test shebang
Pierre-siddall May 13, 2026
6255f4c
Merge branch 'main' into refactor-wet-model
Pierre-siddall May 26, 2026
9c9dd78
Add nemo lib
Pierre-siddall May 27, 2026
11173b7
Add nemo restart lib
Pierre-siddall May 27, 2026
e927f7e
Add nemo runtime namcouple
Pierre-siddall May 27, 2026
c62272a
Add ocn lib
Pierre-siddall May 27, 2026
58f8c92
Add path function testing to common unit tests
Pierre-siddall May 27, 2026
6da2a96
Add nemo driver misc tests
Pierre-siddall May 27, 2026
36a06a3
Add nemo driver setup exe tests
Pierre-siddall May 27, 2026
9aed725
Add nemo driver submod tests.
Pierre-siddall May 27, 2026
eca05d0
Add nemo lib tests
Pierre-siddall May 27, 2026
eaf1591
Add nemo lib nl tests
Pierre-siddall May 27, 2026
7cfdab4
Add nemo restart lib nl tests
Pierre-siddall May 27, 2026
fc61f73
Add nemo restart lib rst tests
Pierre-siddall May 27, 2026
a78f6d9
Add ocn lib tests
Pierre-siddall May 27, 2026
e2b8bbf
Add update nemo nl tests
Pierre-siddall May 27, 2026
4738b92
Add python to update nemo nl
Pierre-siddall May 27, 2026
a132582
Merge branch 'main' into refactor-wet-model
Pierre-siddall May 27, 2026
cbf2b23
Add removal of trailing slashes to common
Pierre-siddall May 27, 2026
bde824b
Update ocn_cont_def environment variables
Pierre-siddall May 27, 2026
b34b63c
Add missing functions which fail nemo unit tests back
Pierre-siddall May 27, 2026
e531146
Update nemo driver imports
Pierre-siddall May 27, 2026
38b3b66
Add trailing whitespace removal
Pierre-siddall May 28, 2026
44d1043
Fix nemo driver unit tests
Pierre-siddall Jun 1, 2026
4e949b9
Merge branch 'main' into refactor-wet-model
Pierre-siddall Jun 1, 2026
bcb9431
Add unit test skeletons
Pierre-siddall Jun 2, 2026
899a9df
Setup bare bones of setup launcher command tests
Pierre-siddall Jun 2, 2026
786628c
Add set launcher command unit tests
Pierre-siddall Jun 2, 2026
490f1a7
Restyle white space
Pierre-siddall Jun 3, 2026
800223c
remove unused imports
Pierre-siddall Jun 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Coupled_Drivers/common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
'''
*****************************COPYRIGHT******************************
(C) Crown copyright 2022-2025 Met Office. All rights reserved.
(C) Crown copyright 2021 Met Office. All rights reserved.

Use, duplication or disclosure of this code is subject to the restrictions
as set forth in the licence. If no licence has been raised with this copy
Expand All @@ -18,8 +18,6 @@
Common functions and classes required by multiple model drivers
'''



import datetime
import glob
import shutil
Expand All @@ -32,7 +30,6 @@
import error
import inc_days


class ModNamelist(object):
'''
Modify a fortran namelist. This will not add any new variables, only
Expand All @@ -49,7 +46,7 @@ def __init__(self, filename):
def var_val(self, variable, value):
'''
Create a container of variable name, value pairs to be updated. Note
that if a variable doesn't exist in the namelist file, then it
that if a variable doesn't exisit in the namelist file, then it
will be ignored
'''
if isinstance(value, str):
Expand Down Expand Up @@ -139,6 +136,7 @@ def get_filepaths(directory):
return file_paths



def open_text_file(name, mode):
'''
Provide a common function to open a file and provide a suitiable error
Expand All @@ -152,7 +150,7 @@ def open_text_file(name, mode):
'a+':'updating (appending)'}
if mode not in list(modes.keys()):
options = ''
for k in modes:
for k in modes.keys():
options += ' %s: %s\n' % (k, modes[k])
sys.stderr.write('[FAIL] Attempting to open file %s, do not recognise'
' mode %s. Please use one of the following modes:\n%s'
Expand Down Expand Up @@ -188,6 +186,12 @@ def remove_file(filename):
else:
return False

def remove_trailing_slash(path_str):
"""
Remove any trailing slashes and whitespace from the path string.
"""
return path_str.rstrip(' \t\n\r/')

def setup_runtime(common_env):
'''
Set up model run length in seconds based on the model suite
Expand Down
12 changes: 7 additions & 5 deletions Coupled_Drivers/dr_env_lib/nemo_def.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/env python
'''
*****************************COPYRIGHT******************************
(C) Crown copyright 2021-2025 Met Office. All rights reserved.
(C) Crown copyright 2021 Met Office. All rights reserved.

Use, duplication or disclosure of this code is subject to the restrictions
as set forth in the licence. If no licence has been raised with this copy
Expand All @@ -22,18 +22,20 @@
# Variables required for both initalise and finalise
NEMO_ENVIRONMENT_VARS_COMMON = {
'NEMO_NL': {'default_val': 'namelist_cfg'},
'L_OCN_PASS_TRC': {'default_val': 'false'}
'L_OCN_PASS_TRC': {'default_val': 'false'},
'NEMO_NPROC': {'desc': 'Number of NEMO processors'},
'RST_LINK_DIR': {'default_val': '.',
'desc': 'Subdirectory of $CYCL_TASK_WORK_DIR containing' \
' ocean restart links'}
}

NEMO_ENVIRONMENT_VARS_INITIAL = {
'OCEAN_EXEC': {'desc': ('Ocean executable (OCEAN_EXEC=<full path to'
' exec>)')},
'NEMO_NPROC': {'desc': 'Number of NEMO processors'},
'NEMO_IPROC': {'desc': 'Number of NEMO processors in the i direction'},
'NEMO_JPROC': {'desc': 'Number of NEMO processors in the j direction'},
'NEMO_VERSION': {},
'OCEAN_LINK': {'default_val': 'ocean.exe'},
'OCN_RES': {'default_val': ''},
'NEMO_NL': {'default_val': 'namelist_cfg'},
'NEMO_START': {'default_val': ''},
'NEMO_ICEBERGS_START': {'default_val': ''},
Expand Down
8 changes: 4 additions & 4 deletions Coupled_Drivers/dr_env_lib/ocn_cont_def.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/env python
'''
*****************************COPYRIGHT******************************
(C) Crown copyright 2021-2025 Met Office. All rights reserved.
(C) Crown copyright 2021 Met Office. All rights reserved.

Use, duplication or disclosure of this code is subject to the restrictions
as set forth in the licence. If no licence has been raised with this copy
Expand All @@ -18,11 +18,11 @@
Definition of the environment variables required for the ocean
controllers
'''

SI3_ENVIRONMENT_VARS_COMMON = {'SI3_NL': {'default_val': 'namelist_ice_cfg'}}
SI3_ENVIRONMENT_VARS_INITIAL = {
'SI3_START': {'default_val': ''},
'SI3_NL': {'default_val': 'namelist_ice_cfg'}}

SI3_ENVIRONMENT_VARS_FINAL = SI3_ENVIRONMENT_VARS_COMMON
TOP_ENVIRONMENT_VARS_COMMON = {
'TOP_NL': {'default_val': 'namelist_top_cfg'}}
TOP_ENVIRONMENT_VARS_INITIAL = {
Expand Down
10 changes: 8 additions & 2 deletions Coupled_Drivers/error.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/env python
'''
*****************************COPYRIGHT******************************
(C) Crown copyright 2021-2025 Met Office. All rights reserved.
(C) Crown copyright 2021 Met Office. All rights reserved.

Use, duplication or disclosure of this code is subject to the restrictions
as set forth in the licence. If no licence has been raised with this copy
Expand Down Expand Up @@ -53,6 +53,9 @@
# Invalid argument to driver script
INVALID_DRIVER_ARG_ERROR = 202

# Missing file contents
MISSING_FILE_CONTENTS_ERROR = 203

# Missing file required by a controller
MISSING_CONTROLLER_FILE_ERROR = 251

Expand Down Expand Up @@ -139,6 +142,9 @@
# Unable to create remapping file for mapping type
MISSING_RMP_MAPPING = 816

# Size of 1D grid is unknown
UNKNOWN_1D_GRID_SIZE = 817

# Ocean resolution for Snr<->Jnr coupling is not specified
NO_OCN_RESOL = 818

Expand Down
4 changes: 2 additions & 2 deletions Coupled_Drivers/fcm_make/driver.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ extract.ns = drivers
extract.location{primary}[drivers] = fcm:moci.xm
extract.location[drivers] = $driver_base${driver_rev}
extract.path-excl[drivers] = /
extract.path-incl[drivers] = Coupled_Drivers Utilities/NGMS_utils/ngms_namcouple_gen Utilities/NGMS_utils/ngms_suite_lib
extract.path-incl[drivers] = Coupled_Drivers Utilities/NGMS_utils/ngms_namcouple_gen Utilities/NGMS_utils/ngms_suite_lib

$install_common=
$install_common =

build.target = $install_common
13 changes: 8 additions & 5 deletions Coupled_Drivers/link_drivers
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/env python
'''
*****************************COPYRIGHT******************************
(C) Crown copyright 2023-2025 Met Office. All rights reserved.
(C) Crown copyright 2021 Met Office. All rights reserved.

Use, duplication or disclosure of this code is subject to the restrictions
as set forth in the licence. If no licence has been raised with this copy
Expand All @@ -19,19 +19,24 @@ DESCRIPTION
to run a given configuration
'''


#The from __future__ imports ensure compatibility between python2.7 and 3.x
from __future__ import absolute_import
import importlib
import sys
import os
import argparse
import error
import common
import write_namcouple
import dr_env_lib.common_def
import dr_env_lib.env_lib

#A tuple for for the earlist version of python required to run the drivers
REQUIRED_VERSION = (3, 6)

# A submodel is a model which runs within another model, and doesnt require its # own driver or controller, for example si3 is a submodel of NEMO
SUBMODELS = ['si3', 'top']

def _check_drivers(models):
'''
Takes in our space separated list of models, and ensure that a driver is
Expand Down Expand Up @@ -138,8 +143,6 @@ def _export_cmd_str(launchcmds, common_env):





if __name__ == '__main__':
# Owing to the limitations of the MPI launchers and passing information
# between the shell and the python drivers, prepare two command files, one
Expand Down
Loading