Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions esmvalcore/cmor/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,51 +385,54 @@ def _check_dim_names(self):
self._does_msg, coordinate.name, 'exist')

def _check_generic_level_dim_names(self, key, coordinate):
standard_name = None
out_name = None
name = None
if coordinate.generic_lev_coords:
for coord in coordinate.generic_lev_coords.values():
try:
cube_coord = self._cube.coord(
var_name=coord.out_name
)
coordinate.out_name = coord.out_name
out_name = coord.out_name
if cube_coord.standard_name == coord.standard_name:
coordinate.standard_name = coord.standard_name
coordinate.name = coord.name
standard_name = coord.standard_name
name = coord.name
except iris.exceptions.CoordinateNotFoundError:
try:
cube_coord = self._cube.coord(
var_name=coord.standard_name
)
coordinate.standard_name = coord.standard_name
coordinate.name = coord.name
standard_name = coord.standard_name
name = coord.name
except iris.exceptions.CoordinateNotFoundError:
pass
if coordinate.standard_name:
if not coordinate.out_name:
if standard_name:
if not out_name:
self.report_error(
f'Coordinate {coordinate.name} '
f'Generic level coordinate {key} '
'has wrong var_name.',
)
level = coordinate.generic_lev_coords[coordinate.name]
level = coordinate.generic_lev_coords[name]
level.generic_level = True
level.generic_lev_coords = self._cmor_var.coordinates[
key].generic_lev_coords
self._cmor_var.coordinates[key] = level
self.report_debug_message(
f'Generic level coordinate {key} '
'will be checked against '
f'{coordinate.name} coordinate information'
f'{name} coordinate information'
)
else:
if coordinate.out_name:
if out_name:
self.report_critical(
f'Coordinate {coordinate.name} '
f'Generic level coordinate {key} '
'has wrong standard_name '
'or is not set.',
)
else:
self.report_critical(
self._does_msg, coordinate.name, 'exist'
self._does_msg, key, 'exist'
)

def _check_coords(self):
Expand Down