-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 ascellwi
andcellwo
which arewi
/wo
queries applied to a cell, it would be nice to include the new-ishopen_lower=False, open_upper=False
keywords we added recently to the generalwi
/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 beTrue
, 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, |
There was a problem hiding this comment.
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):
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". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Fixes #824