Skip to content

Set numerical tolerance when doing comparisons with cf.Query objects #174

@davidhassell

Description

@davidhassell

Currently, the numerical queries cf.le, cf.ge and cf.wi are susceptible to rounding issues, as the inequality operators can not be modified by the settings of rtol and atol.

This could be changed by replacing the operations with a strict inequality operation and a numerically tolerant equality operation:

E.g.

cf.le(5) = 5.00000000000001

would effectively be implemented as

5 < 5.00000000000001 | numpy.allclose(5, 5.00000000000001, rtol=rtol, atol=atol)

This would help greatly when using cf.Query in, for example, subspace definitions.

API: the functions should have rtol and atol keyword parameters. (cf.wi(3, 4, rtol=45, atol=0.0002))

Possible issue: Under this scheme, cf.wo would not be the exact inverse of cf.wi

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions