Skip to content

Commit

Permalink
add ocean depth fixes for gfdl_esm4 (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaslovato committed Apr 27, 2021
1 parent 178d567 commit 8a3cf94
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions esmvalcore/cmor/_fixes/cmip6/gfdl_esm4.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
"""Fixes for GFDL-ESM4 model."""
import iris
from iris.cube import CubeList
from ..fix import Fix
from ..shared import (add_scalar_depth_coord, set_ocean_depth_coord)

class Omon(Fix):
"""Fixes for ocean variables."""

def fix_metadata(self, cubes):
"""
Fix ocean depth coordinate.
Parameters
----------
cubes: iris CubeList
List of cubes to fix
Returns
-------
iris.cube.CubeList
"""
new_list = CubeList()
for cube in cubes:
if cube.coords(axis='Z'):
if not cube.coord(axis='Z').standard_name:
cube = set_ocean_depth_coord(cube)
new_list.append(cube)
return CubeList(new_list)

class Siconc(Fix):
"""Fixes for siconc."""
Expand Down Expand Up @@ -30,3 +56,24 @@ def fix_metadata(self, cubes):
for cube in cubes:
cube.add_aux_coord(typesi)
return cubes


class Fgco2(Fix):
"""Fixes for fgco2."""

def fix_metadata(self, cubes):
"""Add depth (0m) coordinate.
Parameters
----------
cubes : iris.cube.CubeList
Input cubes.
Returns
-------
iris.cube.CubeList
"""
cube = self.get_cube_from_list(cubes)
add_scalar_depth_coord(cube)
return cubes

0 comments on commit 8a3cf94

Please sign in to comment.