diff --git a/esmvalcore/cmor/_fixes/nemo/gc3p1.py b/esmvalcore/cmor/_fixes/nemo/gc3p1.py new file mode 100644 index 0000000000..643b7d3492 --- /dev/null +++ b/esmvalcore/cmor/_fixes/nemo/gc3p1.py @@ -0,0 +1,21 @@ +"""Fixes for GC3.1 data""" + +from esmvalcore.cmor.fix import Fix +from iris.util import promote_aux_coord_to_dim_coord + + +class AllVars(Fix): + """""" + + def fix_metadata(self, cubes): + """""" + # Replace time_counter with time_centered/time_instant + for cube in cubes: + for coordinate in cube.coords(dim_coords=True): + if coordinate.var_name == 'time_counter': + cube.remove_coord(coordinate) + promote_aux_coord_to_dim_coord(cube, 'time') + cube.coord('time').var_name = 'time' + break + + return cubes diff --git a/esmvalcore/cmor/_fixes/nemo/gc5.py b/esmvalcore/cmor/_fixes/nemo/gc5.py new file mode 100644 index 0000000000..df770296b9 --- /dev/null +++ b/esmvalcore/cmor/_fixes/nemo/gc5.py @@ -0,0 +1,26 @@ +"""Fixes for GC5 data""" + +from esmvalcore.cmor.fix import Fix +from iris.util import promote_aux_coord_to_dim_coord + + +class AllVars(Fix): + """""" + + def fix_metadata(self, cubes): + """""" + # Correct variable name + for cube in cubes: + if cube.var_name.endswith('_con'): + cube.var_name = cube.var_name[:-4] + + for coordinate in cube.coords(dim_coords=True): + if coordinate.var_name == 'time_counter': + cube.remove_coord(coordinate) + promote_aux_coord_to_dim_coord(cube, 'time') + cube.coord('time').var_name = 'time' + break + + return cubes + +#check with emma about adding in the fix