[Tutor] obspy.imaging.spectrogram

Alan Gauld alan.gauld at yahoo.co.uk
Thu Jun 18 13:07:41 EDT 2020


On 18/06/2020 14:36, Guro Anne Brækken wrote:

> AttributeError                            Traceback (most recent call
> last)<ipython-input-9-801c1ba52996> in <module>----> 1
> st_spec.write('st_spec_data', format='SEGY')
> AttributeError: 'list' object has no attribute 'write'
> 
> The object type is "list", which does not make any sense since I will need
> floating point numbers.......

The list can hold anything but it's the list object that
needs to have a write() method. And it doesn't.

Looking again at your code:

st=obspy.read(\seismic\trace.segy)
st_spec=st.spectrogram(log=True, wlen=0.02,
                       samp_rate=32000, per_lap=0.9,
                       outfile="st_spec_image")

st_spec is the return value from st.spectrogram() and
it seems reasonable that spectrogram() would return a
list of values. Although I don't know what the outfile
parameter does in that case!

This is probably what you need to ask the obspy community.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list