Skip to content

Commit

Permalink
Check if user really wants to use all known FDSN providers for downlo…
Browse files Browse the repository at this point in the history
…ading event waveforms.
  • Loading branch information
claudiodsf committed Dec 2, 2024
1 parent ea644f9 commit 4b800e4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions seiscat/download/event_waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,46 @@
GNU General Public License v3.0 or later
(https://www.gnu.org/licenses/gpl-3.0-standalone.html)
"""
import sys
import pathlib
from obspy.clients.fdsn.mass_downloader import CircularDomain, \
Restrictions, MassDownloader
from ..database.dbfunctions import read_events_from_db
from ..utils import ExceptionExit


def _check_fdsn_providers(fdsn_providers):
"""
Check if the user wants to use all known FDSN providers.
Exit if the user does not want to use any provider.
:param providers: list of FDSN providers or None
"""
if fdsn_providers is not None:
return
print(
'No FDSN providers set in config file. Do you want to use all '
'known providers? (y/N)', end=' '
)
while True:
answer = input().strip().lower()
if answer in ('y', 'yes'):
break
if answer in ('n', 'no', ''):
print('Exiting.')
sys.exit(0)
print('Please answer y or n:', end=' ')


def _download_waveforms(config, event):
"""
Download waveforms for a single event using ObsPy mass downloader.
:param config: config object
:param event: event object
"""
_check_fdsn_providers(config['fdsn_providers'])
evid = event['evid']
latitude = event['lat']
longitude = event['lon']
Expand Down

0 comments on commit 4b800e4

Please sign in to comment.