Skip to content
Merged
Changes from all commits
Commits
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
25 changes: 18 additions & 7 deletions payu/models/roms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
from payu.models.model import Model
from payu.fsops import mkdir_p

config_files = ['varinfo_seacofs.yaml']
optional_config_files = []

class Roms(Model):

def __init__(self, expt, name, config):
Expand All @@ -24,12 +21,12 @@ def __init__(self, expt, name, config):

# Model-specific configuration
self.model_type = 'roms'

self.config_files = config_files
self.optional_config_files = optional_config_files
self.config_files = []
self.optional_config_files = []

def setup(self):
# Add the model config file to the list of config files
## handle mandatory config files
if 'model_config' not in self.config:
raise ValueError(
"'model_config' field must be specified in config.yaml for "
Expand All @@ -46,6 +43,20 @@ def setup(self):

self.config_files.append(model_config)

## handle optional config files
optional_config_files = self.expt.config['optional_config_files']
if optional_config_files and isinstance(optional_config_files, str):
optional_config_files = [optional_config_files]

for optional_file in optional_config_files:
if not (Path(self.control_path) / optional_file).is_file():
raise FileNotFoundError(
f"Optional configuration file '{optional_file}' not found in the "
f"control directory: {self.control_path}"
)

self.optional_config_files.extend(optional_config_files)

super(Roms, self).setup()

# Set the model config file to be added after the executable
Expand Down
Loading