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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potentially unused code in iris.coord #4956

Closed
bouweandela opened this issue Sep 9, 2022 · 5 comments
Closed

Potentially unused code in iris.coord #4956

bouweandela opened this issue Sep 9, 2022 · 5 comments

Comments

@bouweandela
Copy link
Member

馃摪 Custom Issue

It looks like this class is not to be used anywhere and it not part of the public interface. Maybe it could be removed?

iris/lib/iris/coords.py

Lines 3156 to 3176 in ae2b59b

# See ExplicitCoord._group() for the description/context.
class _GroupIterator(Iterator):
def __init__(self, points):
self._points = points
self._start = 0
def __next__(self):
num_points = len(self._points)
if self._start >= num_points:
raise StopIteration
stop = self._start + 1
m = self._points[self._start]
while stop < num_points and self._points[stop] == m:
stop += 1
group = _GroupbyItem(m, slice(self._start, stop))
self._start = stop
return group
next = __next__

@pp-mo
Copy link
Member

pp-mo commented Sep 12, 2022

@bouweandela actually, I think it is used,
here :

https://github.com/SciTools/iris/blob/main/lib/iris/analysis/__init__.py#L2344-L2346

Did you just miss that, or do you think there is an opportunity to simplify this ?

@bouweandela
Copy link
Member Author

Did you just miss that

Yes! I must have been sleeping 馃槾

do you think there is an opportunity to simplify this ?

Yes, this looks like itertools.groupby. Is that what you had in mind?

@pp-mo pp-mo self-assigned this Sep 28, 2022
@bjlittle
Copy link
Member

bjlittle commented Oct 5, 2022

@bouweandela Is this something that you wanted to take on? 馃

@bouweandela
Copy link
Member Author

Yes, I can have a look.

@bouweandela
Copy link
Member Author

I think this was done in #5015.

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

No branches or pull requests

3 participants