Velocity reduction units behave like km/s, not m/s #3371
Labels
bug-unconfirmed
reported bug that still needs to be confirmed
.imaging
Issues with our plotting functionalities
Avoid duplicates
Bug Summary
When using
Stream.plot(type='section')
, thevred
argument for velocity reduction is supposed to be in units of m/s per the documentation. However, providing e.g.vred=0.6
produces effectively a 600 m/s reduction. I.e., there's a m-to-km conversion issue.The example code below shows that when e.g.
vred=1
(1 m/s) is used, the effective velocity reduction is actually 1 km/s — see the red line. Example code's output plot:This bug is subtle because for most users, providing a value of 3,000 m/s for
vred
actually produces velocity reduction of 3,000,000 m/s — which has little time-shifting effect! So nothing immediately looks wrong in the plot.I believe the issue lies in the fact that
WaveformPlotting.__sect_init_time()
, which forms the trace time vectors including velocity reduction, usesWaveformPlotting._tr_offsets
. ButWaveformPlotting._tr_offsets
are in km, not in meters. Hence things working as expected when I treatvred
as having units of km/s.I'm happy to make a PR to fix this if the issue I've raised here is clear to the devs. Cheers!
Code to Reproduce
Error Traceback
No response
ObsPy Version?
1.4.0
Operating System?
macOS (M1)
Python Version?
3.11.5
Installation Method?
conda
The text was updated successfully, but these errors were encountered: