Skip to content

Commit

Permalink
Fixup symlink and step creation for ssh_adjustment step
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Jan 8, 2024
1 parent b838c4a commit 77874a6
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions polaris/ocean/ice_shelf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 77874a6

Please sign in to comment.