diff --git a/esmvalcore/cmor/_fixes/emac/_base_fixes.py b/esmvalcore/cmor/_fixes/emac/_base_fixes.py index 5082f612c9..5f9428258c 100644 --- a/esmvalcore/cmor/_fixes/emac/_base_fixes.py +++ b/esmvalcore/cmor/_fixes/emac/_base_fixes.py @@ -38,11 +38,8 @@ def get_cube(self, cubes, var_name=None): raise ValueError( f"No variable of {var_names} necessary for the extraction/" f"derivation the CMOR variable '{self.vardef.short_name}' is " - f"available in the input file. Hint: in case you tried to extract " - f"a 3D variable defined on pressure levels, it might be necessary " - f"to define the EMAC variable name in the recipe (e.g., " - f"'raw_name: tm1_p39_cav') if the default number of pressure " - f"levels is not available in the input file." + f"available in the input file. Please specify a valid `raw_name` " + f"in the recipe or extra facets file." ) diff --git a/esmvalcore/config/extra_facets/emac-mappings.yml b/esmvalcore/config/extra_facets/emac-mappings.yml index 3e98cd2ba4..5efd0edab4 100644 --- a/esmvalcore/config/extra_facets/emac-mappings.yml +++ b/esmvalcore/config/extra_facets/emac-mappings.yml @@ -11,14 +11,15 @@ # latter case, the prioritization is given by the order of the list; if # possible, use the first entry, if this is not present, use the second, etc. # This is particularly useful for variables where regular averages ("*_ave") -# or conditional averages ("*_cav") exist. For 3D variables defined on -# pressure levels, only the pressure levels defined by the CMOR table (e.g., -# for Amon's ta: "tm1_p19_cav" and "tm1_p19_ave") are given. If other -# pressure levels are desired, e.g., "tm1_p39_cav", this has to be explicitly -# specified in the recipe using "raw_name: tm1_p39_cav" or "raw_name: -# [tm1_p19_cav, tm1_p39_cav]". +# or conditional averages ("*_cav") exist. If other variables are desired, +# e.g., "tm1_p39_cav", this has to be explicitly specified in the recipe +# ("raw_name: tm1_p39_cav".) # - Asterisks ("*") in the comments in list below refer to either "cav" or # "ave". "cav" is prioritized. +# - The channels given here are generalization and may not always be +# applicable. In that case choose the channels with the appropriate variable +# per recipe. +# # A complete list of supported keys is given in the documentation (see # ESMValCore/doc/quickstart/find_data.rst). @@ -35,71 +36,71 @@ EMAC: # 1D/2D dynamical/meteorological variables '*': awhea: # non-CMOR variable - raw_name: [awhea_cav, awhea_ave] + raw_name: [awhea_cav, awhea_ave, awhea] channel: Omon clivi: - raw_name: [xivi_cav, xivi_ave] + raw_name: [xivi_cav, xivi_ave, xivi] channel: Amon clt: - raw_name: [aclcov_cav, aclcov_ave] + raw_name: [aclcov_cav, aclcov_ave, aclcov] raw_units: '1' channel: Amon clwvi: # derived from xlvi_*, xivi_* channel: Amon co2mass: - raw_name: [MP_CO2_cav, MP_CO2_ave] + raw_name: [MP_CO2_cav, MP_CO2_ave, MP_CO2] channel: tracer_pdef_gp evspsbl: - raw_name: [evap_cav, evap_ave] + raw_name: [evap_cav, evap_ave, evap] channel: Amon hfls: - raw_name: [ahfl_cav, ahfl_ave] + raw_name: [ahfl_cav, ahfl_ave, ahfl] channel: Amon hfns: # ESMValCore-derivation channel: Amon hfss: - raw_name: [ahfs_cav, ahfs_ave] + raw_name: [ahfs_cav, ahfs_ave, ahfs] channel: Amon hurs: - raw_name: [rh_2m_cav, rh_2m_ave] + raw_name: [rh_2m_cav, rh_2m_ave, rh_2m] raw_units: '1' channel: Amon od550aer: - raw_name: [aot_opt_TOT_550_total_cav, aot_opt_TOT_550_total_ave] + raw_name: [aot_opt_TOT_550_total_cav, aot_opt_TOT_550_total_ave, aot_opt_TOT_550_total] raw_units: '1' channel: AERmon pr: # derived from aprl_*, aprc_* channel: Amon prc: - raw_name: [aprc_cav, aprc_ave] + raw_name: [aprc_cav, aprc_ave, aprc] channel: Amon prl: # non-CMOR variable - raw_name: [aprl_cav, aprl_ave] + raw_name: [aprl_cav, aprl_ave, aprl] channel: Amon prsn: - raw_name: [aprs_cav, aprs_ave] + raw_name: [aprs_cav, aprs_ave, aprs] channel: Amon prw: - raw_name: [qvi_cav, qvi_ave] + raw_name: [qvi_cav, qvi_ave, qvi] channel: Amon ps: - raw_name: [aps_cav, aps_ave] + raw_name: [aps_cav, aps_ave, aps] channel: Amon psl: - raw_name: [slp_cav, slp_ave] + raw_name: [slp_cav, slp_ave, slp] channel: Amon rlds: # derived from flxtbot_*, tradsu_* channel: Amon rlns: # ESMValCore-derivation channel: Amon rlus: - raw_name: [tradsu_cav, tradsu_ave] + raw_name: [tradsu_cav, tradsu_ave, tradsu] channel: Amon rlut: - raw_name: [flxttop_cav, flxttop_ave] + raw_name: [flxttop_cav, flxttop_ave, flxttop] channel: Amon rlutcs: - raw_name: [flxtftop_cav, flxtftop_ave] + raw_name: [flxtftop_cav, flxtftop_ave, flxtftop] channel: Amon rsds: # derived from flxsbot_*, sradsu_* channel: Amon @@ -110,32 +111,32 @@ EMAC: rsnt: # ESMValCore-derivation channel: Amon rsus: - raw_name: [sradsu_cav, sradsu_ave] + raw_name: [sradsu_cav, sradsu_ave, sradsu] channel: Amon rsut: - raw_name: [srad0u_cav, srad0u_ave] + raw_name: [srad0u_cav, srad0u_ave, srad0u] channel: Amon rsutcs: - raw_name: [flxusftop_cav, flxusftop_ave] + raw_name: [flxusftop_cav, flxusftop_ave, flxusftop] channel: Amon rtmt: # derived from flxttop_*, flxstop_* channel: Amon sfcWind: - raw_name: [wind10_cav, wind10_ave] + raw_name: [wind10_cav, wind10_ave, wind10] channel: Amon siconc: - raw_name: [seaice_cav, seaice_ave] + raw_name: [seaice_cav, seaice_ave, seaice] raw_units: '1' channel: Amon siconca: - raw_name: [seaice_cav, seaice_ave] + raw_name: [seaice_cav, seaice_ave, seaice] raw_units: '1' channel: Amon sithick: - raw_name: [siced_cav, siced_ave] + raw_name: [siced_cav, siced_ave, siced] channel: Amon tas: - raw_name: [temp2_cav, temp2_ave] + raw_name: [temp2_cav, temp2_ave, temp2] channel: Amon tasmax: raw_name: temp2_max @@ -144,10 +145,10 @@ EMAC: raw_name: temp2_min channel: Amon tauu: - raw_name: [ustr_cav, ustr_ave] + raw_name: [ustr_cav, ustr_ave, ustr] channel: Amon tauv: - raw_name: [vstr_cav, vstr_ave] + raw_name: [vstr_cav, vstr_ave, vstr] channel: Amon tos: raw_name: tsw @@ -155,210 +156,99 @@ EMAC: toz: channel: column ts: - raw_name: [tsurf_cav, tsurf_ave] + raw_name: [tsurf_cav, tsurf_ave, tsurf] channel: Amon uas: - raw_name: [u10_cav, u10_ave] + raw_name: [u10_cav, u10_ave, u10] channel: Amon vas: - raw_name: [v10_cav, v10_ave] + raw_name: [v10_cav, v10_ave, v10] channel: Amon # Tracers (non-CMOR variables) MP_BC_tot: # derived from MP_BC_ks_*, MP_BC_as_*, MP_BC_cs_*, MP_BC_ki_* channel: tracer_pdef_gp MP_CFCl3: - raw_name: [MP_CFCl3_cav, MP_CFCl3_ave] + raw_name: [MP_CFCl3_cav, MP_CFCl3_ave, MP_CFCl3] channel: tracer_pdef_gp MP_ClOX: - raw_name: [MP_ClOX_cav, MP_ClOX_ave] + raw_name: [MP_ClOX_cav, MP_ClOX_ave, MP_ClOX] channel: tracer_pdef_gp MP_CH4: - raw_name: [MP_CH4_cav, MP_CH4_ave] + raw_name: [MP_CH4_cav, MP_CH4_ave, MP_CH4] channel: tracer_pdef_gp MP_CO: - raw_name: [MP_CO_cav, MP_CO_ave] + raw_name: [MP_CO_cav, MP_CO_ave, MP_CO] channel: tracer_pdef_gp MP_CO2: - raw_name: [MP_CO2_cav, MP_CO2_ave] + raw_name: [MP_CO2_cav, MP_CO2_ave, MP_CO2] channel: tracer_pdef_gp MP_DU_tot: # derived from MP_DU_as_*, MP_DU_cs_*, MP_DU_ai_*, MP_DU_ci_* channel: tracer_pdef_gp MP_N2O: - raw_name: [MP_N2O_cav, MP_N2O_ave] + raw_name: [MP_N2O_cav, MP_N2O_ave, MP_N2O] channel: tracer_pdef_gp MP_NH3: - raw_name: [MP_NH3_cav, MP_NH3_ave] + raw_name: [MP_NH3_cav, MP_NH3_ave, MP_NH3] channel: tracer_pdef_gp MP_NO: - raw_name: [MP_NO_cav, MP_NO_ave] + raw_name: [MP_NO_cav, MP_NO_ave, MP_NO] channel: tracer_pdef_gp MP_NO2: - raw_name: [MP_NO2_cav, MP_NO2_ave] + raw_name: [MP_NO2_cav, MP_NO2_ave, MP_NO2] channel: tracer_pdef_gp MP_NOX: - raw_name: [MP_NOX_cav, MP_NOX_ave] + raw_name: [MP_NOX_cav, MP_NOX_ave, MP_NOX] channel: tracer_pdef_gp MP_O3: - raw_name: [MP_O3_cav, MP_O3_ave] + raw_name: [MP_O3_cav, MP_O3_ave, MP_O3] channel: tracer_pdef_gp MP_OH: - raw_name: [MP_OH_cav, MP_OH_ave] + raw_name: [MP_OH_cav, MP_OH_ave, MP_OH] channel: tracer_pdef_gp MP_S: - raw_name: [MP_S_cav, MP_S_ave] + raw_name: [MP_S_cav, MP_S_ave, MP_S] channel: tracer_pdef_gp MP_SO2: - raw_name: [MP_SO2_cav, MP_SO2_ave] + raw_name: [MP_SO2_cav, MP_SO2_ave, MP_SO2] channel: tracer_pdef_gp MP_SO4mm_tot: # derived from MP_SO4mm_ns_*, MP_SO4mm_ks_*, MP_SO4mm_as_*, MP_SO4mm_cs_* channel: tracer_pdef_gp MP_SS_tot: # derived from MP_SS_ks_*, MP_SS_as_*, MP_SS_cs_* channel: tracer_pdef_gp - # 3D dynamical/meteorological variables - 6hrLev: - ta: - raw_name: [tm1_cav, tm1_ave] - channel: Amon - ua: - raw_name: [um1_cav, um1_ave] - channel: Amon - va: - raw_name: [vm1_cav, vm1_ave] - channel: Amon - AERmon: - ua: - raw_name: [um1_cav, um1_ave] - channel: Amon - va: - raw_name: [vm1_cav, vm1_ave] - channel: Amon - zg: - raw_name: [geopot_cav, geopot_ave] - channel: Amon - Amon: - cl: - raw_name: [aclcac_cav, aclcac_ave] - raw_units: '1' - channel: Amon - cli: - raw_name: [xim1_cav, xim1_ave] - channel: Amon - clw: - raw_name: [xlm1_cav, xlm1_ave] - channel: Amon - hur: # defined on plev19 - raw_name: [rhum_p19_cav, rhum_p19_ave] - channel: Amon - hus: # defined on plev19 - raw_name: [qm1_p19_cav, qm1_p19_ave] - channel: Amon - ta: # defined on plev19 - raw_name: [tm1_p19_cav, tm1_p19_ave] - channel: Amon - ua: # defined on plev19 - raw_name: [um1_p19_cav, um1_p19_ave] - channel: Amon - va: # defined on plev19 - raw_name: [vm1_p19_cav, vm1_p19_ave] - channel: Amon - zg: # defined on plev19 - raw_name: [geopot_p19_cav, geopot_p19_ave] - channel: Amon - CF3hr: - ta: - raw_name: [tm1_cav, tm1_ave] - channel: Amon - CFday: + # 3D dynamical/meteorological variables cl: - raw_name: [aclcac_cav, aclcac_ave] + raw_name: [aclcac_cav, aclcac_ave, aclcac] raw_units: '1' channel: Amon cli: - raw_name: [xim1_cav, xim1_ave] + raw_name: [xim1_cav, xim1_ave, xim1] channel: Amon clw: - raw_name: [xlm1_cav, xlm1_ave] + raw_name: [xlm1_cav, xlm1_ave, xlm1] channel: Amon hur: - raw_name: [rhum_cav, rhum_ave] + raw_name: [rhum_cav, rhum_ave, rhum] channel: Amon hus: - raw_name: [qm1_cav, qm1_ave] + raw_name: [qm1_cav, qm1_ave, qm1] channel: Amon - ta: - raw_name: [tm1_cav, tm1_ave] - channel: Amon - ua: - raw_name: [um1_cav, um1_ave] - channel: Amon - va: - raw_name: [vm1_cav, vm1_ave] - channel: Amon - zg: - raw_name: [geopot_cav, geopot_ave] - channel: Amon - CFmon: - hur: - raw_name: [rhum_cav, rhum_ave] - channel: Amon - hus: - raw_name: [qm1_cav, qm1_ave] + o3: + raw_name: [O3_cav, O3_ave, O3] channel: Amon ta: - raw_name: [tm1_cav, tm1_ave] - channel: Amon - day: - hur: # defined on plev8 - raw_name: [rhum_p8_cav, rhum_p8_ave] - channel: Amon - hus: # defined on plev8 - raw_name: [qm1_p8_cav, qm1_p8_ave] - channel: Amon - ua: # defined on plev8 - raw_name: [um1_p8_cav, um1_p8_ave] - channel: Amon - va: # defined on plev8 - raw_name: [vm1_p8_cav, vm1_p8_ave] + raw_name: [tm1_cav, tm1_ave, tm1] channel: Amon - zg: # defined on plev8 - raw_name: [geopot_p8_cav, geopot_p8_ave] - channel: Amon - E1hr: - ua: # defined on plev3 - raw_name: [um1_p3_cav, um1_p3_ave] - channel: Amon - va: # defined on plev3 - raw_name: [vm1_p3_cav, vm1_p3_ave] - channel: Amon - E3hrPt: - hus: - raw_name: [qm1_cav, qm1_ave] - channel: Amon - Eday: - ta: # defined on plev19 - raw_name: [tm1_p19_cav, tm1_p19_ave] - channel: Amon - hus: # defined on plev19 - raw_name: [qm1_p19_cav, qm1_p19_ave] - channel: Amon - ua: # defined on plev19 - raw_name: [um1_p19_cav, um1_p19_ave] - channel: Amon - va: # defined on plev19 - raw_name: [vm1_p19_cav, vm1_p19_ave] - channel: Amon - zg: # defined on plev19 - raw_name: [geopot_p19_cav, geopot_p19_ave] - channel: Amon - Esubhr: - ta: - raw_name: [tm1_cav, tm1_ave] + tro3: + raw_name: [O3_cav, O3_ave, O3] channel: Amon ua: - raw_name: [um1_cav, um1_ave] + raw_name: [um1_cav, um1_ave, um1] channel: Amon va: - raw_name: [vm1_cav, vm1_ave] + raw_name: [vm1_cav, vm1_ave, vm1] + channel: Amon + zg: + raw_name: [geopot_cav, geopot_ave, geopot] channel: Amon diff --git a/tests/integration/cmor/_fixes/emac/test_emac.py b/tests/integration/cmor/_fixes/emac/test_emac.py index 1146502a42..8376b865d4 100644 --- a/tests/integration/cmor/_fixes/emac/test_emac.py +++ b/tests/integration/cmor/_fixes/emac/test_emac.py @@ -538,7 +538,7 @@ def test_var_not_available_fix(): """Test fix.""" fix = get_allvars_fix('Amon', 'ta') cubes = CubeList([Cube(0.0)]) - msg = (r"No variable of \['tm1_p19_cav', 'tm1_p19_ave'\] necessary for " + msg = (r"No variable of \['tm1_cav', 'tm1_ave', 'tm1'\] necessary for " r"the extraction/derivation the CMOR variable 'ta' is available in " r"the input file.") with pytest.raises(ValueError, match=msg): @@ -577,7 +577,7 @@ def test_only_time(monkeypatch): units='days since 1850-01-01') cubes = CubeList([ Cube([1, 1], - var_name='tm1_p19_ave', + var_name='tm1_cav', units='K', dim_coords_and_dims=[(time_coord, 0)]), ]) @@ -622,7 +622,7 @@ def test_only_plev(monkeypatch): units='hPa') cubes = CubeList([ Cube([1, 1], - var_name='tm1_p19_ave', + var_name='tm1_ave', units='K', dim_coords_and_dims=[(plev_coord, 0)]), ]) @@ -667,7 +667,7 @@ def test_only_latitude(monkeypatch): units='degrees') cubes = CubeList([ Cube([1, 1], - var_name='tm1_p19_ave', + var_name='tm1', units='K', dim_coords_and_dims=[(lat_coord, 0)]), ]) @@ -712,7 +712,7 @@ def test_only_longitude(monkeypatch): units='degrees') cubes = CubeList([ Cube([1, 1], - var_name='tm1_p19_ave', + var_name='tm1', units='K', dim_coords_and_dims=[(lon_coord, 0)]), ]) @@ -2438,7 +2438,7 @@ def test_get_hur_fix(): def test_hur_fix(cubes_3d): """Test fix.""" - cubes_3d[0].var_name = 'rhum_p19_cav' + cubes_3d[0].var_name = 'rhum_cav' cubes_3d[0].units = '1' fix = get_allvars_fix('Amon', 'hur') fixed_cubes = fix.fix_metadata(cubes_3d) @@ -2465,7 +2465,7 @@ def test_get_hus_fix(): def test_hus_fix(cubes_3d): """Test fix.""" - cubes_3d[0].var_name = 'qm1_p19_cav' + cubes_3d[0].var_name = 'qm1_cav' cubes_3d[0].units = '1' fix = get_allvars_fix('Amon', 'hus') fixed_cubes = fix.fix_metadata(cubes_3d) @@ -2492,7 +2492,7 @@ def test_get_ta_fix(): def test_ta_fix(cubes_3d): """Test fix.""" - cubes_3d[0].var_name = 'tm1_p19_cav' + cubes_3d[0].var_name = 'tm1_cav' cubes_3d[0].units = 'K' fix = get_allvars_fix('Amon', 'ta') fixed_cubes = fix.fix_metadata(cubes_3d) @@ -2519,7 +2519,7 @@ def test_get_ua_fix(): def test_ua_fix(cubes_3d): """Test fix.""" - cubes_3d[0].var_name = 'um1_p19_cav' + cubes_3d[0].var_name = 'um1_cav' cubes_3d[0].units = 'm s-1' fix = get_allvars_fix('Amon', 'ua') fixed_cubes = fix.fix_metadata(cubes_3d) @@ -2546,7 +2546,7 @@ def test_get_va_fix(): def test_va_fix(cubes_3d): """Test fix.""" - cubes_3d[0].var_name = 'vm1_p19_cav' + cubes_3d[0].var_name = 'vm1_cav' cubes_3d[0].units = 'm s-1' fix = get_allvars_fix('Amon', 'va') fixed_cubes = fix.fix_metadata(cubes_3d) @@ -2573,7 +2573,7 @@ def test_get_zg_fix(): def test_zg_fix(cubes_3d): """Test fix.""" - cubes_3d[0].var_name = 'geopot_p19_cav' + cubes_3d[0].var_name = 'geopot_cav' cubes_3d[0].units = 'm2 s-2' fix = get_fix('Amon', 'zg') fixed_cubes = fix.fix_metadata(cubes_3d)