I am currently trying to make a spectrogram for a station that spans a day, however, it is hard to visualize a full 24 hour block. I have made hour long segments of the time series and created spectrograms for each channel. I run into an issue that with each successive hour, the min and max dB values vary, which makes flipping through multiple plots in a row difficult to see to what degree signals are significant between plots when the dB range fluctuates. I was looking at the code for the function, and I think if there were a flag such as db_lim=[*min,*max], then the colormap would be mapped to that range consistently between plots. I can edit this in my own version of obspy, but I think this would be a helpful functionality to have in future distributions.
These are lines 142 - 145 in obspy.imaging.spectrogram.spectrogram
_range = float(specgram.max() - specgram.min())
vmin = specgram.min() + vmin * _range
vmax = specgram.min() + vmax * _range
norm = Normalize(vmin, vmax, clip=True)
There’s probably a better way to set this up to handle random cases from user input (handling single values, not using dB scale, etc.) but if you add a flag that is default db_lim=None, then if they add a min and max value, you can limit user default range.
if db_lim != None: _range = float(db_lim[*max] - db_lim[*min]) vmin = db_lim[*min] + vmin * _range vmax = db_lim[*min] + vmax * _range norm = Normalize(vmin, vmax, clip=True)