Skip to content

Commit

Permalink
Merge pull request #368 from dougiesquire/365_cesm_cmeps_ww3_input
Browse files Browse the repository at this point in the history
Symlink instead of copy the `mod_def.ww3` input in the cesm_cmeps driver
  • Loading branch information
dougiesquire committed Sep 29, 2023
2 parents 2d16f18 + 7878fba commit 7fd5204
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions payu/models/cesm_cmeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import shutil
import multiprocessing

from payu.fsops import mkdir_p
from payu.fsops import mkdir_p, make_symlink
from payu.models.model import Model
from payu.models.fms import fms_collate

Expand Down Expand Up @@ -168,17 +168,16 @@ def setup(self):

self.runconfig.write()

# TODO: Should have a better way to do this
# Horrible hack to make a link to the mod_def.ww3 input in the work
# directory
# The ww3 mod_def input needs to be in work_path and called mod_def.ww3
if "ww3dev" in self.components.values():
files = glob.glob(
os.path.join(self.work_input_path, "*mod_def.ww3*"),
recursive=False
)
if files:
assert len(files) == 1, "Multiple mod_def.ww3 files found in input directory"
f_dst = os.path.join(self.work_path, "mod_def.ww3")
shutil.copy(files[0], f_dst)
f_name = "mod_def.ww3"
f_src = os.path.join(self.work_input_path, f_name)
f_dst = os.path.join(self.work_path, f_name)

if os.path.isfile(f_src):
make_symlink(f_src, f_dst)
else:
# TODO: copied this from other models. Surely we want to exit here or something
print('payu: error: Unable to find mod_def.ww3 file in input directory')
Expand Down

0 comments on commit 7fd5204

Please sign in to comment.