|
38 | 38 | ICE_HISTORY_NML_FNAME = "ice_history.nml" |
39 | 39 | ICEFIELDS_NML_NAME = "icefields_nml" |
40 | 40 |
|
| 41 | +MOM_INPUT_NML_FNAME = "input.nml" |
| 42 | +OCEAN_MODEL_NML_NAME = "ocean_model_nml" |
| 43 | +VALID_IO_LAYOUT = [1, 1] |
| 44 | + |
41 | 45 |
|
42 | 46 | ### Some functions to avoid copying assertion error text |
43 | 47 | def error_field_nonexistence(field: str, file: str) -> str: |
@@ -203,24 +207,55 @@ def test_config_restart_freq(self, config): |
203 | 207 | "restart_freq", "config.yaml", VALID_RESTART_FREQ |
204 | 208 | ) |
205 | 209 |
|
206 | | - def test_mppnccombine_fast_collate_exe(self, config): |
207 | | - if "collate" in config: |
208 | | - assert ( |
209 | | - config["collate"]["exe"] == VALID_MPPNCCOMBINE_EXE |
210 | | - ), error_field_incorrect( |
211 | | - "collate.exe", "config.yaml", VALID_MPPNCCOMBINE_EXE |
212 | | - ) |
| 210 | + def test_collation_disabled(self, config, branch): |
| 211 | + """ |
| 212 | + Check that collation is not enabled. |
| 213 | + """ |
| 214 | + if branch.config_scenario == "amip": |
| 215 | + pytest.skip("amip scenarios do not contain the MOM sub-model") |
213 | 216 |
|
214 | | - assert "mpi" in config["collate"], error_field_nonexistence( |
215 | | - "collate.mpi", "config.yaml" |
216 | | - ) |
| 217 | + assert "collate" in config, error_field_nonexistence( |
| 218 | + "collate", "config.yaml" |
| 219 | + ) |
217 | 220 |
|
218 | | - # Loading the yaml into a dict also converts |
219 | | - # `collate.mpi:true`/`collate.mpi:false` to `True`/`False` so we |
220 | | - # can assert if it is a `bool`. |
221 | | - assert isinstance(config["collate"]["mpi"], bool), error_field_incorrect( |
222 | | - "collate.mpi", "config.yaml", "true or false" |
| 221 | + assert not config["collate"]["enable"], error_field_incorrect( |
| 222 | + "collate.enable", "config.yaml", False |
| 223 | + ) |
| 224 | + |
| 225 | + def test_mom_io(self, branch, config, control_path): |
| 226 | + """ |
| 227 | + Check that io_layout set to 1,1 in MOM namelist |
| 228 | + """ |
| 229 | + if branch.config_scenario == "amip": |
| 230 | + pytest.skip("amip scenarios do not contain the MOM sub-model") |
| 231 | + |
| 232 | + # Find MOM sub-model control path |
| 233 | + model_name = None |
| 234 | + for sub_model in config["submodels"]: |
| 235 | + if sub_model["model"] == "mom": |
| 236 | + model_name = sub_model["name"] |
| 237 | + assert model_name |
| 238 | + mom_control_path = control_path / model_name |
| 239 | + |
| 240 | + # Check input.nml exists |
| 241 | + mom_input_path = mom_control_path / MOM_INPUT_NML_FNAME |
| 242 | + assert mom_input_path.is_file(), ( |
| 243 | + f"No {MOM_INPUT_NML_FNAME} file found. This is a required " |
| 244 | + "configuration file for the MOM model component." |
| 245 | + ) |
| 246 | + |
| 247 | + mom_input = f90nml.read(mom_input_path) |
| 248 | + |
| 249 | + assert "io_layout" in mom_input[OCEAN_MODEL_NML_NAME], ( |
| 250 | + error_field_nonexistence("io_layout", MOM_INPUT_NML_FNAME) |
| 251 | + ) |
| 252 | + assert mom_input["ocean_model_nml"]["io_layout"] == VALID_IO_LAYOUT, ( |
| 253 | + error_field_incorrect( |
| 254 | + "io_layout", |
| 255 | + MOM_INPUT_NML_FNAME, |
| 256 | + ','.join(i for i in VALID_IO_LAYOUT) |
223 | 257 | ) |
| 258 | + ) |
224 | 259 |
|
225 | 260 | def test_cice_configuration_icefields_nml_in_ice_history_nml( |
226 | 261 | self, branch, config, control_path |
|
0 commit comments