Repository: obspy/obspy

Issue:
Scipy v1.9.0 renames scipy.signal.hanning to scipy.signal.hann
### Problem

Automated tests that use scipy v1.9.0 fail because `scipy.signal.hanning` has been removed in favor of `scipy.signal.hann` as noted in the [changelog](https://docs.scipy.org/doc/scipy/release.1.9.0.html). It seems like this has been in the works since [v1.1.0](https://docs.scipy.org/doc/scipy/release.1.1.0.html?highlight=hann).

### Proposed solution

Move to embracing the `scipy` convention by using `hann` instead of `hanning` in the code base. 

Alternatively, just make this change when calling `scipy.signal.get_window`. Note that `numpy` hasn't made this change and still uses `numpy.hanning` see this [discussion](https://github.com/numpy/numpy/issues/17303).


Discussion:

Resolving patch:
diff --git a/obspy/core/stream.py b/obspy/core/stream.py
--- a/obspy/core/stream.py
+++ b/obspy/core/stream.py
@@ -2291,7 +2291,7 @@ def trigger(self, type, **options):
             tr.trigger(type, **options)
         return self
 
-    def resample(self, sampling_rate, window='hanning', no_filter=True,
+    def resample(self, sampling_rate, window='hann', no_filter=True,
                  strict_length=False):
         """
         Resample data in all traces of stream using Fourier method.
@@ -2301,7 +2301,7 @@ def resample(self, sampling_rate, window='hanning', no_filter=True,
         :type window: :class:`numpy.ndarray`, callable, str, float, or tuple,
             optional
         :param window: Specifies the window applied to the signal in the
-            Fourier domain. Defaults ``'hanning'`` window. See
+            Fourier domain. Defaults ``'hann'`` window. See
             :func:`scipy.signal.resample` for details.
         :type no_filter: bool, optional
         :param no_filter: Deactivates automatic filtering if set to ``True``.
diff --git a/obspy/core/trace.py b/obspy/core/trace.py
--- a/obspy/core/trace.py
+++ b/obspy/core/trace.py
@@ -1644,7 +1644,7 @@ def trigger(self, type, **options):
 
     @skip_if_no_data
     @_add_processing_info
-    def resample(self, sampling_rate, window='hanning', no_filter=True,
+    def resample(self, sampling_rate, window='hann', no_filter=True,
                  strict_length=False):
         """
         Resample trace data using Fourier method. Spectra are linearly
@@ -1655,7 +1655,7 @@ def resample(self, sampling_rate, window='hanning', no_filter=True,
         :type window: :class:`numpy.ndarray`, callable, str, float, or tuple,
             optional
         :param window: Specifies the window applied to the signal in the
-            Fourier domain. Defaults to ``'hanning'`` window. See
+            Fourier domain. Defaults to ``'hann'`` window. See
             :func:`scipy.signal.resample` for details.
         :type no_filter: bool, optional
         :param no_filter: Deactivates automatic filtering if set to ``True``.


Test patch:
diff --git a/obspy/core/tests/test_trace.py b/obspy/core/tests/test_trace.py
--- a/obspy/core/tests/test_trace.py
+++ b/obspy/core/tests/test_trace.py
@@ -2116,7 +2116,7 @@ def test_resample_new(self):
                      'starttime': starttime})
         # downsample
         tr = tr0.copy()
-        tr.resample(0.5, window='hanning', no_filter=True)
+        tr.resample(0.5, window='hann', no_filter=True)
         assert len(tr.data) == 5
         expected = np.array([0.19478735, 0.83618307, 0.32200221,
                              -0.7794053, -0.57356732])
@@ -2130,7 +2130,7 @@ def test_resample_new(self):
 
         # upsample
         tr = tr0.copy()
-        tr.resample(2.0, window='hanning', no_filter=True)
+        tr.resample(2.0, window='hann', no_filter=True)
         assert len(tr.data) == 20
         assert tr.stats.sampling_rate == 2.0
         assert tr.stats.delta == 0.5
@@ -2141,7 +2141,7 @@ def test_resample_new(self):
 
         # downsample with non integer ratio
         tr = tr0.copy()
-        tr.resample(0.75, window='hanning', no_filter=True)
+        tr.resample(0.75, window='hann', no_filter=True)
         assert len(tr.data) == int(10 * .75)
         expected = np.array([0.15425413, 0.66991128, 0.74610418, 0.11960477,
                              -0.60644662, -0.77403839, -0.30938935])
@@ -2166,7 +2166,7 @@ def test_resample_new(self):
 
         # downsample with window and automatic filtering
         tr = tr0.copy()
-        tr.resample(0.5, window='hanning', no_filter=False)
+        tr.resample(0.5, window='hann', no_filter=False)
         assert len(tr.data) == 5
         assert tr.stats.sampling_rate == 0.5
         assert tr.stats.delta == 2.0