Browse Source

fdsn datadownload

lilienka 3 years ago
1 changed files with 8 additions and 13 deletions
  1. +8

+ 8
- 13
FDSN-data-download.ipynb View File

@ -23,30 +23,25 @@
"from pyrocko.fdsn import ws\n",
"from pyrocko import util, io, trace\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",
"# 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",
"# 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",
"# setup a waveform data request\n",
"request_waveform = ws.dataselect(site='geofon',selection=selection,token=token)\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",
"# Alternative method using username and password instead of token:\n",
"# request_waveform = ws.dataselect(site='geofon', selection=selection, user='user', passwd='passwd')\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("