Skip to content

Commit

Permalink
Merge pull request #267 from ESMValGroup/development_multi_model_stat…
Browse files Browse the repository at this point in the history
…istics_bugfix

Development multi model statistics bugfix
  • Loading branch information
mattiarighi authored Sep 24, 2019
2 parents c754a4e + c249797 commit cd7b998
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions esmvalcore/preprocessor/_multimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,17 @@ def _put_in_cube(template_cube, cube_data, statistic, t_axis):
t_axis,
standard_name='time',
units=template_cube.coord('time').units)
lats = template_cube.coord('latitude')
lons = template_cube.coord('longitude')

coord_names = [c.long_name for c in template_cube.coords()]
coord_names.extend([c.standard_name for c in template_cube.coords()])
if 'latitude' in coord_names:
lats = template_cube.coord('latitude')
else:
lats = None
if 'longitude' in coord_names:
lons = template_cube.coord('longitude')
else:
lons = None

# no plevs
if len(template_cube.shape) == 3:
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/preprocessor/_multimodel/test_multimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ def setUp(self):
attributes={'positive': 'down'})
lons = iris.coords.DimCoord([1.5, 2.5],
standard_name='longitude',
long_name='longitude',
bounds=[[1., 2.], [2., 3.]],
units='degrees_east',
coord_system=coord_sys)
lats = iris.coords.DimCoord([1.5, 2.5],
standard_name='latitude',
long_name='latitude',
bounds=[[1., 2.], [2., 3.]],
units='degrees_north',
coord_system=coord_sys)
Expand Down

0 comments on commit cd7b998

Please sign in to comment.