Skip to content

No overlapping times detected in input cubes when plotting time series #1896

@jfrost-mo

Description

@jfrost-mo

Describe the bug

When plotting time series you can get the following error:

ValueError: No overlapping times detected in input cubes.

This comes from a check in collapse.py that we have overlapping times. While this check makes sense for a difference plot, it does not make sense for other kinds of plots, such as a time series, where it is quite reasonable to have non-overlapping times.

# Retain only common time points between different models if multiple model inputs.
if isinstance(cubes, iris.cube.CubeList) and len(cubes) > 1:
logging.debug(
"Extracting common time points as multiple model inputs detected."
)
for cube in cubes:
cube.coord("forecast_reference_time").bounds = None
cube.coord("forecast_period").bounds = None
cubes = cubes.extract_overlapping(
["forecast_reference_time", "forecast_period"]
)
if len(cubes) == 0:
raise ValueError("No overlapping times detected in input cubes.")

We should move this logic so it only applies in cases where we only want overlapping time points, such as the difference plots.

How to reproduce

Steps to reproduce the behaviour:

  1. Run CSET with two models over different dates.
  2. Try and plot a time series.
  3. Observe the error.

Expected behaviour

Time series plots should still work when we have non-overlapping data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions