Skip to content

Commit

Permalink
Several minor fixes needed for marine BGC data. (#2110)
Browse files Browse the repository at this point in the history
Co-authored-by: Valeriu Predoi <[email protected]>
  • Loading branch information
ledm and valeriupredoi authored May 2, 2024
1 parent 9912921 commit 31be51b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
3 changes: 3 additions & 0 deletions esmvalcore/cmor/_fixes/cmip6/bcc_esm1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
Sos = OceanFixGrid


So = OceanFixGrid


Siconc = OceanFixGrid
14 changes: 12 additions & 2 deletions esmvalcore/cmor/_fixes/cmip6/gfdl_cm4.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
"""Fixes for GFDL-CM4 model."""
import iris

from ..common import ClFixHybridPressureCoord, SiconcFixScalarCoord
from ..common import (
ClFixHybridPressureCoord,
OceanFixGrid,
SiconcFixScalarCoord,
)
from ..fix import Fix
from ..shared import add_aux_coords_from_cubes, add_scalar_height_coord
from .gfdl_esm4 import Omon as BaseOmon
from .gfdl_esm4 import Fgco2 as BaseFgco2
from .gfdl_esm4 import Omon as BaseOmon


class Cl(ClFixHybridPressureCoord):
Expand Down Expand Up @@ -110,6 +114,12 @@ class SfcWind(Uas):
"""Fixes for sfcWind."""


Tos = OceanFixGrid


Sos = OceanFixGrid


Omon = BaseOmon


Expand Down
4 changes: 3 additions & 1 deletion esmvalcore/cmor/_fixes/cmip6/gfdl_esm4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Fixes for GFDL-ESM4 model."""
from ..common import SiconcFixScalarCoord
from ..common import SiconcFixScalarCoord, OceanFixGrid
from ..fix import Fix
from ..shared import (
add_scalar_depth_coord,
Expand Down Expand Up @@ -52,6 +52,8 @@ def fix_metadata(self, cubes):
return cubes


Ofx = OceanFixGrid

Oyr = Omon


Expand Down
12 changes: 12 additions & 0 deletions tests/integration/cmor/_fixes/cmip6/test_bcc_esm1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Cli,
Clw,
Siconc,
So,
Sos,
Tos,
)
Expand Down Expand Up @@ -58,6 +59,17 @@ def test_siconc_fix():
assert Siconc is OceanFixGrid


def test_get_so_fix():
"""Test getting of fix."""
fix = Fix.get_fixes('CMIP6', 'BCC-ESM1', 'Omon', 'so')
assert fix == [So(None), GenericFix(None)]


def test_so_fix():
"""Test fix for ``so``."""
assert So is OceanFixGrid


def test_get_sos_fix():
"""Test getting of fix."""
fix = Fix.get_fixes('CMIP6', 'BCC-ESM1', 'Omon', 'sos')
Expand Down
26 changes: 25 additions & 1 deletion tests/integration/cmor/_fixes/cmip6/test_gfdl_cm4.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
Fgco2,
Omon,
Siconc,
Sos,
Tas,
Tos,
Uas,
)
from esmvalcore.cmor._fixes.common import SiconcFixScalarCoord
from esmvalcore.cmor._fixes.common import SiconcFixScalarCoord, OceanFixGrid
from esmvalcore.cmor._fixes.fix import GenericFix
from esmvalcore.cmor.fix import Fix
from esmvalcore.cmor.table import get_var_info
Expand Down Expand Up @@ -121,6 +123,28 @@ def test_siconc_fix():
assert Siconc is SiconcFixScalarCoord


def test_get_sos_fix():
"""Test getting of fix."""
fix = Fix.get_fixes('CMIP6', 'GFDL-CM4', 'Omon', 'sos')
assert fix == [Sos(None), Omon(None), GenericFix(None)]


def test_sos_fix():
"""Test fix for ``sos``."""
assert Sos is OceanFixGrid


def test_get_tos_fix():
"""Test getting of fix."""
fix = Fix.get_fixes('CMIP6', 'GFDL-CM4', 'Omon', 'tos')
assert fix == [Tos(None), Omon(None), GenericFix(None)]


def test_tos_fix():
"""Test fix for ``tos``."""
assert Tos is OceanFixGrid


@pytest.fixture
def tas_cubes():
correct_lat_coord = iris.coords.DimCoord([0.0],
Expand Down

0 comments on commit 31be51b

Please sign in to comment.