[Tutor] obspy.imaging.spectrogram

Guro Anne Brækken guroanne at gmail.com
Thu Jun 18 09:36:39 EDT 2020


Hi Again,

Unfortunately I forgot to mention the error message, it is the following:

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.......

Kind regards,
Guro Anne Brækken

On Thu, Jun 18, 2020 at 10:53 AM Guro Anne Brækken <guroanne at gmail.com>
wrote:

> Hi there,
>
> Is there anyone out there who would know how to output the data from the
> obspy function spectrogram (and not only an image file)?
>
> Problem:
> 1.read in one seismic trace (SEGY format) - OK
> 2. calculate and plot the spectrogram using obspy.imaging.spectrogram - OK
> 3. output the image of the spectrogram as a PNG file - OK
> 4. output the data points in SEGY format - NOT POSSIBLE ??
>
> My code is the following:
> 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.write('st_spec_data', format='SEGY')
>
> I am running the code with Anaconda navigator and python 3.7.6
>
> I hope this was clear. Looking forward to hearing about programmers'
> experiences with this issue!
>
> Kind regards,
> Guro Anne Braekken
>
>
>


More information about the Tutor mailing list