Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlink instead of copy the mod_def.ww3 input in the cesm_cmeps driver #368

Merged
merged 3 commits into from
Sep 29, 2023
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
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)
aidanheerdegen marked this conversation as resolved.
Show resolved Hide resolved

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
Loading