Skip to content

Commit

Permalink
Bound DimCoords on cube load
Browse files Browse the repository at this point in the history
This is done after merging and concatenating as otherwise it prevents
merging of scalar values with non-scalar dimensions.
  • Loading branch information
jfrost-mo committed Aug 15, 2024
1 parent 732dfd9 commit c8bcc31
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/CSET/operators/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ def read_cubes(
cubes = cubes.merge()
cubes = cubes.concatenate()

# Ensure dimension coordinates are bounded.
for cube in cubes:
for dim_coord in cube.coords(dim_coords=True):
# Iris can't guess the bounds of a scalar coordinate.
if not dim_coord.has_bounds() and dim_coord.shape[0] > 1:
dim_coord.guess_bounds()

logging.debug("Loaded cubes: %s", cubes)
if len(cubes) == 0:
warnings.warn(
Expand Down

0 comments on commit c8bcc31

Please sign in to comment.