From 77874a6d3caaafa69b7a6d5de3bc0dd0d7ae3059 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Mon, 8 Jan 2024 14:18:46 -0800 Subject: [PATCH] Fixup symlink and step creation for ssh_adjustment step --- polaris/ocean/ice_shelf/__init__.py | 32 ++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/polaris/ocean/ice_shelf/__init__.py b/polaris/ocean/ice_shelf/__init__.py index 24a5b95e9..c21078d5e 100644 --- a/polaris/ocean/ice_shelf/__init__.py +++ b/polaris/ocean/ice_shelf/__init__.py @@ -35,30 +35,38 @@ def setup_ssh_adjustment_steps(self, init, config, config_filename, current_init = init for iteration in range(num_iterations): name = f'ssh_forward_{iteration}' - ssh_forward = SshForward( - component=component, resolution=resolution, indir=indir, - mesh=init, init=current_init, name=name, package=package, - yaml_filename=yaml_filename, - yaml_replacements=yaml_replacements) - ssh_forward.set_shared_config(config, link=config_filename) subdir = f'{indir}/ssh_adjustment/{name}' if subdir in component.steps: shared_step = component.steps[subdir] else: + ssh_forward = SshForward( + component=component, resolution=resolution, indir=indir, + mesh=init, init=current_init, name=name, package=package, + yaml_filename=yaml_filename, + yaml_replacements=yaml_replacements) + ssh_forward.set_shared_config(config, link=config_filename) shared_step = ssh_forward - self.add_step(shared_step, symlink=f'ssh_adjustment/{name}') + if indir == self.subdir: + symlink = None + else: + symlink = f'ssh_adjustment/{name}' + self.add_step(shared_step, symlink=symlink) name = f'ssh_adjust_{iteration}' - ssh_adjust = SshAdjustment( - component=component, resolution=resolution, indir=indir, - name=name, init=init, forward=ssh_forward) - ssh_adjust.set_shared_config(config, link=config_filename) subdir = f'{indir}/ssh_adjustment/{name}' if subdir in component.steps: shared_step = component.steps[subdir] else: + ssh_adjust = SshAdjustment( + component=component, resolution=resolution, indir=indir, + name=name, init=init, forward=ssh_forward) + ssh_adjust.set_shared_config(config, link=config_filename) shared_step = ssh_adjust - self.add_step(shared_step, symlink=f'ssh_adjustment/{name}') + if indir == self.subdir: + symlink = None + else: + symlink = f'ssh_adjustment/{name}' + self.add_step(shared_step, symlink=symlink) # for the next iteration, ssh_forward is run from the adjusted # initial state (the output of ssh_adustment) current_init = shared_step