Create an `ApproxConstraint` class

Open
#5,673 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Start by locating the existing Constraint implementation and its tests, then review the linked discussion for the proposed ApproxConstraint API. Compare the slower range-based approach with the floating-point representation approach and clarify the intended behavior before defining what completion and test coverage should require.

Written by the indexing model from the issue text.

Description

Experience: High

Would solve the problem with floating points.

Could also consider a tolerance argument for Constraint, but there could be clashes with actual variable names.

Team have discussed an alternative API something like ApproxConstraint, which explicitly handles the floating point cases.

  • Slower, easier version: convert the Constraint into a range function Constraint
  • Faster, trickier version: work out what the actual floating point representation of the provided number should be, accounting for the type of the coordinate in question, then use that value in the Constraint instead.

Originally posted by @trexfeathers in https://github.com/SciTools/iris/discussions/4744#discussioncomment-2774618

Dominant language
Python
Stars
724
Forks
317
Avg merge
3d 20h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SciTools/iris

All issues in SciTools/iris

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.