-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cordex wrf381p: fix tas,tasmax,tasmin height (#2333)
Co-authored-by: sloosvel <[email protected]> Co-authored-by: sloosvel <[email protected]> Co-authored-by: Manuel Schlund <[email protected]>
- Loading branch information
1 parent
907a8a2
commit 3a0b49f
Showing
11 changed files
with
345 additions
and
2 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
esmvalcore/cmor/_fixes/cordex/cnrm_cerfacs_cnrm_cm5/wrf381p.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Fixes for rcm WRF381P driven by CNRM-CERFACS-CNRM-CM5.""" | ||
from esmvalcore.cmor._fixes.shared import add_scalar_height_coord | ||
from esmvalcore.cmor.fix import Fix | ||
|
||
|
||
class Tas(Fix): | ||
"""Fixes for tas.""" | ||
|
||
def fix_metadata(self, cubes): | ||
"""Add height (2m) coordinate and correct long_name for time. | ||
Parameters | ||
---------- | ||
cubes : iris.cube.CubeList | ||
Input cubes. | ||
Returns | ||
------- | ||
iris.cube.CubeList | ||
""" | ||
cube = self.get_cube_from_list(cubes) | ||
add_scalar_height_coord(cube) | ||
|
||
return cubes | ||
|
||
|
||
Tasmin = Tas | ||
|
||
|
||
Tasmax = Tas | ||
|
||
|
||
Hurs = Tas | ||
|
||
|
||
Huss = Tas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Fixes for rcm WRF381P driven by ICHEC-EC-EARTH.""" | ||
from esmvalcore.cmor._fixes.shared import add_scalar_height_coord | ||
from esmvalcore.cmor.fix import Fix | ||
|
||
|
||
class Tas(Fix): | ||
"""Fixes for tas.""" | ||
|
||
def fix_metadata(self, cubes): | ||
"""Add height (2m) coordinate and correct long_name for time. | ||
Parameters | ||
---------- | ||
cubes : iris.cube.CubeList | ||
Input cubes. | ||
Returns | ||
------- | ||
iris.cube.CubeList | ||
""" | ||
cube = self.get_cube_from_list(cubes) | ||
add_scalar_height_coord(cube) | ||
|
||
return cubes | ||
|
||
|
||
Tasmin = Tas | ||
|
||
|
||
Tasmax = Tas | ||
|
||
|
||
Hurs = Tas | ||
|
||
|
||
Huss = Tas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Fixes for CORDEX data.""" |
36 changes: 36 additions & 0 deletions
36
esmvalcore/cmor/_fixes/cordex/ipsl_ipsl_cm5a_mr/wrf381p.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Fixes for rcm WRF381P driven by IPSL-IPSL-CM5A-MR.""" | ||
from esmvalcore.cmor._fixes.shared import add_scalar_height_coord | ||
from esmvalcore.cmor.fix import Fix | ||
|
||
|
||
class Tas(Fix): | ||
"""Fixes for tas.""" | ||
|
||
def fix_metadata(self, cubes): | ||
"""Add height (2m) coordinate and correct long_name for time. | ||
Parameters | ||
---------- | ||
cubes : iris.cube.CubeList | ||
Input cubes. | ||
Returns | ||
------- | ||
iris.cube.CubeList | ||
""" | ||
cube = self.get_cube_from_list(cubes) | ||
add_scalar_height_coord(cube) | ||
|
||
return cubes | ||
|
||
|
||
Tasmin = Tas | ||
|
||
|
||
Tasmax = Tas | ||
|
||
|
||
Hurs = Tas | ||
|
||
|
||
Huss = Tas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Fixes for rcm WRF381P driven by MOHC-HadGEM2-ES.""" | ||
from esmvalcore.cmor._fixes.shared import add_scalar_height_coord | ||
from esmvalcore.cmor.fix import Fix | ||
|
||
|
||
class Tas(Fix): | ||
"""Fixes for tas.""" | ||
|
||
def fix_metadata(self, cubes): | ||
"""Add height (2m) coordinate and correct long_name for time. | ||
Parameters | ||
---------- | ||
cubes : iris.cube.CubeList | ||
Input cubes. | ||
Returns | ||
------- | ||
iris.cube.CubeList | ||
""" | ||
cube = self.get_cube_from_list(cubes) | ||
add_scalar_height_coord(cube) | ||
|
||
return cubes | ||
|
||
|
||
Tasmin = Tas | ||
|
||
|
||
Tasmax = Tas | ||
|
||
|
||
Hurs = Tas | ||
|
||
|
||
Huss = Tas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Fixes for rcm WRF381P driven by NCC-NorESM1-M.""" | ||
from esmvalcore.cmor._fixes.shared import add_scalar_height_coord | ||
from esmvalcore.cmor.fix import Fix | ||
|
||
|
||
class Tas(Fix): | ||
"""Fixes for tas.""" | ||
|
||
def fix_metadata(self, cubes): | ||
"""Add height (2m) coordinate and correct long_name for time. | ||
Parameters | ||
---------- | ||
cubes : iris.cube.CubeList | ||
Input cubes. | ||
Returns | ||
------- | ||
iris.cube.CubeList | ||
""" | ||
cube = self.get_cube_from_list(cubes) | ||
add_scalar_height_coord(cube) | ||
|
||
return cubes | ||
|
||
|
||
Tasmin = Tas | ||
|
||
|
||
Tasmax = Tas | ||
|
||
|
||
Hurs = Tas | ||
|
||
|
||
Huss = Tas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/integration/cmor/_fixes/cordex/test_ipsl_ipsl_cm5a_mr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Tests for the fixes of driver IPSL-CM5A-MR.""" | ||
import iris | ||
import pytest | ||
|
||
from esmvalcore.cmor._fixes.cordex.ipsl_ipsl_cm5a_mr import wrf381p | ||
from esmvalcore.cmor.fix import Fix | ||
from esmvalcore.cmor.table import get_var_info | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'short_name', | ||
['tasmax', 'tasmin', 'tas', 'hurs', 'huss']) | ||
def test_get_wrf381p_fix(short_name): | ||
fix = Fix.get_fixes( | ||
'CORDEX', | ||
'WRF381P', | ||
'Amon', | ||
short_name, | ||
extra_facets={'driver': 'IPSL-CM5A-MR'}) | ||
assert isinstance(fix[0], Fix) | ||
|
||
|
||
def test_wrf381p_height_fix(): | ||
time_coord = iris.coords.DimCoord([0.0], | ||
var_name='time', | ||
standard_name='time', | ||
long_name='time') | ||
cube = iris.cube.Cube( | ||
[10.0], | ||
var_name='tas', | ||
dim_coords_and_dims=[(time_coord, 0)], | ||
) | ||
vardef = get_var_info('CMIP6', 'Amon', 'tas') | ||
fix = wrf381p.Tas(vardef) | ||
out_cubes = fix.fix_metadata([cube]) | ||
assert out_cubes[0].coord('height').points == 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.