From 8346574685b1b4a29fd1c96843701b700bda735e Mon Sep 17 00:00:00 2001 From: sloosvel Date: Thu, 29 Aug 2019 17:24:48 +0200 Subject: [PATCH 01/11] Add fixes for mpi_esm1_2 models --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py | 119 ++++++++++++++++++ esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 119 ++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py create mode 100644 esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py new file mode 100644 index 0000000000..660be1a743 --- /dev/null +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py @@ -0,0 +1,119 @@ +"""Fixes for MPI-ESM1-2-HR model""" + +from ..fix import Fix +from ..shared import add_scalar_height_coord + +class tas(Fix): + """ Fixes for tas """ + + def fix_metadata(self, cubes): + """ + Fix metadata. + + Adds missing height2m coordinate. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + add_scalar_height_coord(cube) + + return cubes + +class ta(Fix): + """ Fixes for ta """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes + +class va(Fix): + """ Fixes for va """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes + +class zg(Fix): + """ Fixes for zg """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes + +class ua(Fix): + """ Fixes for ua """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py new file mode 100644 index 0000000000..dcfb61f82f --- /dev/null +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -0,0 +1,119 @@ +"""Fixes for MPI-ESM1-2-XR model""" + +from ..fix import Fix +from ..shared import add_scalar_height_coord + +class tas(Fix): + """ Fixes for tas """ + + def fix_metadata(self, cubes): + """ + Fix metadata. + + Adds missing height2m coordinate. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + add_scalar_height_coord(cube) + + return cubes + +class ta(Fix): + """ Fixes for ta """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes + +class va(Fix): + """ Fixes for va """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes + +class zg(Fix): + """ Fixes for zg """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes + +class ua(Fix): + """ Fixes for ua """ + def fix_metadata(self, cubes): + """ + Fix metadata. + + Corrects plev coordinate var_name. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + plev = cube.coord('air_pressure') + plev.var_name = 'plev' + + return cubes From 3d57ad3e3e80f55dc5ba17040c786a3b806abeb3 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Fri, 20 Sep 2019 15:29:22 +0200 Subject: [PATCH 02/11] Add sfcwind fixes --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py | 24 +++++++++++++++++++ esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py index 660be1a743..259e92b59f 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py @@ -117,3 +117,27 @@ def fix_metadata(self, cubes): plev.var_name = 'plev' return cubes + +class sfcWind(Fix): + """ Fixes for sfcWind """ + + def fix_metadata(self, cubes): + """ + Fix metadata. + + Adds missing height2m coordinate. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + add_scalar_height_coord(cube, height=10.0) + + return cubes + \ No newline at end of file diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py index dcfb61f82f..30059eb079 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -117,3 +117,27 @@ def fix_metadata(self, cubes): plev.var_name = 'plev' return cubes + +class sfcWind(Fix): + """ Fixes for sfcWind """ + + def fix_metadata(self, cubes): + """ + Fix metadata. + + Adds missing height2m coordinate. + + Parameters + ---------- + cube: iris.cube.CubeList + + Returns + ------- + iris.cube.CubeList + + """ + for cube in cubes: + add_scalar_height_coord(cube, height=10.0) + + return cubes + \ No newline at end of file From 390356b9fb93a00bda9a9ab1f6fc0a8290bb3974 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Mon, 4 Nov 2019 09:38:37 +0100 Subject: [PATCH 03/11] Fix documentation --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py | 3 +-- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py index 259e92b59f..0aea02869e 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py @@ -125,7 +125,7 @@ def fix_metadata(self, cubes): """ Fix metadata. - Adds missing height2m coordinate. + Adds missing height10m coordinate. Parameters ---------- @@ -140,4 +140,3 @@ def fix_metadata(self, cubes): add_scalar_height_coord(cube, height=10.0) return cubes - \ No newline at end of file diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py index 30059eb079..52b0818c87 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -125,7 +125,7 @@ def fix_metadata(self, cubes): """ Fix metadata. - Adds missing height2m coordinate. + Adds missing height10m coordinate. Parameters ---------- @@ -140,4 +140,3 @@ def fix_metadata(self, cubes): add_scalar_height_coord(cube, height=10.0) return cubes - \ No newline at end of file From ac5a8e4d2cfe06b1a3d932b197b6354479a42590 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Mon, 4 Nov 2019 09:54:14 +0100 Subject: [PATCH 04/11] Fix lint issues --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py | 1 + esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 1 + 2 files changed, 2 insertions(+) diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py index 0aea02869e..b75c36b38e 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py @@ -3,6 +3,7 @@ from ..fix import Fix from ..shared import add_scalar_height_coord + class tas(Fix): """ Fixes for tas """ diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py index 52b0818c87..a5c6788ea5 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -3,6 +3,7 @@ from ..fix import Fix from ..shared import add_scalar_height_coord + class tas(Fix): """ Fixes for tas """ From ef08a1d677417d3acc462ab75b130a4bb4a35dc7 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Mon, 4 Nov 2019 10:25:38 +0100 Subject: [PATCH 05/11] Fix lint issues --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py | 35 ++++++++++++------- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 35 ++++++++++++------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py index b75c36b38e..b68252b650 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py @@ -1,11 +1,11 @@ -"""Fixes for MPI-ESM1-2-HR model""" +"""Fixes for MPI-ESM1-2-HR model.""" from ..fix import Fix from ..shared import add_scalar_height_coord -class tas(Fix): - """ Fixes for tas """ +class Tas(Fix): + """Fixes for tas.""" def fix_metadata(self, cubes): """ @@ -27,8 +27,10 @@ def fix_metadata(self, cubes): return cubes -class ta(Fix): - """ Fixes for ta """ + +class Ta(Fix): + """Fixes for ta.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -50,8 +52,10 @@ def fix_metadata(self, cubes): return cubes -class va(Fix): - """ Fixes for va """ + +class Va(Fix): + """Fixes for va.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -73,8 +77,10 @@ def fix_metadata(self, cubes): return cubes -class zg(Fix): - """ Fixes for zg """ + +class Zg(Fix): + """Fixes for zg.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -96,8 +102,10 @@ def fix_metadata(self, cubes): return cubes -class ua(Fix): - """ Fixes for ua """ + +class Ua(Fix): + """Fixes for ua.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -119,8 +127,9 @@ def fix_metadata(self, cubes): return cubes -class sfcWind(Fix): - """ Fixes for sfcWind """ + +class SfcWind(Fix): + """Fixes for sfcWind.""" def fix_metadata(self, cubes): """ diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py index a5c6788ea5..9054fe9cba 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -1,11 +1,11 @@ -"""Fixes for MPI-ESM1-2-XR model""" +"""Fixes for MPI-ESM1-2-XR model.""" from ..fix import Fix from ..shared import add_scalar_height_coord -class tas(Fix): - """ Fixes for tas """ +class Tas(Fix): + """Fixes for tas.""" def fix_metadata(self, cubes): """ @@ -27,8 +27,10 @@ def fix_metadata(self, cubes): return cubes -class ta(Fix): - """ Fixes for ta """ + +class Ta(Fix): + """Fixes for ta.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -50,8 +52,10 @@ def fix_metadata(self, cubes): return cubes -class va(Fix): - """ Fixes for va """ + +class Va(Fix): + """Fixes for va.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -73,8 +77,10 @@ def fix_metadata(self, cubes): return cubes -class zg(Fix): - """ Fixes for zg """ + +class Zg(Fix): + """Fixes for zg.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -96,8 +102,10 @@ def fix_metadata(self, cubes): return cubes -class ua(Fix): - """ Fixes for ua """ + +class Ua(Fix): + """Fixes for ua.""" + def fix_metadata(self, cubes): """ Fix metadata. @@ -119,8 +127,9 @@ def fix_metadata(self, cubes): return cubes -class sfcWind(Fix): - """ Fixes for sfcWind """ + +class SfcWind(Fix): + """Fixes for sfcWind.""" def fix_metadata(self, cubes): """ From 5fdd11270d64acffd879041284518e4b83891ce4 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Mon, 4 Nov 2019 17:40:44 +0100 Subject: [PATCH 06/11] Add models to config-developer file --- esmvalcore/config-developer.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esmvalcore/config-developer.yml b/esmvalcore/config-developer.yml index 4bbdf2ac79..f9f5d6b766 100644 --- a/esmvalcore/config-developer.yml +++ b/esmvalcore/config-developer.yml @@ -27,6 +27,9 @@ CMIP6: ETHZ: '{exp}/{mip}/{short_name}/{dataset}/{ensemble}/{grid}/' input_file: '{short_name}_{mip}_{dataset}_{exp}_{ensemble}_{grid}*.nc' output_file: '{project}_{dataset}_{mip}_{exp}_{ensemble}_{short_name}_{start_year}-{end_year}' + institutes: + 'CESM2-WACCM': ['NCAR'] + 'MPI-ESM1-2-XR': ['MPI-M'] cmor_type: 'CMIP6' CMIP5: From 22dbd78a2d0fe2d0eb312cd08086e03af9fb1d81 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Thu, 7 Nov 2019 15:40:28 +0100 Subject: [PATCH 07/11] Remove institute from config-developer --- esmvalcore/config-developer.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/esmvalcore/config-developer.yml b/esmvalcore/config-developer.yml index f9f5d6b766..5631ab875f 100644 --- a/esmvalcore/config-developer.yml +++ b/esmvalcore/config-developer.yml @@ -28,7 +28,6 @@ CMIP6: input_file: '{short_name}_{mip}_{dataset}_{exp}_{ensemble}_{grid}*.nc' output_file: '{project}_{dataset}_{mip}_{exp}_{ensemble}_{short_name}_{start_year}-{end_year}' institutes: - 'CESM2-WACCM': ['NCAR'] 'MPI-ESM1-2-XR': ['MPI-M'] cmor_type: 'CMIP6' From d687f6f1ce2bcadd67df46590a5b14f2cee0ab4f Mon Sep 17 00:00:00 2001 From: sloosvel Date: Thu, 7 Nov 2019 15:55:50 +0100 Subject: [PATCH 08/11] Remove other institute --- esmvalcore/config-developer.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/esmvalcore/config-developer.yml b/esmvalcore/config-developer.yml index 5631ab875f..4bbdf2ac79 100644 --- a/esmvalcore/config-developer.yml +++ b/esmvalcore/config-developer.yml @@ -27,8 +27,6 @@ CMIP6: ETHZ: '{exp}/{mip}/{short_name}/{dataset}/{ensemble}/{grid}/' input_file: '{short_name}_{mip}_{dataset}_{exp}_{ensemble}_{grid}*.nc' output_file: '{project}_{dataset}_{mip}_{exp}_{ensemble}_{short_name}_{start_year}-{end_year}' - institutes: - 'MPI-ESM1-2-XR': ['MPI-M'] cmor_type: 'CMIP6' CMIP5: From 2cf217b2f6ae8d852c6706fddbd0e11d86245db3 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Fri, 8 Nov 2019 15:32:45 +0100 Subject: [PATCH 09/11] Fix style issues --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py | 75 +-------- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 142 ++---------------- 2 files changed, 12 insertions(+), 205 deletions(-) diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py index b68252b650..21648fc1dc 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_hr.py @@ -9,8 +9,6 @@ class Tas(Fix): def fix_metadata(self, cubes): """ - Fix metadata. - Adds missing height2m coordinate. Parameters @@ -33,8 +31,6 @@ class Ta(Fix): def fix_metadata(self, cubes): """ - Fix metadata. - Corrects plev coordinate var_name. Parameters @@ -53,88 +49,23 @@ def fix_metadata(self, cubes): return cubes -class Va(Fix): +class Va(Ta): """Fixes for va.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - -class Zg(Fix): +class Zg(Ta): """Fixes for zg.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - - -class Ua(Fix): +class Ua(Ta): """Fixes for ua.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - class SfcWind(Fix): """Fixes for sfcWind.""" def fix_metadata(self, cubes): """ - Fix metadata. - Adds missing height10m coordinate. Parameters diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py index 9054fe9cba..37f4185817 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -1,152 +1,28 @@ """Fixes for MPI-ESM1-2-XR model.""" -from ..fix import Fix -from ..shared import add_scalar_height_coord +from .mpi_esm1_2_hr import Tas as BaseTas +from .mpi_esm1_2_hr import Ta as BaseTa +from .mpi_esm1_2_hr import SfcWind as BaseSfcWind -class Tas(Fix): +class Tas(BaseTas): """Fixes for tas.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - Adds missing height2m coordinate. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - add_scalar_height_coord(cube) - - return cubes - - -class Ta(Fix): +class Ta(BaseTa): """Fixes for ta.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - - -class Va(Fix): +class Va(BaseTa): """Fixes for va.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - -class Zg(Fix): +class Zg(BaseTa): """Fixes for zg.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - - -class Ua(Fix): +class Ua(BaseTa): """Fixes for ua.""" - def fix_metadata(self, cubes): - """ - Fix metadata. - - Corrects plev coordinate var_name. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - """ - for cube in cubes: - plev = cube.coord('air_pressure') - plev.var_name = 'plev' - - return cubes - - -class SfcWind(Fix): +class SfcWind(BaseSfcWind): """Fixes for sfcWind.""" - - def fix_metadata(self, cubes): - """ - Fix metadata. - - Adds missing height10m coordinate. - - Parameters - ---------- - cube: iris.cube.CubeList - - Returns - ------- - iris.cube.CubeList - - """ - for cube in cubes: - add_scalar_height_coord(cube, height=10.0) - - return cubes From ccb53662004c0e4f77d3080f936e222d0441f46c Mon Sep 17 00:00:00 2001 From: sloosvel Date: Fri, 8 Nov 2019 15:40:17 +0100 Subject: [PATCH 10/11] Fix lint issue --- esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py index 37f4185817..c3ae86a6a6 100644 --- a/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py +++ b/esmvalcore/cmor/_fixes/cmip6/mpi_esm1_2_xr.py @@ -1,7 +1,7 @@ """Fixes for MPI-ESM1-2-XR model.""" from .mpi_esm1_2_hr import Tas as BaseTas -from .mpi_esm1_2_hr import Ta as BaseTa +from .mpi_esm1_2_hr import Ta as BaseFix from .mpi_esm1_2_hr import SfcWind as BaseSfcWind @@ -9,18 +9,19 @@ class Tas(BaseTas): """Fixes for tas.""" -class Ta(BaseTa): +class Ta(BaseFix): """Fixes for ta.""" -class Va(BaseTa): + +class Va(BaseFix): """Fixes for va.""" -class Zg(BaseTa): +class Zg(BaseFix): """Fixes for zg.""" -class Ua(BaseTa): +class Ua(BaseFix): """Fixes for ua.""" From 44c00435574de92c98a24722ebd3fd56fe41e447 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Tue, 19 Nov 2019 17:26:11 +0100 Subject: [PATCH 11/11] Check if coordinate exists --- esmvalcore/cmor/_fixes/shared.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/esmvalcore/cmor/_fixes/shared.py b/esmvalcore/cmor/_fixes/shared.py index 5acb7a1ffc..ea7482cf3a 100644 --- a/esmvalcore/cmor/_fixes/shared.py +++ b/esmvalcore/cmor/_fixes/shared.py @@ -17,7 +17,10 @@ def add_scalar_depth_coord(cube, depth=0.0): long_name='depth', units=Unit('m'), attributes={'positive': 'down'}) - cube.add_aux_coord(depth_coord, ()) + try: + cube.coord('depth') + except iris.exceptions.CoordinateNotFoundError: + cube.add_aux_coord(depth_coord, ()) return cube @@ -30,7 +33,10 @@ def add_scalar_height_coord(cube, height=2.0): long_name='height', units=Unit('m'), attributes={'positive': 'up'}) - cube.add_aux_coord(height_coord, ()) + try: + cube.coord('height') + except iris.exceptions.CoordinateNotFoundError: + cube.add_aux_coord(height_coord, ()) return cube @@ -42,7 +48,10 @@ def add_scalar_typeland_coord(cube, value='default'): standard_name='area_type', long_name='Land area type', units=Unit('no unit')) - cube.add_aux_coord(typeland_coord, ()) + try: + cube.coord('area_type') + except iris.exceptions.CoordinateNotFoundError: + cube.add_aux_coord(typeland_coord, ()) return cube @@ -54,7 +63,10 @@ def add_scalar_typesea_coord(cube, value='default'): standard_name='area_type', long_name='Ocean area type', units=Unit('no unit')) - cube.add_aux_coord(typesea_coord, ()) + try: + cube.coord('area_type') + except iris.exceptions.CoordinateNotFoundError: + cube.add_aux_coord(typesea_coord, ()) return cube