From e20d8c636ed4c761ab4cb9f1233d068f2c846f2a Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 23 May 2025 16:09:03 +1000 Subject: [PATCH] allow repeat_run from a restart defined in config.yaml --- payu/models/access.py | 4 ++-- payu/models/access_esm1p6.py | 4 ++-- payu/models/cesm_cmeps.py | 2 +- payu/models/mitgcm.py | 5 ++--- payu/models/mom6.py | 2 +- payu/models/um.py | 5 ++--- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/payu/models/access.py b/payu/models/access.py index a26e16b5..456a5e85 100644 --- a/payu/models/access.py +++ b/payu/models/access.py @@ -112,7 +112,7 @@ def setup(self): caltype = cpl_group['caltype'] # Get timing information for the new run. - if model.prior_restart_path and not self.expt.repeat_run: + if model.prior_restart_path: # Read the start date from the restart date namelist. start_date_fpath = os.path.join( model.prior_restart_path, @@ -202,7 +202,7 @@ def setup(self): f90nml.write(cpl_nml, nml_work_path + '~') shutil.move(nml_work_path + '~', nml_work_path) - if model.prior_restart_path and not self.expt.repeat_run: + if model.prior_restart_path: # Set up and check the cice restart files. model.overwrite_restart_ptr(run_start_date, previous_runtime, diff --git a/payu/models/access_esm1p6.py b/payu/models/access_esm1p6.py index ee998f7c..e043f10f 100644 --- a/payu/models/access_esm1p6.py +++ b/payu/models/access_esm1p6.py @@ -121,7 +121,7 @@ def setup(self): caltype = cpl_group['caltype'] # Get timing information for the new run. - if model.prior_restart_path and not self.expt.repeat_run: + if model.prior_restart_path: # Read the start date from the restart date namelist. start_date_fpath = os.path.join( model.prior_restart_path, @@ -211,7 +211,7 @@ def setup(self): f90nml.write(cpl_nml, nml_work_path + '~') shutil.move(nml_work_path + '~', nml_work_path) - if model.prior_restart_path and not self.expt.repeat_run: + if model.prior_restart_path: # Set up and check the cice restart files. model.overwrite_restart_ptr(run_start_date, previous_runtime, diff --git a/payu/models/cesm_cmeps.py b/payu/models/cesm_cmeps.py index e4298401..6b8062e0 100644 --- a/payu/models/cesm_cmeps.py +++ b/payu/models/cesm_cmeps.py @@ -148,7 +148,7 @@ def setup(self): # Copy configuration files from control path to work path self.setup_configuration_files() - if self.prior_restart_path and not self.expt.repeat_run: + if self.prior_restart_path: start_type = 'continue' # Overwrite restart pointer symlinks with copies diff --git a/payu/models/mitgcm.py b/payu/models/mitgcm.py index da9a00c1..d11f2d61 100644 --- a/payu/models/mitgcm.py +++ b/payu/models/mitgcm.py @@ -75,7 +75,7 @@ def setup(self): # Generic model setup super(Mitgcm, self).setup() - if self.prior_restart_path and not self.expt.repeat_run: + if self.prior_restart_path: # Determine total number of timesteps since initialisation core_restarts = [f for f in os.listdir(self.prior_restart_path) if f.startswith('pickup.')] @@ -128,8 +128,7 @@ def setup(self): # Assume n_timesteps and dt set correctly pass - if t_start is None or (self.prior_restart_path - and not self.expt.repeat_run): + if t_start is None or self.prior_restart_path: # Look for a restart file from a previous run if os.path.exists(restart_calendar_path): with open(restart_calendar_path, 'r') as restart_file: diff --git a/payu/models/mom6.py b/payu/models/mom6.py index 73f7efb6..eff3c78e 100644 --- a/payu/models/mom6.py +++ b/payu/models/mom6.py @@ -114,7 +114,7 @@ def init_config(self): input_nml = f90nml.read(input_fpath) - if ((self.expt.counter == 0 or self.expt.repeat_run) and + if ((self.expt.counter == 0) and self.prior_restart_path is None): input_type = 'n' else: diff --git a/payu/models/um.py b/payu/models/um.py index 341870ec..f0133bb7 100644 --- a/payu/models/um.py +++ b/payu/models/um.py @@ -133,7 +133,7 @@ def setup(self): # Stage the UM restart file. - if self.prior_restart_path and not self.expt.repeat_run: + if self.prior_restart_path : f_src = os.path.join(self.prior_restart_path, self.restart) f_dst = os.path.join(self.work_input_path, self.restart) @@ -170,8 +170,7 @@ def setup(self): self.restart_calendar_file) # Modify namelists for a continuation run. - if self.prior_restart_path and not self.expt.repeat_run \ - and os.path.exists(restart_calendar_path): + if self.prior_restart_path and os.path.exists(restart_calendar_path): run_start_date = self.read_calendar_file(restart_calendar_path)