Skip to content

Commit c1abbc3

Browse files
Copilotilaflott
andauthored
fix CMIP7 further_examples: use g999 grid_label (CMIP7 CV-valid), fix output glob, remove xfail — all 3 tests pass
Agent-Logs-Url: https://github.com/ilaflott/fremorizer/sessions/5dfb8553-ec4f-4f7b-b00e-1ad53d2f12d9 Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
1 parent 4c38a90 commit c1abbc3

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

fremorizer/tests/test_cmor_run_subtool_further_examples.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -200,28 +200,23 @@ def test_case_cmip6( # pylint: disable=too-many-arguments,too-many-positional-a
200200
pytest.param(
201201
f'{MOCK_ARCHIVE_ROOT}/{ESM4_DEV_PP_DIR}'
202202
'/ocean_monthly_z_1x1deg/ts/monthly/5yr/',
203-
'CMIP7_ocean', 'so', 'gr', '0001', 'noleap',
204-
id='ocean_so_gr',
203+
'CMIP7_ocean', 'so', 'g999', '0001', 'noleap',
204+
id='ocean_so_g999',
205205
),
206206
pytest.param(
207207
f'{MOCK_ARCHIVE_ROOT}/{ESM4_DEV_PP_DIR}'
208208
'/ocean_monthly/ts/monthly/5yr/',
209-
'CMIP7_ocean', 'sos', 'gn', '0001', 'noleap',
210-
id='ocean_sos_gn',
209+
'CMIP7_ocean', 'sos', 'g999', '0001', 'noleap',
210+
id='ocean_sos_g999',
211211
),
212212
pytest.param(
213213
f'{MOCK_ARCHIVE_ROOT}/{ESM4_DEV_PP_DIR}'
214214
'/land/ts/monthly/5yr/',
215-
'CMIP7_land', 'lai', 'gr1', '0001', 'noleap',
216-
id='land_lai_gr1',
215+
'CMIP7_land', 'lai', 'g999', '0001', 'noleap',
216+
id='land_lai_g999',
217217
),
218218
],
219219
)
220-
@pytest.mark.xfail(
221-
reason='CMIP7 cmor.write fails for mock archive variables: CMIP7 support in development',
222-
strict=True,
223-
raises=AssertionError,
224-
)
225220
def test_case_cmip7( # pylint: disable=too-many-arguments,too-many-positional-arguments
226221
testfile_dir, table, opt_var_name, grid_label, start, calendar,
227222
tmp_path, monkeypatch,
@@ -253,12 +248,15 @@ def test_case_cmip7( # pylint: disable=too-many-arguments,too-many-positional-a
253248
calendar_type=calendar,
254249
)
255250

256-
cmor_output_dir = (
251+
# CMIP7 output_path_template:
252+
# <activity_id>/<source_id>/<experiment_id>/<member_id>/
253+
# <variable_id>/<branding_suffix>/<grid_label>
254+
# Use recursive glob to find output regardless of branding suffix.
255+
cmor_output_glob = (
257256
f'{outdir}/{CMOR_CREATES_DIR_BASE_CMIP7}'
258-
f'/{opt_var_name}'
257+
f'/{opt_var_name}/**/*{opt_var_name}*{grid_label}*.nc'
259258
)
260-
cmor_output_glob = f'{cmor_output_dir}/*{opt_var_name}*{grid_label}*.nc'
261-
cmor_output_files = glob.glob(cmor_output_glob)
259+
cmor_output_files = glob.glob(cmor_output_glob, recursive=True)
262260
assert len(cmor_output_files) >= 1, (
263261
f'no CMOR output found matching {cmor_output_glob}'
264262
)

0 commit comments

Comments
 (0)