Skip to content

Commit

Permalink
Add test to verify behaviour for scalar height coord for tas in multi…
Browse files Browse the repository at this point in the history
…-model (#1209)

* Implement a test to establish desired behaviour

* test on 3 cubes
  • Loading branch information
Peter9192 authored Jul 13, 2021
1 parent 197a9a1 commit 4d82ff3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/preprocessor/_multimodel/test_multimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,26 @@ def test_return_products():
assert result4 == result2


def test_ignore_tas_scalar_height_coord():
"""Ignore conflicting aux_coords for height in tas."""
tas_2m = generate_cube_from_dates("monthly")
tas_1p5m = generate_cube_from_dates("monthly")

for cube, height in zip([tas_2m, tas_1p5m], [2., 1.5]):
cube.rename("air_temperature")
cube.attributes["short_name"] = "tas"
cube.add_aux_coord(
iris.coords.AuxCoord([height], var_name="height", units="m"))

result = mm.multi_model_statistics([tas_2m, tas_2m.copy(), tas_1p5m],
statistics=['mean'],
span='full')

# iris automatically averages the value of the scalar coordinate.
assert len(result['mean'].coords("height")) == 1
assert result["mean"].coord("height").points == 1.75


def test_daily_inconsistent_calendars():
"""Determine behaviour for inconsistent calendars.
Expand Down

0 comments on commit 4d82ff3

Please sign in to comment.