Hello everyone. When I use the same stream. resample()
function to resample continuous waveforms in different Anaconda virtual environments, different results appear.
In the first virtual environment ‘pygmt’:
import obspy
def example():
path = 'E:\\Documents_zoom\\Programs\\download-seisdata-with-obspy-master\\Down_waveforms\\WAVEFORMS'
st = obspy.read(pathname_or_url=path + '\\2022.08.14.08.00.00.IC.BJT.00.MSEED')
st = st.resample(100)
print(st)
return 0
example()
The operation result is:
D:\Scientific_zoom\Anaconda_zoom\envs\pygmt\python.exe E:/Documents_zoom/Programs/download-seisdata-with-obspy-master/test.py
3 Trace(s) in Stream:
IC.BJT.00.BH1 | 2022-08-14T08:00:00.019538Z - 2022-08-14T09:00:00.009538Z | 100.0 Hz, 360000 samples
IC.BJT.00.BH2 | 2022-08-14T08:00:00.019538Z - 2022-08-14T09:00:00.009538Z | 100.0 Hz, 360000 samples
IC.BJT.00.BHZ | 2022-08-14T08:00:00.019538Z - 2022-08-14T09:00:00.009538Z | 100.0 Hz, 360000 samples
Run the same code in another virtual environment ‘pytorch’:
import obspy
def example():
path = 'E:\\Documents_zoom\\Programs\\download-seisdata-with-obspy-master\\Down_waveforms\\WAVEFORMS'
st = obspy.read(pathname_or_url=path + '\\2022.08.14.08.00.00.IC.BJT.00.MSEED')
st = st.resample(100)
print(st)
return 0
example()
But an error occurred:
Traceback (most recent call last):
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\scipy\signal\windows\_windows.py", line 2214, in get_window
beta = float(window)
ValueError: could not convert string to float: 'hanning'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\scipy\signal\windows\_windows.py", line 2232, in get_window
winfunc = _win_equiv[winstr]
KeyError: 'hanning'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Documents_zoom\Programs\yuzy\test.py", line 12, in <module>
example()
File "E:\Documents_zoom\Programs\yuzy\test.py", line 7, in example
st = st.resample(100)
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\obspy\core\stream.py", line 2351, in resample
tr.resample(sampling_rate, window=window,
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\obspy\core\util\decorator.py", line 237, in skip_if_no_data
return func(*args, **kwargs)
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\obspy\core\trace.py", line 282, in _add_processing_info
result = func(*args, **kwargs)
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\obspy\core\trace.py", line 1744, in resample
large_w = np.fft.ifftshift(get_window(window,
File "D:\Scientific_zoom\Anaconda_zoom\envs\pytorch\lib\site-packages\scipy\signal\windows\_windows.py", line 2234, in get_window
raise ValueError("Unknown window type.") from e
ValueError: Unknown window type.
The configuration of the virtual environment pygmt is:
ObsPy Version=='1.3.0'; Operating System=='win 10'; Python Version=='3.9.13'; Installation Method=='pip'
The configuration of the virtual environment pytorch is:
ObsPy Version=='1.3.0'; Operating System=='win 10'; Python Version=='3.9.12'; Installation Method=='pip'
If anyone knows the solution, please contact me. Thank you.