From a534df310d711ca7791e38331dc89c41f891b96a Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 1 Jul 2024 09:50:34 -0500 Subject: [PATCH 1/2] Fix initial state filename in files for E3SM Following https://github.com/MPAS-Dev/compass/pull/813, the initial state is the same whether ice shelf cavities are present or not. It is the result of the `init/initial_state` step --- .../ocean/tests/global_ocean/files_for_e3sm/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/__init__.py b/compass/ocean/tests/global_ocean/files_for_e3sm/__init__.py index 211bccd520..afa6ead955 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/__init__.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/__init__.py @@ -162,12 +162,8 @@ def configure(self): base_mesh_filename) if init is not None: - if mesh.with_ice_shelf_cavities: - initial_state_filename = \ - f'{init.path}/ssh_adjustment/adjusted_init.nc' - else: - initial_state_filename = \ - f'{init.path}/initial_state/initial_state.nc' + initial_state_filename = \ + f'{init.path}/initial_state/initial_state.nc' initial_state_filename = os.path.join(self.base_work_dir, initial_state_filename) config.set('files_for_e3sm', 'ocean_initial_state_filename', From 481fc3d40651ec6ceb7136fd5e9baf0ead46b5eb Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 1 Jul 2024 10:19:16 -0500 Subject: [PATCH 2/2] Fix handling of existing remapped ice-shelf melt Since the step in the init test case doesn't exist at construciton of the associated step in files_for_e3sm, we need to add the link to the output file during `setup()` instead. --- .../files_for_e3sm/remap_ice_shelf_melt.py | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_ice_shelf_melt.py b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_ice_shelf_melt.py index 098adbf5d5..c49cc941ab 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_ice_shelf_melt.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_ice_shelf_melt.py @@ -30,18 +30,33 @@ def __init__(self, test_case, init): init : compass.ocean.tests.global_ocean.init.Init The test case that produces the initial condition for this run - """ # noqa: E501 + """ super().__init__(test_case, name='remap_ice_shelf_melt', ntasks=512, min_tasks=1) self.init = init + + def setup(self): + """ + setup input files based on config options + """ + super().setup() + if not self.with_ice_shelf_cavities: + return + filename = 'prescribed_ismf_paolo2023.nc' - if init is None: + + if self.init is None: self.add_input_file( filename='Paolo_2023_ANT_G1920V01_IceShelfMelt.nc', target='Paolo_2023_ANT_G1920V01_IceShelfMelt.nc', database='initial_condition_database', url='https://its-live-data.s3.amazonaws.com/height_change/Antarctica/Floating/ANT_G1920V01_IceShelfMelt.nc') # noqa: E501 - elif 'remap_ice_shelf_melt' in self.init.steps: + self.add_output_file(filename=filename) + else: + if 'remap_ice_shelf_melt' not in self.init.steps: + raise ValueError('Something seems to be misconfigured. No ' + 'remap_ice_shelf_melt step found in init ' + 'test case.') melt_path = \ self.init.steps['remap_ice_shelf_melt'].path @@ -49,15 +64,6 @@ def __init__(self, test_case, init): filename=filename, work_dir_target=f'{melt_path}/{filename}') - def setup(self): - """ - setup input files based on config options - """ - super().setup() - filename = 'prescribed_ismf_paolo2023.nc' - if self.with_ice_shelf_cavities: - self.add_output_file(filename=filename) - def run(self): """ Run this step of the test case