|
|
@ -23,30 +23,25 @@ |
|
|
|
"from pyrocko.fdsn import ws\n", |
|
|
|
"from pyrocko import util, io, trace\n", |
|
|
|
"\n", |
|
|
|
"\n", |
|
|
|
"# select time range\n", |
|
|
|
"tmin = util.stt('2015-09-16 22:54:33')\n", |
|
|
|
"tmax = util.stt('2015-09-17 00:54:33')\n", |
|
|
|
"\n", |
|
|
|
"# select networkID, StationID, Location, Channel\n", |
|
|
|
"# asterisk '*' as wildcard is possible\n", |
|
|
|
"# use asterisk '*' as wildcard\n", |
|
|
|
"selection = [('X9', '*', '*', 'HHZ', tmin, tmax)] \n", |
|
|
|
"# Example above: Select restricted network X9, all stations, all locations,\n", |
|
|
|
"# vertikal component only, 80Hz\n", |
|
|
|
"\n", |
|
|
|
"# Read access-token for the restricted network from file \n", |
|
|
|
"token=open('token.asc', 'rb').read() # 'rb' required for unicode to byte conversion\n", |
|
|
|
"# Read access-token for the restricted network from file as 'rb' for binary\n", |
|
|
|
"token=open('token.asc', 'rb').read()\n", |
|
|
|
"\n", |
|
|
|
"# setup a waveform data request\n", |
|
|
|
"request_waveform = ws.dataselect(site='geofon',selection=selection,token=token)\n", |
|
|
|
"\n", |
|
|
|
"# Instead of the token, username and password can be given explicitely via:\n", |
|
|
|
"# request_waveform = ws.dataselect(site='geofon',selection=selection,user=user,passwd=passwd)\n", |
|
|
|
"# where 'user' and 'passwd' are to be entered as strings.\n", |
|
|
|
"request_waveform = ws.dataselect(site='geofon', selection=selection, token=token)\n", |
|
|
|
"\n", |
|
|
|
"# Alternative method using username and password instead of token:\n", |
|
|
|
"# request_waveform = ws.dataselect(site='geofon', selection=selection, user='user', passwd='passwd')\n", |
|
|
|
"\n", |
|
|
|
"# write the incoming data stream to 'traces.mseed'\n", |
|
|
|
"with open('traces.mseed', 'wb') as file: # 'wb' - same reason as 'rb' above\n", |
|
|
|
"# write the incoming data stream to 'traces.mseed' as 'wb' for binary\n", |
|
|
|
"with open('traces.mseed', 'wb') as file:\n", |
|
|
|
" file.write(request_waveform.read())" |
|
|
|
] |
|
|
|
} |
|
|
|