envelope + nomalize trace

Dear all,

1)
I'm trying to envelope a trace using the obspy.signal.filter.envelope function.

I get this warning:
/usr/local/lib/python2.7/dist-packages/obspy/signal/filter.py:209: RuntimeWarning: invalid value encountered in sqrt
   data = (data ** 2 + hilb ** 2) ** 0.5

Does anyone know, what is this?

What's the difference by using the obspy.signal.cpxtrace.envelope function?

2)
After the filter.envelope, I'm trying to normalize the trace but I get an "nan" array of data:
[ nan nan nan ..., nan nan nan]

This is not happening though if I use the cpxtrace.envelope function.

Any ideas?

Thank you in advance,

Nikos Triantafyllis

Hi Nikos,

can you send a small sample that reproduces the behavior?

I suspect your data is either zero or somehow causes the envelope
calculation to be unstable. I guess that the data after the envolope
calculation is all zero -> then trace.normalize() might create a NaN
array (ObsPy 1.0.1 fixes this).

If this turns out to be a bug, please open an issue on GitHub.

Cheers!

Lion

Hi Lion,

I attach a python script and the mseed file.

Thank you again,
Nikos

data_HNN.mseed (75.5 KB)

envel.py (1.23 KB)