Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cdds/cdds/common/plugins/cmip7/cmip7_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def from_name(cls, name: str) -> 'GridLabel':
NATIVE = 'native', 'g100', False
NATIVE_ZONAL = 'native-zonal', 'g100z', False
REGRIDDED = 'regridded', 'g100', False
GLOBAL_MEAN = 'global-mean', 'g100m', False
GLOBAL_MEAN = 'global-mean', 'g100', False
UGRID = 'ugrid', 'g100', True
VGRID = 'vgrid', 'g100', True
UVGRID = 'uvgrid', 'g100', True
Expand Down
5 changes: 5 additions & 0 deletions mip_convert/mip_convert/plugins/base/data/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,11 @@ def calc_zostoga(thetao, thkcello, areacello, zfullo_0, so_0, rho_0_mean, deptho
Intercomparison Project. Geoscientific Model Development,
9(9), pp.3231-3296.
"""
# Ensure the vertical coordinate is named consistently before processing
for cube in [thetao, thkcello]:
if not cube.coords('depth'):
_z_axis(cube).rename('depth')

rho_mean = iris.cube.CubeList()

so_0 = iris.util.squeeze(so_0)
Expand Down
2 changes: 1 addition & 1 deletion mip_convert/mip_convert/save/cmor/cmor_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ def zfactor(self, *args, **kwargs):
cmor.zfactor(*args, **kwargs)

def set_frequency(self, frequency, **kwargs):
self._debug_on_args('frequency', frequency, kwargs)
self._debug_on_args('frequency', [frequency], kwargs)
cmor.cmor.set_cur_dataset_attribute('frequency', frequency)
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# (C) British Crown Copyright 2026, Met Office.
# Please see LICENSE.md for license details.
import os

import pytest

from mip_convert.tests.test_functional.test_command_line import AbstractFunctionalTests
from mip_convert.tests.test_functional.utils.configurations import Cmip7TestData, SpecificInfo
from mip_convert.tests.test_functional.utils.directories import (ROOT_ANCIL_TESTING_DIR, get_cmor_log, get_output_dir,
MODEL_OUTPUT_DIR,
ROOT_OUTPUT_CASES_DIR)


class TestCmip7_zostoga_tavg_u_hm_sea(AbstractFunctionalTests):

def get_test_data(self):
test_location = os.path.join(ROOT_OUTPUT_CASES_DIR, 'test_CMIP7_ocean_zostoga_tavg-u-hm-sea')
return Cmip7TestData(
mip_table='ocean',
variables=['zostoga_tavg-u-hm-sea'],
specific_info=SpecificInfo(
common={
'test_location': test_location
},
cmor_setup={
'cmor_log_file': get_cmor_log(test_location),
},
cmor_dataset={
'output_dir': get_output_dir(test_location),
'model_id': 'UKCM2-0-LL',
'parent_model_id': 'UKCM2-0-LL',
'variant_label': 'r2i1p1f1',
'calendar': 'standard',
'branch_date_in_child': "1850-01-01T00:00:00",
'branch_date_in_parent': "1850-01-01T00:00:00",
},
request={
'ancil_files': ' '.join([
os.path.join(ROOT_ANCIL_TESTING_DIR, 'UKCM2-0-LL', 'ocean_zostoga.nc'),
os.path.join(ROOT_ANCIL_TESTING_DIR, 'UKCM2-0-LL', 'ocean_constants.nc')
]),
'model_output_dir': MODEL_OUTPUT_DIR,
'run_bounds': '1900-01-01T00:00:00 1900-02-01T00:00:00',
'suite_id': 'u-dv623',
'mip_convert_plugin': 'UKCM2'
},
streams={
'onm': {'CMIP7_ocean@mon': 'zostoga_tavg-u-hm-sea'}
},
halo_removal={
'onm': '1:-1,1:-1'
},
other={
'reference_version': 'v1',
'filenames': ['zostoga_tavg-u-hm-sea_mon_glb_g100_UKCM2-0-LL_1pctCO2_r2i1p1f1_190001-190001.nc'],
'ignore_history': True,
}
)
)

@pytest.mark.slow
def test_cmip7_mon_zostoga(self):
self.maxDiff = True
self.check_convert(plugin_id="CMIP7")
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
TEST_DIR_NAME_TEMPLATE = 'test_{project}_{mip_table}_{variable}'

ROOT_ANCIL_DIR = os.path.join(CDDS_ETC, 'ancil')
ROOT_ANCIL_TESTING_DIR = os.path.join(CDDS_ETC, 'ancil_testing')

ROOT_MIP_TABLES_DIR = os.path.join(CDDS_ETC, 'mip_tables')
CORDEX_MIP_TABLE_DIR = '{}/CORDEX/cordex-cmip6-cmor-tables/Tables'.format(ROOT_MIP_TABLES_DIR)
Expand Down