Python re-implementation of AVO IceWeb application including spectrogram browser. Some minimal examples follow.
Assuming you have this repository at /path/to/repo and an ObsPy Stream object (st), and that it is in units of m/s.
import sys sys.path.append('/path/to/repo') import IceWeb spobj = IceWeb.icewebSpectrogram(stream=st)
We plot an icewebSpectrogram object by calling the plot method. Here is the function prototype:
def plot(self, outfile=None, secsPerFFT=None, fmin=0.5, fmax=20.0, log=False, cmap=pqlx, clim=None, \ equal_scale=False, title=None, add_colorbar=True, precompute=False, dbscale=True)
All we have to do is create an instance of an icewebSpectrogram object, and then call the plot method. Each spectrogram is individually scaled to make best use of the colormap.
sgramfile = 'myspecgram_unscaled.png' spobj.plot(outfile=sgramfile)
As in 1, but we want to choose the best overall spectral amplitude scale so all spectrogram plots are scaled (colored) the same:
sgramfile = 'myspecgram_scaled.png' spobj.plot(outfile=sgramfile, equal_scale=True)
As in 2, but we want to provide our own scale (colormap) limits. This is the default for AVO North spectrograms:
sgramfile = 'myspecgram_fixed.png' spobj.plot(outfile=sgramfile, clim=[1e-8, 1e-5])
Note that the scale here is in units of m/s/Hz.
sgramfile = 'myspecgram_unscaled.png' spobj.plot(outfile=sgramfile, dbscale=True, title='Unscaled')
sgramfile = 'myspecgram_unscaled.png' spobj.plot(outfile=sgramfile, equal_scale=True, dbscale=True, title='Scaled')
sgramfile = 'myspecgram_unscaled.png' spobj.plot(outfile=sgramfile, clim=[1e-8, 1e-5], dbscale=True, title='Fixed')
To change the colormap, pass the optional cmap name:value pair to the plot method.
The default colormap is pqlx. Other options are viridis_white_r, obspy_divergent, obspy_sequential
from obspy.imaging.cm obspy_sequential spobj.plot(..., cmap=obspy_sequential )
spobj.plot(..., log=True )
spobj.plot(..., fmin = 0.0, fmax = 10.0 )
spobj.plot(..., title = 'Montserrat 2005-05-31 13:46:36' )
spobj.plot(..., add_colorbar = False)
If plotting the same seismic data as spectrograms in different ways, it can be useful to pre-compute the spectrograms:
spobj = IceWeb.icewebSpectrogram(stream=st) spobj = spobj.precompute() # plot same data in 4 different ways spobj.plot(dbscale=False) spobj.plot(dbscale=False, equal_scale=True) spobj.plot(dbscale=True) spobj.plot(dbscale=True, equal_scale=True)
Glenn Thompson, 2021/06/22