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

dask: Data query interface #368

Merged
merged 3 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions cf/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4218,25 +4218,6 @@ def _binary_operation(self, other, method):

return self

def __query_set__(self, values):
"""Implements the “member of set” condition."""
i = iter(values)
v = next(i)

out = self == v
for v in i:
out |= self == v

return out

def __query_wi__(self, value):
"""Implements the “within a range” condition."""
return (self >= value[0]) & (self <= value[1])

def __query_wo__(self, value):
"""TODO."""
return (self < value[0]) | (self > value[1])

def _parse_indices(self, *args, **kwargs):
"""'cf.Data._parse_indices' is not available.

Expand Down
34 changes: 0 additions & 34 deletions cf/mixin/propertiesdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,40 +820,6 @@ def _equivalent_data(self, other, atol=None, rtol=None, verbose=None):
#
# return matches

def __query_set__(self, values):
"""Implements the “member of set” condition."""
new = self.copy()
new.set_data(self.data.__query_set__(values), copy=False)
return new

# def _query_contain(self, value):
# '''TODO#
#
# '''
# new = self.copy()
# new.set_data(self.data._query_contain(value), copy=False)
# return new

# def _query_contains(self, value):
# '''TODO
#
# '''
# new = self.copy()
# new.set_data(self.data._query_contains(value), copy=False)
# return new

def __query_wi__(self, value):
"""Implements the “within a range” condition."""
new = self.copy()
new.set_data(self.data.__query_wi__(value), copy=False)
return new

def __query_wo__(self, value):
"""Implements the “without a range” condition."""
new = self.copy()
new.set_data(self.data.__query_wo__(value), copy=False)
return new

def _unary_operation(self, method):
"""Implement unary arithmetic operations on the data array.

Expand Down
7 changes: 0 additions & 7 deletions cf/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,6 @@ def _evaluate(self, x, parent_attr):

return (x < value[0]) | (x > value[1])

# if operator == 'contains':
# _contain = getattr(x, '__query_contains__', None)
# if _contain is not None:
# return _contain(value)
# else:
# return x == value

if operator == "set":
if isinstance(x, str):
for v in value:
Expand Down