Trace data normalization/scaling and resampling in waveform section plots

Hi

I just noted that plotting the same waveforms using either plot() or plot(type=‘section’) can yield rather different results. I can provide a simple script and and input file (or figures) to demonstrate the issue but by some annoying reason (being a new user to discourse) I’m not allowed to upload files.

regP

I’ve bumped up your user’s trust level, can you try again if you can upload files now?

Hi T

Sorry, still doesn’t seem to work, or I’m doing something stupid. The example can be picked up here instead: https://www.dropbox.com/s/c7lc32fctp9iiom/obspy_plot.tgz?dl=0

I had a look at the settings and actually I think any logged in user should be able to attach pictures using the “upload” button… that shows in the symbol bar on top of the text field when typing out a reply.

Screenshot from 2020-11-16 10-08-39

I think some filetypes might be restricted to upload, but images should work, as different people have posted pictures before.

Hi T

Seems to be working fine now, perhaps there were some delay before one can upload files. In any case attached is a ziped tar ball holding script, input files and figures. Note that there are two waveforms plotted as type=‘section’ seems to have problem properly scaling the waveform if a single waveform is plotted.

obspy_plot.tgz (561.1 KB)

Look at the docs for the section plot, there’s quite a few parameters to specify, e.g. normalization can be done per trace (which is default) or with a global normalization for the whole dataset.

There also seems to be some resampling done if number of samples in a trace is more than 10k samples (looking at the source code), and it seems this can not be changed or deactivated by the user right now.

The resampling, is this performed only in the case of a section plot? That surely could explain the different appearance. From reading the manual (parameter method) I would expect this to not occur if the number of data samples in the waveform is less than 400k

Have read and tested various of the available parameters but no avail. My work around for now if plotting a single waveform in a section plot is to plot the waveform twice with a tiny separation and then scale them enough so that the separation is not visible. Now of course plotting a single waveform as a section plot may not seem meaningful, but may happen if data is not available for all but one channel.

Did try to look into the source code my self, but got lost among the objects (sorry never really liked object oriented programming, to much of a black box mentality for my taste)

The scaling you are talking about can be controled with the norm_method option, like I mentioned.

Here is the resampling being done: