Skip to content

cf.Field.match_by_construct always returns True for 1-d constructs whose axis is not in the data  #691

@davidhassell

Description

@davidhassell

At v3.15.3, cf.Field.match_by_construct always returns True when matching against a size 1 construct that whose domain axis is not spanned by the field's data array, regardless of the condition:

>>> import cf
>>> f = cf.example_field(0)
>>> print(f)
Field: specific_humidity (ncvar%q)
----------------------------------
Data            : specific_humidity(latitude(5), longitude(8)) 1
Cell methods    : area: mean
Dimension coords: latitude(5) = [-75.0, ..., 75.0] degrees_north
                : longitude(8) = [22.5, ..., 337.5] degrees_east
                : time(1) = [2019-01-01 00:00:00]

>>> f.match_by_construct(time=cf.dt('2019-01-01'))
True
>>> f.match_by_construct(time=cf.dt('1959-12-16'))
True

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions