diff --git a/payu/models/mom6.py b/payu/models/mom6.py index 86943975..acbc6eea 100644 --- a/payu/models/mom6.py +++ b/payu/models/mom6.py @@ -10,6 +10,7 @@ # Standard library import os +import shutil # Extensions import f90nml @@ -78,3 +79,20 @@ def init_config(self): input_nml['SIS_input_nml']['input_filename'] = input_type f90nml.write(input_nml, input_fpath, force=True) + + # Check to see if the parameter files were included in configuration files + config_files = set(self.config_files).union(self.optional_config_files) + for input_namelist in ['MOM_input_nml', 'SIS_input_nml']: + parameter_files = input_nml.get(input_namelist , {}).get('parameter_filename', []) + if isinstance(parameter_files, str): + parameter_files = [parameter_files] # Transform to list + + for filename in parameter_files: + if filename not in config_files: + print(f"payu: warning: {filename} in {input_namelist} in input.nml is not in mom6's config_files or optional_config_files") + + self.config_files.append(filename) # Extend config files + + # Copy parameter file from control path to work path + file_path = os.path.join(self.control_path, filename) + shutil.copy(file_path, self.work_path)