MathEXLab / PySPOD

A Python package for spectral proper orthogonal decomposition (SPOD).
https://mathexlab.github.io/PySPOD/
MIT License
97 stars 29 forks source link

Error running earthquake tutorial #10

Closed jdmoorman closed 3 years ago

jdmoorman commented 3 years ago

Running the earthquakes tutorial gives an error.

$ python slip_potency_2D.py
/Users/jdmoorman/Git/PySPOD/tests/data/earthquakes_data.nc
t.shape  =  (300,)
x1.shape =  (128,)
x2.shape =  (20,)
X.shape  =  (300, 128, 20)
Traceback (most recent call last):
  File "slip_potency_2D.py", line 58, in <module>
    SPOD_analysis = SPOD_streaming(X=X, params=params, data_handler=False, variables=variables)
  File "/Users/jdmoorman/opt/miniconda3/lib/python3.7/site-packages/pyspod-0.4.3-py3.7.egg/pyspod/spod_streaming.py", line 33, in __init__
    super().__init__(X, params, data_handler, variables)
  File "/Users/jdmoorman/opt/miniconda3/lib/python3.7/site-packages/pyspod-0.4.3-py3.7.egg/pyspod/spod_base.py", line 86, in __init__
    params=self._params
  File "/Users/jdmoorman/opt/miniconda3/lib/python3.7/site-packages/pyspod-0.4.3-py3.7.egg/pyspod/spod_base.py", line 383, in parse_parameters
    variables=self.variables)
  File "/Users/jdmoorman/opt/miniconda3/lib/python3.7/site-packages/pyspod-0.4.3-py3.7.egg/pyspod/spod_base.py", line 53, in data_handler
    d = data[ti,...,:]
IndexError: index 300 is out of bounds for axis 0 with size 300
jdmoorman commented 3 years ago

openjournals/joss-reviews#2862

mengaldo commented 3 years ago

@jdmoorman This should now be fixed, and I added a better check to raise an exception if t >= len(t). Thank you