Numpy.float error using stream.plot

I am getting a runtime error on one of my scripts, originating from stream.plot and caused by changes in numpy. How can I get round this?

Traceback (most recent call last):
  File "./plotaDay.py", line 102, in <module>
    main()
  File "./plotaDay.py", line 97, in main
    st.plot( equal_scale=False, size=(1600,800), outfile=file_plot, linewidth=0.2, starttime=plotBeg, endtime=plotEnd )
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/core/stream.py", line 1161, in plot
    return waveform.plot_waveform(*args, **kwargs)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/imaging/waveform.py", line 278, in plot_waveform
    self.plot(*args, **kwargs)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/imaging/waveform.py", line 403, in plot
    self.__plot_min_max(stream_new[_i], ax, *args, **kwargs)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/imaging/waveform.py", line 768, in __plot_min_max
    extreme_values = np.empty((pixel_count + 1, 2), dtype=np.float)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

probably the easiest way would be to upgrade obspy?

Thanks.

I didn’t think it was out of date, but I’ll check.

That worked. Many thanks. I’m a twit.

1 Like

Errors like this, search in our issue tracker and usually you find information about if, when and how it was fixed and if not you can open a ticket to let us know.

1 Like