Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New function: cf.cell_overlaps #825

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidhassell
Copy link
Collaborator

Fixes #824

@davidhassell davidhassell added the enhancement New feature or request label Oct 30, 2024
@davidhassell davidhassell added this to the NEXT VERSION milestone Oct 30, 2024
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea for new methods, should be useful. Implementation and new testing and docs are otherwise all good but I have questioned the inconsistent underscore in the name and I have one general suggestion (plus spotted a few typos):

  • Since this new cell_overlaps, as well as cellwi and cellwo which are wi/wo queries applied to a cell, it would be nice to include the new-ish open_lower=False, open_upper=False keywords we added recently to the general wi/wo queries so they can be made open or half-open.
  • For the case of cell_overlaps the open-/closed-ness could do with being clarified a bit since it's a bit less direct/clear as to the role of interval openness. You state as with the other relevant methods 'The range is closed, meaning that is inclusive of its end points.' so I guess that means if the endpoint of the cell 'overlapped' with an endpoint of the range, then in the closed/inclusive default case it would be True, e.g. for cell [5, 10] and range [10, 15] it is deemed to overlap (True)? It would be good to add either a brief sentence or a new docstring example to clarify that.

Happy to approve once you'd considered those. Thanks.

@@ -328,6 +328,7 @@
cellgt,
cellle,
celllt,
cell_overlaps,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment, but the import listing here emphasises it: all of the other queries are named without underscores, where words are merged without delimiter e.g. gt, cellsize. cellgt and cellwi etc. So I advise for consistency we do the same here (obviously the name change here would need propagating as well as this GH suggestion):

Suggested change
cell_overlaps,
celloverlaps,

@@ -1581,7 +1581,7 @@ def eq(value, units=None, attr=None, exact=True):


def ne(value, units=None, attr=None, exact=True):
"""A `Query` object for a "not equal" condition.
"""A condition for "not equalto a value".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""A condition for "not equalto a value".
"""A condition for "not equal to a value".

def cell_overlaps(value0, value1, units=None):
"""A condition for "part of cell overlaps with a range".

The range is closed, meaning that is inclusive of its end points.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The range is closed, meaning that is inclusive of its end points.
The range is closed, meaning that it is inclusive of its end
points.

def cellwi(value0, value1, units=None):
"""A condition for "cell lies completely within a range".

The range is closed, meaning that is inclusive of its end points.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The range is closed, meaning that is inclusive of its end points.
The range is closed, meaning that it is inclusive of its end
points.

"""A `Query` object for a "cell bounds lie without range" condition.
"""A condition for "cell lies completely outside a range".

The range is closed, meaning that is inclusive of its end points.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The range is closed, meaning that is inclusive of its end points.
The range is closed, meaning that it is inclusive of its end
points.

@davidhassell davidhassell removed the enhancement New feature or request label Oct 31, 2024
@davidhassell davidhassell removed this from the NEXT VERSION milestone Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New function: cf.cell_overlaps
2 participants