Skip to content

Don't guess time bounds for instantaneous fields #2101

@ScottWales

Description

Describe the bug

When CSET loads a field it guesses bounds for all coordinates. This is not appropriate for instantaneous fields, and causes errors in the time values when loading the data with METplus where the times loaded from forecast data is in the middle of the correct instantaneous lead times.

How to reproduce

Steps to reproduce the behaviour:

Loading a file with air_temperature instantaneous, min, mean and max values with iris gives bounds only on the fields with cell_methods:

>>> iris_cubes = iris.load(path, "air_temperature")
>>> for c in iris_cubes:
...     print([str(m) for m in c.cell_methods], c.coord('time').bounds)
...
[] None
['time: minimum (interval: 1 hour)'] [[493032. 493033.]...[493041. 493042.]]
['time: mean (interval: 1 hour)'] [[493032. 493033.]...[493041. 493042.]]
['time: maximum (interval: 1 hour)'] [[493032. 493033.]...[493041. 493042.]]

Loading the same file with CSET gives bounds on everything, including the instantaneous field where they aren't appropriate:

>>> cset_cubes = CSET.operators.read.read_cubes(path, "air_temperature")
>>> for c in cset_cubes:
...     print([str(m) for m in c.cell_methods], c.coord('time').bounds)
...
[] [[493032.5 493033.5]...[493041.5 493042.5]]
['time: minimum (interval: 1 hour)'] [[493032. 493033.]...[493041. 493042.]]
['time: mean (interval: 1 hour)'] [[493032. 493033.]...[493041. 493042.]]
['time: maximum (interval: 1 hour)'] [[493032. 493033.]...[493041. 493042.]]

Expected behaviour

Fields without a time axis cell_method do not have bounds on the time axis

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmetplus

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions