diff --git a/compass/landice/ismip7/ice_sheet_params.py b/compass/landice/ismip7/ice_sheet_params.py index d991eae45c..222f202d89 100644 --- a/compass/landice/ismip7/ice_sheet_params.py +++ b/compass/landice/ismip7/ice_sheet_params.py @@ -44,7 +44,7 @@ }, 'ais': { 'atm_version': 'v1', - 'ocean_version': 'v1', + 'ocean_version': 'v2', 'atm_model': 'RACMO2.3p2-ERA', 'ocean_model': None, # AIS OCX ocean files have no model token and live in per-choice diff --git a/compass/landice/tests/ismip7_forcing/ocean_thermal/process_thermal_forcing.py b/compass/landice/tests/ismip7_forcing/ocean_thermal/process_thermal_forcing.py index 595d90b964..3f7c60e3dd 100644 --- a/compass/landice/tests/ismip7_forcing/ocean_thermal/process_thermal_forcing.py +++ b/compass/landice/tests/ismip7_forcing/ocean_thermal/process_thermal_forcing.py @@ -210,13 +210,33 @@ def _link_atmosphere_outputs(self, output_base_path, atm_forcing_group, dst_dir = os.path.join(output_base_path, choice_forcing_group, "atmosphere") + + # Guard against destination directory resolving to source directory + # (e.g., if choice_forcing_group is a symlink to atm_forcing_group) + if os.path.realpath(dst_dir) == os.path.realpath(src_dir): + logger.warning( + f"Skipping atmosphere mirror for {choice_forcing_group}: " + f"destination directory {dst_dir} resolves to source " + f"directory {src_dir}. Relinking would overwrite the " + f"original files.") + return + os.makedirs(dst_dir, exist_ok=True) for fname in os.listdir(src_dir): src = os.path.join(src_dir, fname) - if not os.path.isfile(src): + if os.path.islink(src) or not os.path.isfile(src): continue dst = os.path.join(dst_dir, fname) + + # Guard against destination file resolving to source file + if os.path.realpath(dst) == os.path.realpath(src): + logger.warning( + f"Skipping {fname}: destination {dst} resolves to " + f"source {src}. Relinking would overwrite the " + f"original.") + continue + if os.path.lexists(dst): os.remove(dst) os.symlink(src, dst)