Repository: obspy/obspy

Issue:
`Stream.plot(type='section')` does not respect `method='full'`
### Avoid duplicates

- [X] I searched existing issues

### Bug Summary

When using the Stream plotting method with `type='section'`, no matter the `method` used the data are resampled if they exceed 10,000 samples, see here in the `__init__()` method for `WaveformPlotting`:
https://github.com/obspy/obspy/blob/00122ed909bf6a488ed25d279a83dbea10a6599a/obspy/imaging/waveform.py#L125-L129
and in `__sect_init_traces()`:
https://github.com/obspy/obspy/blob/00122ed909bf6a488ed25d279a83dbea10a6599a/obspy/imaging/waveform.py#L1235-L1239

It seems to me that the latter bit of code should be checking if `method='full'` and if so, setting `tmp_data = tr.data` — rather than resampling. Currently that kwarg is not checked. Therefore, as it stands, users have no way of fully plotting the data without resampling if they're using `type='section'`.

I'm happy to make a PR to address this.

### Code to Reproduce

_No response_

### Error Traceback

_No response_

### ObsPy Version?

1.4.0

### Operating System?

macOS (M1)

### Python Version?

3.11.5

### Installation Method?

conda


Discussion:
> I'm happy to make a PR to address this.

Sure, go ahead!
Great. What branch should I base my feature branch off of? [`maintenance_1.4.x`](https://github.com/obspy/obspy/tree/maintenance_1.4.x)?
> Great. What branch should I base my feature branch off of? [`maintenance_1.4.x`](https://github.com/obspy/obspy/tree/maintenance_1.4.x)?

Yes. Qualifies as a "bug", so that's where I would base it off of.

Resolving patch:
diff --git a/obspy/imaging/waveform.py b/obspy/imaging/waveform.py
--- a/obspy/imaging/waveform.py
+++ b/obspy/imaging/waveform.py
@@ -1252,10 +1252,20 @@ def __sect_init_traces(self):
         self._tr_delta = np.empty(self._tr_num)
         # TODO dynamic DATA_MAXLENGTH according to dpi
         for _i, tr in enumerate(self.stream):
-            if len(tr.data) >= self.max_npts:
+            method_ = self.plotting_method
+            if method_ is None:
+                if len(tr.data) >= self.max_npts:
+                    method_ = "fast"
+                else:
+                    method_ = "full"
+            method_ = method_.lower()
+            if method_ == 'fast':
                 tmp_data = signal.resample(tr.data, self.max_npts)
-            else:
+            elif method_ == 'full':
                 tmp_data = tr.data
+            else:
+                msg = "Invalid plot method: '%s'" % method_
+                raise ValueError(msg)
             # Initialising trace stats
             self._tr_data.append(tmp_data)
             self._tr_starttimes.append(tr.stats.starttime)


Test patch:
diff --git a/obspy/imaging/tests/test_waveform.py b/obspy/imaging/tests/test_waveform.py
--- a/obspy/imaging/tests/test_waveform.py
+++ b/obspy/imaging/tests/test_waveform.py
@@ -476,3 +476,15 @@ def test_plot_day_plot_catalog(self, image_path):
         st.plot(outfile=image_path, type='dayplot',
                 timezone='EST', time_offset=-5,
                 events=cat)
+
+    def test_section_max_npts(self):
+        """
+        Check that plotting with method='full' is respected for type='section'
+        if points are greater than max_npts.
+        """
+        starttime = UTCDateTime(0)
+        endtime = starttime + 10009
+        st = _create_stream(starttime, endtime, 1)  # st[0].stats.npts = 10010
+        st[0].stats.distance = 0  # So that the section plotting works
+        fig = st.plot(type='section', method='full')
+        assert fig.axes[0].lines[0].get_xdata().size == 10010