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

reconstructedField broken because of reliance on now non-existent collections.Iterable #139

Closed
rebeccaherman1 opened this issue Aug 11, 2023 · 2 comments

Comments

@rebeccaherman1
Copy link

when I try to run solver.reconstructedField(1), I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[221], line 1
----> 1 solver.reconstructedField(1)

File /home/b/b382109/miniconda3/envs/rebecca/lib/python3.10/site-packages/eofs/iris.py:574, in Eof.reconstructedField(self, neofs)
    539 def reconstructedField(self, neofs):
    540     """Reconstructed data field based on a subset of EOFs.
    541 
    542     If weights were passed to the `Eof` instance the returned
   (...)
    572 
    573     """
--> 574     rfield = self._solver.reconstructedField(neofs)
    575     coords = [copy(self._time)] + [copy(coord) for coord in self._coords]
    576     if isinstance(neofs, collections.Iterable):

File /home/b/b382109/miniconda3/envs/rebecca/lib/python3.10/site-packages/eofs/standard.py:638, in Eof.reconstructedField(self, neofs)
    603 """Reconstructed data field based on a subset of EOFs.
    604 
    605 If weights were passed to the `Eof` instance the returned
   (...)
    635 
    636 """
    637 # Determine how the PCs and EOFs will be selected.
--> 638 if isinstance(neofs, collections.Iterable):
    639     modes = [m - 1 for m in neofs]
    640 else:

AttributeError: module 'collections' has no attribute 'Iterable'

Perhaps an 'Iterable' is now called a 'Counter'? Could this be updated?

@bbuzz31
Copy link

bbuzz31 commented Aug 14, 2023

just change collections.Iterable to collections.abc.Iterable. And see #131

@ajdawson
Copy link
Owner

I believe this is fixed in 1.4.1

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