Skip to content

Commit 1e897ce

Browse files
Merge pull request #300 from alperaltuntas/remove_duplicate_params
Remove duplicate parameters in template files
2 parents cb40cc5 + 28bd2de commit 1e897ce

7 files changed

Lines changed: 295 additions & 37 deletions

File tree

.github/workflows/general-ci-tests.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ jobs:
9494
- name: Run the check_default_params script
9595
run: python tests/check_default_params.py
9696

97+
# Job to check if duplicate parameters exist in param template files
98+
check_duplicate_params:
99+
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
# Checkout the repo
104+
- uses: actions/checkout@v4
105+
106+
# Run the test
107+
- name: Run the check_duplicate_params script
108+
run: |
109+
python tests/check_duplicate_params.py param_templates/MOM_input.yaml
110+
python tests/check_duplicate_params.py param_templates/input_data_list.yaml
111+
python tests/check_duplicate_params.py param_templates/input_nml.yaml
112+
python tests/check_duplicate_params.py param_templates/diag_table.yaml
113+
97114
# Job to run check_input_data_list script
98115
check_input_data_list:
99116

cime_config/buildnml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,13 @@ def prechecks(case, inst_suffixes):
399399
f"Missing rpointer files in rundir. Expected files with pattern {rpointer_pattern}.",
400400
)
401401

402-
# check if the restart file is present in rundir
402+
# check if the restart file is present in rundir for fresh branch or hybrid runs
403403
if run_type in ["branch", "hybrid"] and not continue_run and not get_refcase:
404-
restart_file = os.path.join(rundir, f'./{run_refcase}.mom6.r.{run_refdate}-{run_reftod}.nc')
405-
assert os.path.exists(restart_file), f"Missing restart file {run_refcase}.mom6.r.{run_refdate}-{run_reftod}.nc in rundir."
404+
restart_file_pattern = run_refcase + r".mom6.*.r." + run_refdate + "-" + run_reftod + r".*nc$"
405+
restart_files = [
406+
f for f in os.listdir(rundir) if re.match(restart_file_pattern, f)
407+
]
408+
assert len(restart_files) > 0, f"Missing restart file in rundir. Expected file matching pattern {restart_file_pattern}."
406409

407410
def postchecks(case, MOM_input_final):
408411
"""Performs checks after input files are generated. To be called within prep_input() as a final step."""

param_templates/MOM_input.yaml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ Global:
8989
$OCN_GRID == "tx2_3v2": 480
9090
$OCN_GRID == "tx0.25v1": 1080
9191
$OCN_GRID == "MISOMIP": 40
92-
IO_LAYOUT:
93-
description: |
94-
"default = 0
95-
The processor layout to be used, or 0,0 to automatically
96-
set the io_layout to be the same as the layout."
97-
datatype: string
98-
value: 1, 1
9992
NK:
10093
description: |
10194
"[nondim]
@@ -295,7 +288,9 @@ Global:
295288
"default = WRIGHT_FULL
296289
EQN_OF_STATE determines which ocean equation of state should be used."
297290
datatype: string
298-
value: "WRIGHT_FULL"
291+
value:
292+
$OCN_GRID == "MISOMIP": "LINEAR"
293+
else: "WRIGHT_FULL"
299294
DTFREEZE_DP:
300295
description: |
301296
"[deg C Pa-1] default = 0.0
@@ -2946,16 +2941,6 @@ Global:
29462941
units: not defined
29472942
value:
29482943
$OCN_GRID == "MISOMIP": 1.0
2949-
EQN_OF_STATE:
2950-
description: |
2951-
"default = 'WRIGHT'
2952-
EQN_OF_STATE determines which ocean equation of state
2953-
should be used. Currently, the valid choices are
2954-
'LINEAR', 'UNESCO', and 'WRIGHT'.
2955-
This is only used if USE_EOS is true."
2956-
datatype: string
2957-
value:
2958-
$OCN_GRID == "MISOMIP": "LINEAR"
29592944
RHO_T0_S0:
29602945
description: |
29612946
"[kg m-3] default = 1000.0
@@ -3148,7 +3133,6 @@ Global:
31483133
target density."
31493134
datatype: logical
31503135
units: Boolean
3151-
value:
31523136
value:
31533137
$MOM6_VERTICAL_GRID == "hycom1" and $OCN_GRID == "tx2_3v2": True
31543138
ISOMIP_TNUDG:
@@ -3737,8 +3721,8 @@ Global:
37373721
be the same as the layout.
37383722
datatype: list
37393723
value:
3740-
$OCN_GRID == "tx0.25v1":
3741-
4, 3
3724+
$OCN_GRID == "tx0.25v1": 4, 3
3725+
else: 1, 1
37423726
AUTO_MASKTABLE:
37433727
description: |
37443728
Turn on automatic mask table generation to eliminate land blocks

param_templates/input_data_list.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ mom.input_data_list:
2828
$OCN_GRID in ["tx2_3v2", "tx0.25v1"]:
2929
$INIT_LAYERS_FROM_Z_FILE == "True":
3030
"${INPUTDIR}/${TEMP_SALT_Z_INIT_FILE}"
31-
MAX_LAYER_THICKNESS_CONFIG:
32-
$MOM6_VERTICAL_GRID == "hycom1" and $OCN_GRID in ["tx2_3v2"]:
33-
"${DIN_LOC_ROOT}/ocn/mom/tx2_3v2/dz_max-2025-09-12.nc"
3431
SURFACE_PRESSURE_FILE:
3532
$OCN_GRID == "MISOMIP": "${INPUTDIR}/MISOMIP_181108.nc"
3633
SALT_RESTORE_FILE:

param_templates/json/MOM_input.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@
4343
"$OCN_GRID == \"MISOMIP\"": 40
4444
}
4545
},
46-
"IO_LAYOUT": {
47-
"description": "The processor layout to be used, or 0,0 to automatically set the io_layout to\nbe the same as the layout.\n",
48-
"datatype": "list",
49-
"value": {
50-
"$OCN_GRID == \"tx0.25v1\"": "4, 3"
51-
}
52-
},
5346
"NK": {
5447
"description": "\"[nondim]\nThe number of model layers.\"\n",
5548
"datatype": "integer",
@@ -200,10 +193,11 @@
200193
}
201194
},
202195
"EQN_OF_STATE": {
203-
"description": "\"default = 'WRIGHT'\nEQN_OF_STATE determines which ocean equation of state\nshould be used. Currently, the valid choices are\n'LINEAR', 'UNESCO', and 'WRIGHT'.\nThis is only used if USE_EOS is true.\"\n",
196+
"description": "\"default = WRIGHT_FULL\nEQN_OF_STATE determines which ocean equation of state should be used.\"\n",
204197
"datatype": "string",
205198
"value": {
206-
"$OCN_GRID == \"MISOMIP\"": "LINEAR"
199+
"$OCN_GRID == \"MISOMIP\"": "LINEAR",
200+
"else": "WRIGHT_FULL"
207201
}
208202
},
209203
"DTFREEZE_DP": {
@@ -3028,6 +3022,14 @@
30283022
"$COMP_WAV == \"ww3\" and $MOM6_WW3_CPL_METHOD == \"most\"": "0.04, 0.11, 0.33"
30293023
}
30303024
},
3025+
"IO_LAYOUT": {
3026+
"description": "The processor layout to be used, or 0,0 to automatically set the io_layout to\nbe the same as the layout.\n",
3027+
"datatype": "list",
3028+
"value": {
3029+
"$OCN_GRID == \"tx0.25v1\"": "4, 3",
3030+
"else": "1, 1"
3031+
}
3032+
},
30313033
"AUTO_MASKTABLE": {
30323034
"description": "Turn on automatic mask table generation to eliminate land blocks\n",
30333035
"datatype": "list",

param_templates/json/input_data_list.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"$OCN_GRID == \"tx2_3v2\"": "${INPUTDIR}/lev-2025-09-12.nc"
1616
},
1717
"MAX_LAYER_THICKNESS_CONFIG": {
18-
"$MOM6_VERTICAL_GRID == \"hycom1\" and $OCN_GRID in [\"tx2_3v2\"]": "${DIN_LOC_ROOT}/ocn/mom/tx2_3v2/dz_max-2025-09-12.nc"
18+
"$OCN_GRID == \"tx2_3v2\"": "${INPUTDIR}/dz_max-2025-09-12.nc"
1919
},
2020
"DIAG_COORD_DEF_Z": {
2121
"$OCN_GRID == \"tx0.25v1\"": "${INPUTDIR}/interpolate_zgrid_40L.nc"

0 commit comments

Comments
 (0)