Skip to content

Commit e464bda

Browse files
Bump obspy version to 1.3.0 (#486)
* Bump obspy version to 1.3.0 * Test on py 3.9, 3.10 * Encapsulate python versions in quotes * Remove future use * Temporarally pin pyfftw version * Use pip for pyfftw * Don't pin pyproj * Try using micromamba * Try using mamba * underscore * update maco env * update slow tests * Force h5py version to avoid dependency conflict * Debug macos omp linking error * Use conda * Add back in condarc * Don't run on 3.10 for now - macos requirements are not there
1 parent 5f9f538 commit e464bda

File tree

9 files changed

+59
-62
lines changed

9 files changed

+59
-62
lines changed

.github/test_conda_env.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ dependencies:
77
- matplotlib>=1.3.0
88
- scipy>=0.18
99
- mock
10-
- obspy>=1.0.3
10+
- obspy>=1.3.0
1111
- h5py
1212
- pyyaml
1313
- bottleneck
1414
- fftw
15-
- pyfftw>=0.12.0
16-
- pyproj<2
1715
- pytest>=2.0.0
1816
- pytest-cov
1917
- pytest-pep8
2018
- pytest-xdist
2119
- pytest-rerunfailures
2220
- pytest-mpl
23-
- codecov
21+
- codecov
22+
- pip
23+
- pip:
24+
- pyfftw

.github/test_conda_env_macOS.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ dependencies:
1616
- matplotlib>=1.3.0
1717
- scipy>=0.18
1818
- mock
19-
- obspy>=1.0.3
20-
- h5py
19+
- obspy>=1.3.0
20+
- h5py<3.2 # Issue with dep resolution: https://github.com/conda-forge/h5py-feedstock/issues/92
2121
- pyyaml
2222
- bottleneck
2323
- fftw
24-
- pyfftw>=0.12.0
25-
- pyproj<2
2624
- pytest>=2.0.0
2725
- pytest-cov
2826
- pytest-pep8
2927
- pytest-xdist
3028
- pytest-rerunfailures
3129
- pytest-mpl
32-
- codecov
30+
- codecov
31+
- pip
32+
- pip:
33+
- pyfftw

.github/test_condarc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
channels:
22
- conda-forge
33
- defaults
4-
auto_activate_base: false
4+
auto_activate_base: false

.github/workflows/runtest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python-version: [3.7, 3.8]
11+
python-version: ['3.7', '3.8', '3.9']
1212
fail-fast: false
1313
# continue-on-error: true
1414

eqcorrscan/utils/clustering.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -837,21 +837,20 @@ def remove_unclustered(catalog, distance_cutoff, num_threads=None):
837837
"""
838838
import ctypes
839839
from eqcorrscan.utils.libnames import _load_cdll
840-
from future.utils import native_str
841840
from math import radians
842841

843842
utilslib = _load_cdll('libutils')
844843

845844
utilslib.remove_unclustered.argtypes = [
846845
np.ctypeslib.ndpointer(dtype=np.float32,
847-
flags=native_str('C_CONTIGUOUS')),
846+
flags='C_CONTIGUOUS'),
848847
np.ctypeslib.ndpointer(dtype=np.float32,
849-
flags=native_str('C_CONTIGUOUS')),
848+
flags='C_CONTIGUOUS'),
850849
np.ctypeslib.ndpointer(dtype=np.float32,
851-
flags=native_str('C_CONTIGUOUS')),
850+
flags='C_CONTIGUOUS'),
852851
ctypes.c_long,
853852
np.ctypeslib.ndpointer(dtype=np.uint8,
854-
flags=native_str('C_CONTIGUOUS')),
853+
flags='C_CONTIGUOUS'),
855854
ctypes.c_float, ctypes.c_int]
856855
utilslib.remove_unclustered.restype = ctypes.c_int
857856

@@ -905,20 +904,19 @@ def dist_mat_km(catalog, num_threads=None):
905904
"""
906905
import ctypes
907906
from eqcorrscan.utils.libnames import _load_cdll
908-
from future.utils import native_str
909907

910908
utilslib = _load_cdll('libutils')
911909

912910
utilslib.distance_matrix.argtypes = [
913911
np.ctypeslib.ndpointer(dtype=np.float32,
914-
flags=native_str('C_CONTIGUOUS')),
912+
flags='C_CONTIGUOUS'),
915913
np.ctypeslib.ndpointer(dtype=np.float32,
916-
flags=native_str('C_CONTIGUOUS')),
914+
flags='C_CONTIGUOUS'),
917915
np.ctypeslib.ndpointer(dtype=np.float32,
918-
flags=native_str('C_CONTIGUOUS')),
916+
flags='C_CONTIGUOUS'),
919917
ctypes.c_long,
920918
np.ctypeslib.ndpointer(dtype=np.float32,
921-
flags=native_str('C_CONTIGUOUS')),
919+
flags='C_CONTIGUOUS'),
922920
ctypes.c_int]
923921
utilslib.distance_matrix.restype = ctypes.c_int
924922

eqcorrscan/utils/correlate.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
import numpy as np
3030
import math
31-
from future.utils import native_str
3231

3332
from eqcorrscan.utils.libnames import _load_cdll
3433

@@ -452,13 +451,13 @@ def time_multi_normxcorr(templates, stream, pads, threaded=False, *args,
452451

453452
argtypes = [
454453
np.ctypeslib.ndpointer(dtype=np.float32, ndim=1,
455-
flags=native_str('C_CONTIGUOUS')),
454+
flags='C_CONTIGUOUS'),
456455
ctypes.c_int, ctypes.c_int,
457456
np.ctypeslib.ndpointer(dtype=np.float32, ndim=1,
458-
flags=native_str('C_CONTIGUOUS')),
457+
flags='C_CONTIGUOUS'),
459458
ctypes.c_int,
460459
np.ctypeslib.ndpointer(dtype=np.float32, ndim=1,
461-
flags=native_str('C_CONTIGUOUS'))]
460+
flags='C_CONTIGUOUS')]
462461
restype = ctypes.c_int
463462
if threaded:
464463
func = utilslib.multi_normxcorr_time_threaded
@@ -527,22 +526,22 @@ def fftw_normxcorr(templates, stream, pads, threaded=False, *args, **kwargs):
527526

528527
argtypes = [
529528
np.ctypeslib.ndpointer(dtype=np.float32, ndim=1,
530-
flags=native_str('C_CONTIGUOUS')),
529+
flags='C_CONTIGUOUS'),
531530
ctypes.c_long, ctypes.c_long,
532531
np.ctypeslib.ndpointer(dtype=np.float32, ndim=1,
533-
flags=native_str('C_CONTIGUOUS')),
532+
flags='C_CONTIGUOUS'),
534533
ctypes.c_long,
535534
np.ctypeslib.ndpointer(dtype=np.float32,
536-
flags=native_str('C_CONTIGUOUS')),
535+
flags='C_CONTIGUOUS'),
537536
ctypes.c_long,
538537
np.ctypeslib.ndpointer(dtype=np.intc,
539-
flags=native_str('C_CONTIGUOUS')),
538+
flags='C_CONTIGUOUS'),
540539
np.ctypeslib.ndpointer(dtype=np.intc,
541-
flags=native_str('C_CONTIGUOUS')),
540+
flags='C_CONTIGUOUS'),
542541
np.ctypeslib.ndpointer(dtype=np.intc,
543-
flags=native_str('C_CONTIGUOUS')),
542+
flags='C_CONTIGUOUS'),
544543
np.ctypeslib.ndpointer(dtype=np.intc,
545-
flags=native_str('C_CONTIGUOUS'))]
544+
flags='C_CONTIGUOUS')]
546545
restype = ctypes.c_int
547546

548547
if threaded:
@@ -750,23 +749,23 @@ def fftw_multi_normxcorr(template_array, stream_array, pad_array, seed_ids,
750749

751750
utilslib.multi_normxcorr_fftw.argtypes = [
752751
np.ctypeslib.ndpointer(dtype=np.float32,
753-
flags=native_str('C_CONTIGUOUS')),
752+
flags='C_CONTIGUOUS'),
754753
ctypes.c_long, ctypes.c_long, ctypes.c_long,
755754
np.ctypeslib.ndpointer(dtype=np.float32,
756-
flags=native_str('C_CONTIGUOUS')),
755+
flags='C_CONTIGUOUS'),
757756
ctypes.c_long,
758757
np.ctypeslib.ndpointer(dtype=np.float32,
759-
flags=native_str('C_CONTIGUOUS')),
758+
flags='C_CONTIGUOUS'),
760759
ctypes.c_long,
761760
np.ctypeslib.ndpointer(dtype=np.intc,
762-
flags=native_str('C_CONTIGUOUS')),
761+
flags='C_CONTIGUOUS'),
763762
np.ctypeslib.ndpointer(dtype=np.intc,
764-
flags=native_str('C_CONTIGUOUS')),
763+
flags='C_CONTIGUOUS'),
765764
ctypes.c_int,
766765
np.ctypeslib.ndpointer(dtype=np.intc,
767-
flags=native_str('C_CONTIGUOUS')),
766+
flags='C_CONTIGUOUS'),
768767
np.ctypeslib.ndpointer(dtype=np.intc,
769-
flags=native_str('C_CONTIGUOUS')),
768+
flags='C_CONTIGUOUS'),
770769
ctypes.c_int]
771770
utilslib.multi_normxcorr_fftw.restype = ctypes.c_int
772771
'''

eqcorrscan/utils/findpeaks.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
from multiprocessing import Pool, cpu_count
1616
from scipy import ndimage
17-
from future.utils import native_str
1817

1918
from eqcorrscan.utils.correlate import pool_boy
2019
from eqcorrscan.utils.libnames import _load_cdll
@@ -344,17 +343,17 @@ def _multi_decluster(peaks, indices, trig_int, thresholds, cores):
344343

345344
func.argtypes = [
346345
np.ctypeslib.ndpointer(dtype=np.float32, shape=(total_length,),
347-
flags=native_str('C_CONTIGUOUS')),
346+
flags='C_CONTIGUOUS'),
348347
np.ctypeslib.ndpointer(dtype=long_type, shape=(total_length,),
349-
flags=native_str('C_CONTIGUOUS')),
348+
flags='C_CONTIGUOUS'),
350349
np.ctypeslib.ndpointer(dtype=long_type, shape=(n,),
351-
flags=native_str('C_CONTIGUOUS')),
350+
flags='C_CONTIGUOUS'),
352351
ctypes.c_int,
353352
np.ctypeslib.ndpointer(dtype=np.float32, shape=(n,),
354-
flags=native_str('C_CONTIGUOUS')),
353+
flags='C_CONTIGUOUS'),
355354
long_type,
356355
np.ctypeslib.ndpointer(dtype=np.uint32, shape=(total_length,),
357-
flags=native_str('C_CONTIGUOUS')),
356+
flags='C_CONTIGUOUS'),
358357
ctypes.c_int]
359358
func.restype = ctypes.c_int
360359

@@ -440,14 +439,14 @@ def decluster_distance_time(peaks, index, trig_int, catalog,
440439

441440
func.argtypes = [
442441
np.ctypeslib.ndpointer(dtype=np.float32, shape=(length,),
443-
flags=native_str('C_CONTIGUOUS')),
442+
flags='C_CONTIGUOUS'),
444443
np.ctypeslib.ndpointer(dtype=long_type, shape=(length,),
445-
flags=native_str('C_CONTIGUOUS')),
444+
flags='C_CONTIGUOUS'),
446445
np.ctypeslib.ndpointer(dtype=np.float32, shape=(length * length,),
447-
flags=native_str('C_CONTIGUOUS')),
446+
flags='C_CONTIGUOUS'),
448447
long_type, ctypes.c_float, long_type, ctypes.c_float,
449448
np.ctypeslib.ndpointer(dtype=np.uint32, shape=(length,),
450-
flags=native_str('C_CONTIGUOUS'))]
449+
flags='C_CONTIGUOUS')]
451450
func.restype = ctypes.c_int
452451

453452
sorted_inds = np.abs(peaks).argsort()
@@ -505,12 +504,12 @@ def decluster(peaks, index, trig_int, threshold=0):
505504

506505
func.argtypes = [
507506
np.ctypeslib.ndpointer(dtype=np.float32, shape=(length,),
508-
flags=native_str('C_CONTIGUOUS')),
507+
flags='C_CONTIGUOUS'),
509508
np.ctypeslib.ndpointer(dtype=long_type, shape=(length,),
510-
flags=native_str('C_CONTIGUOUS')),
509+
flags='C_CONTIGUOUS'),
511510
long_type, ctypes.c_float, long_type,
512511
np.ctypeslib.ndpointer(dtype=np.uint32, shape=(length,),
513-
flags=native_str('C_CONTIGUOUS'))]
512+
flags='C_CONTIGUOUS')]
514513
func.restype = ctypes.c_int
515514

516515
sorted_inds = np.abs(peaks).argsort()
@@ -539,10 +538,10 @@ def _find_peaks_c(array, threshold):
539538
length = array.shape[0]
540539
utilslib.find_peaks.argtypes = [
541540
np.ctypeslib.ndpointer(dtype=np.float32, shape=(length, ),
542-
flags=native_str('C_CONTIGUOUS')),
541+
flags='C_CONTIGUOUS'),
543542
ctypes.c_long, ctypes.c_float,
544543
np.ctypeslib.ndpointer(dtype=np.uint32, shape=(length, ),
545-
flags=native_str('C_CONTIGUOUS'))]
544+
flags='C_CONTIGUOUS')]
546545
utilslib.find_peaks.restype = ctypes.c_int
547546
arr = np.ascontiguousarray(array, np.float32)
548547
out = np.ascontiguousarray(np.zeros((length, ), dtype=np.uint32))
@@ -567,13 +566,13 @@ def _multi_find_peaks_c(arrays, thresholds, threads):
567566
arr = np.ascontiguousarray(arrays.flatten(), np.float32)
568567
utilslib.multi_find_peaks.argtypes = [
569568
np.ctypeslib.ndpointer(dtype=np.float32, shape=(n * length,),
570-
flags=native_str('C_CONTIGUOUS')),
569+
flags='C_CONTIGUOUS'),
571570
ctypes.c_long, ctypes.c_int,
572571
np.ctypeslib.ndpointer(dtype=np.float32, shape=(n, ),
573-
flags=native_str('C_CONTIGUOUS')),
572+
flags='C_CONTIGUOUS'),
574573
ctypes.c_int,
575574
np.ctypeslib.ndpointer(dtype=np.uint32, shape=(n * length, ),
576-
flags=native_str('C_CONTIGUOUS'))]
575+
flags='C_CONTIGUOUS')]
577576
utilslib.multi_find_peaks.restype = ctypes.c_int
578577

579578
out = np.ascontiguousarray(np.zeros((n * length, ), dtype=np.uint32))

eqcorrscan/utils/pre_processing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ def _resample(tr, sampling_rate, threads=1):
632632
Provide a pyfftw version of obspy's trace resampling. This code is
633633
modified from obspy's Trace.resample method.
634634
"""
635-
from future.utils import native_str
636635
from scipy.signal import get_window
637636
from pyfftw.interfaces.scipy_fftpack import rfft, irfft
638637

@@ -648,7 +647,7 @@ def _resample(tr, sampling_rate, threads=1):
648647
x_i = x[1::2]
649648

650649
large_w = np.fft.ifftshift(
651-
get_window(native_str("hanning"), tr.stats.npts))
650+
get_window("hanning", tr.stats.npts))
652651
x_r *= large_w[:tr.stats.npts // 2 + 1]
653652
x_i *= large_w[:tr.stats.npts // 2 + 1]
654653

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ numpy>=1.12
22
matplotlib>=1.3.0
33
scipy>=0.18
44
bottleneck
5-
obspy>=1.0.3
6-
pyfftw
5+
obspy>=1.3.0 # ObsPy <1.3.0 is incompatible with numpy >= 1.22: https://github.com/obspy/obspy/issues/2912
6+
pyfftw # PyFFTW 0.13 on conda has a build issue: https://github.com/conda-forge/pyfftw-feedstock/issues/51
77
h5py
88
pytest>=2.0.0
99
pytest-cov
@@ -12,4 +12,4 @@ pytest-xdist
1212
pytest-rerunfailures
1313
pytest-mpl
1414
codecov
15-
pillow>=6.2.3 # not directly required, pinned by Snyk to avoid a vulnerability
15+
pillow>=6.2.3 # not directly required, pinned by Snyk to avoid a vulnerability

0 commit comments

Comments
 (0)