[obspy-users] help to download data

Chen Gu guchch at mit.edu
Thu May 9 15:31:57 CEST 2019


Hi Gaelle,

import obspy
from obspy import UTCDateTime
from obspy.clients.fdsn import Client
client = Client("KNMI")
tstart = UTCDateTime(2017,8,31,0,0,0)
try:
        st=client.get_waveforms("NL", "G144", "*", "*",
                                  tstart, tstart+3600*24, attach_response=True,filename="G144/"+str(tstart)[0:10]+".mseed")
except:
        pass

Here is my code (modified from the obspy online tutorial), used for downloading one-year Groningen data. The mseed file will be saved to the file with name <filename>.

Chen

----------------------------------------------------
Chen Gu, Ph.D.
Postdoctoral Associate
Earth Resources Laboratory
Department of Earth, Atmospheric and Planetary Sciences
Massachusetts Institute of Technology
77 Mass Ave., 54-617
Cambridge, MA 02139
Telephone: 617-253-7278
Cell: 617-416-6058
Email: guchch at mit.edu<mailto:guchch at mit.edu>
Website: http://www.chenguatmit.com

On May 9, 2019, at 7:56 AM, gaelle vanessa Nana <vanessa.gaelle3 at gmail.com<mailto:vanessa.gaelle3 at gmail.com>> wrote:

hello,
 I use this python code to download data, but unfortunatelly, i cannot download. I need your help.


import obspy
from obspy.clients.fdsn.mass_downloader import RectangularDomain, \
    Restrictions, MassDownloader

# Rectangular domain containing parts of southern Germany.
domain = RectangularDomain(minlatitude=2, maxlatitude=12,
                           minlongitude=6, maxlongitude=16)

restrictions = Restrictions(
    # Get data for a whole year.
    starttime=obspy.UTCDateTime(2006, 1, 1),
    endtime=obspy.UTCDateTime(2007, 1, 1),
    # Chunk it to have one file per day.
    chunklength_in_sec=86400,
    # Considering the enormous amount of data associated with continuous
    # requests, you might want to limit the data based on SEED identifiers.
    # If the location code is specified, the location priority list is not
    # used; the same is true for the channel argument and priority list.
    network="XB", station="CM*", location="", channel="BH*",
    # The typical use case for such a data set are noise correlations where
    # gaps are dealt with at a later stage.
    reject_channels_with_gaps=False,
    # Same is true with the minimum length. All data might be useful.
    minimum_length=0.0,
    # Guard against the same station having different names.
    minimum_interstation_distance_in_m=100.0)

# Restrict the number of providers if you know which serve the desired
# data. If in doubt just don't specify - then all providers will be
# queried.
mdl = MassDownloader(providers=["IRIS" ])
mdl.download(domain, restrictions, mseed_storage="waveforms",
             stationxml_storage="stations")
_______________________________________________
obspy-users mailing list
obspy-users at lists.swapbytes.de<mailto:obspy-users at lists.swapbytes.de>
https://lists.swapbytes.de/mailman/listinfo/obspy-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.swapbytes.de/pipermail/obspy-users/attachments/20190509/e736a896/attachment.html>


More information about the obspy-users mailing list