Open megies opened 8 years ago
ping
Same goes for get_waveforms_bulk()
, looks like POST requests never were accomodated
Ugly workaround for use etc in Massdownloader
import io
from obspy.clients.fdsn import Client
from obspy import UTCDateTime, Stream, read
class PatchedClient(Client):
def get_waveforms_bulk(self, bulk, quality=None, minimumlength=None,
longestonly=None, filename=None,
attach_response=False, **kwargs):
if filename is None:
st = Stream()
for item in bulk:
st += self.get_waveforms(
*item, quality=quality, minimumlength=minimumlength,
longestonly=longestonly, attach_response=attach_response,
**kwargs)
return st
with open(filename, 'wb') as fh:
for item in bulk:
bio = io.BytesIO()
self.get_waveforms(
*item, quality=quality, minimumlength=minimumlength,
longestonly=longestonly, attach_response=attach_response,
filename=bio, **kwargs)
bio.seek(0, 0)
data = bio.read()
fh.write(data)
t1 = UTCDateTime(2022, 6, 1, 12)
t2 = t1 + 20
client = PatchedClient("http://jane")
bulk = [["GR", "FUR", "*", "*", t1, t2]]
print(client.get_waveforms(*bulk[0]))
print(client.get_waveforms_bulk(bulk))
client.get_waveforms_bulk(bulk, filename='/tmp/blap.mseed')
print(read('/tmp/blap.mseed'))
CC @jwassermann
Compare same request with
Client("BGR")
which works..