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

Import error #2

Open
anoukvlug opened this issue Jun 5, 2020 · 10 comments
Open

Import error #2

anoukvlug opened this issue Jun 5, 2020 · 10 comments

Comments

@anoukvlug
Copy link

It looks likes the pyclits package is precisely what I am looking for. However after an installation that appeared to be successful, I unfortunately I got the following error message once I tried to import the package:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-b62475b6da31> in <module>
----> 1 import pyclits

~/Programs/miniconda3/envs/oggm_env/lib/python3.6/site-packages/pyclits/__init__.py in <module>
      5 """
      6 
----> 7 from data_loaders import *
      8 from empirical_model import EmpiricalModel
      9 from functions import *

ModuleNotFoundError: No module named 'data_loaders'

@jajcayn, could you help me solving this problem?

@jajcayn
Copy link
Owner

jajcayn commented Jun 5, 2020

Dear @anoukvlug
unfortunately, pyclits is pretty old and unmaintained. The reason for your error is that pyclist was developed for python2.7 which is now deprecated. Last time I tried, it did not work with python3.

As for the future of pyclits, unfortunately I do not have the time right now to update it, but I started rewriting core functionality to python3 in branches rewrite/*. If you feel adventurous you might fork the package, checkout rewrite branch and try to finish basic core, then the installation on python3 should work.

Thanks for understanding,
Best,

Nikola

@anoukvlug
Copy link
Author

Dear Nikola,
Thank you for your fast and kind reply! Unfortunately it is not the right time for me to be adventures and dive into the code.
Kind regards,
Anouk

@mafycek
Copy link
Collaborator

mafycek commented Jun 5, 2020 via email

@anoukvlug
Copy link
Author

@mafycek thanks a lot for the advice! I just installed your branch and at first sight it seems to work :)

@mafycek
Copy link
Collaborator

mafycek commented Jun 5, 2020 via email

@anoukvlug
Copy link
Author

Sorry, I wrote my previous message to early. I thought you meant the branch would work with python 3. So after I installed both the branch and was able able to load the package, I thought it would work. However I kept running into errors, when trying to using the functions. It won't recognize all the functions (some it does recognize though) that are actually there:

e.g.:

AttributeError                            Traceback (most recent call last)
<ipython-input-19-f363db24ae29> in <module>
----> 1 nino34 = clt.data_loaders.load_enso_index("/aop1/avlug/nino34raw.txt", "3.4", start_date = date(1870, 1, 1), 
      2     end_date = date(2017, 7, 1), anom = False)
      3 

AttributeError: module 'pyclits' has no attribute 'data_loaders'

For this I used a python environment (env not venv). I'm not familiar with poetry.

@anoukvlug
Copy link
Author

Actually, I wouldn't really need the data_loaders function, however I thought it would be good to get the example to work. As having an example would make it easier to figure out how to solve the error that I am having with the wavelet analysis function:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-23-4590a8ad37dc> in <module>
      1 wave, period, scale, coi = wavelet_analysis.continous_wavelet(df['001'].values, dt = dt, wavelet = mother, 
----> 2                                                               dj = dj, s0 = s0, j1 = j1, k=k0)

~/Programs/miniconda3/envs/oggm_env/lib/python3.6/site-packages/pyclits/wavelet_analysis.py in continous_wavelet(X, dt, pad, wavelet, **kwargs)
    137     k = np.arange(1, np.fix(n/2) + 1)
    138     k *= (2. * np.pi) / (n * dt)
--> 139     k_minus = -k[int(np.fix(n-1))/2 - 1::-1]
    140     k = np.concatenate((np.array([0.]), k, k_minus))
    141 

TypeError: slice indices must be integers or None or have an __index__ method

I have no clue if this error would be easy to solve or if it would get tricky and I can better look for another approach to do the wavelet analysis. @mafycek do you maybe know a quick fix for this problem? Or is this going to take quite some time to solve?

@mafycek
Copy link
Collaborator

mafycek commented Jun 9, 2020 via email

@mafycek
Copy link
Collaborator

mafycek commented Jun 9, 2020 via email

@mafycek
Copy link
Collaborator

mafycek commented Jun 9, 2020 via email

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