NCAS-CMS / NCAS-CMS/cf-python

Extend `Data.__contains__` to evaluate subarray presence

Open
#349 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

dask enhancement low priority
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Presently Data.__contains__ only tests whether scalars are contained within a given data array, but the method could be extended to become more general, namely to check for the membership of sub-arrays, with agreed behaviour for selected cases. Assuming, and when, Python array standards such as numpy support this, we agreed to re-consider the scope of __contains__ in this manner.

See https://github.com/NCAS-CMS/cf-python/pull/320#discussion_r806373432 for context and brief discussion.

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.

Research direction

Start by locating Data.contains and read the linked pull request discussion for the proposed scope. Compare the agreed behavior with the relevant Python and NumPy array-membership standards; done means the selected subarray cases are supported consistently.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.