I have several earthquakes in segy format. I am trying to create individual Streams(ObsPy) for each event, but this is not being possible as the name of each event varies according to the date.
from obspy.io.segy.core import _read_segy
from obspy.core.util import get_example_file
# or 'from obspy import read' if file wide headers are of no interest
N=186
for i in range(N):
stAll[i] = _read_segy("Event_" +str(N)+ "_*_surface.sgy")
print(st.__str__(extended=True))
For the name variation according to date I was using as usual the key '*' (as you can see on the code). However, this key seems to be not recognized.
This is the error I am getting:
OSError Traceback (most recent call last)
C:\Users\pahan\AppData\Local\Temp/ipykernel_33276/2996703372.py in <module>
5 stAll=[None]*186
6 for i in range(N):
----> 7 stAll[i] = _read_segy("Event_" +str(N)+ "_*_surface.sgy")
8 print(st.__str__(extended=True))
~\Anaconda3\lib\site-packages\obspy\io\segy\core.py in _read_segy(filename, headonly,
byteorder, textual_header_encoding, unpack_trace_headers, **kwargs)
170 """
171 # Read file to the internal segy representation.
--> 172 segy_object = _read_segyrev1(
173 filename, endian=byteorder,
174 textual_header_encoding=textual_header_encoding,
~\Anaconda3\lib\site-packages\obspy\io\segy\segy.py in _read_segy(file, endian,
textual_header_encoding, unpack_headers, headonly)
942 if not hasattr(file, 'read') or not hasattr(file, 'tell') or not \
943 hasattr(file, 'seek'):
--> 944 with open(file, 'rb') as open_file:
945 return _internal_read_segy(
946 open_file, endian=endian,
OSError: [Errno 22] Invalid argument: 'Event_186_*_surface.sgy'
I would appreciate any help, thanks in advance!