2024 Noto Japan Earthquake Data Download Issue

# Import third-party libraries
from pathlib import Path
from obspy.clients.fdsn import Client
from obspy import read_events, UTCDateTime
from obspy.clients.fdsn.mass_downloader import CircularDomain, Restrictions, MassDownloader

event_bool = True

if event_bool:
    dataCenter="IRIS"
    client = Client(dataCenter)
    starttime = UTCDateTime("2024-01-01T00:00:00")  # time of the M 7.5 earthquake
    endtime = UTCDateTime("2024-01-01T23:59:59")
    catalog = client.get_events(starttime=starttime, endtime=endtime,
                        minmagnitude=7, maxmagnitude=8,  # filter for events with magnitude around 7.5
                        minlatitude=36, maxlatitude=38,  # approximate latitude range for the Pacific Ocean near Japan
                        minlongitude=136, maxlongitude=138)  # approximate longitude range for the Pacific Ocean near Japan
    catalog.write("quakes.xml", format="QUAKEML")

dataCenter="IRIS" 

# Time before and after event origin for waveform segments
time_before = 60
time_after = 300
download_bool = True

catalog = read_events("quakes.xml")
for event in catalog:
    evid = str(catalog[0].origins[0].resource_id).split("=")[-1] # User origin resource id as the event id
    outdir = evid
    Path(outdir).mkdir(parents=True,exist_ok=True)
    
    # Event origin
    origin_time = event.preferred_origin().time
    starttime = origin_time - time_before
    endtime = origin_time + time_after
    
    # Event location
    evlo = event.preferred_origin().longitude
    evla = event.preferred_origin().latitude
    depth = event.preferred_origin().depth # in meters
    
    # Set the search area
    domain = CircularDomain(latitude=evla, longitude=evlo, minradius=1, maxradius=200)
    
    # Set the search period and additional criteria
    restrictions = Restrictions(starttime=starttime, endtime=endtime,
        reject_channels_with_gaps=True,
        minimum_length=0.95,
        network="BK",
        channel_priorities=["BH[ZNE12]", "HH[ZNE12]"],
        sanitize=True)
    
    # Save catalog info to file
    event_out = (
        "{evid:s},{origin:s},{jdate:s},"
        "{lon:.4f},{lat:.4f},{depth:.4f},"
        "{mag:.2f},{auth:s}\n"
        )        

    if event.preferred_magnitude() is None:
        mag = -999.
        magtype = "ml"
    else:
        mag = event.preferred_magnitude().mag
        magtype = event.preferred_magnitude().magnitude_type.lower()
    if event.preferred_origin().extra.catalog.value is None:
        auth = "unknown"
    else:
        auth = event.preferred_origin().extra.catalog.value.replace(" ","")
        
    event_out = event_out.format(
        evid=evid,
        origin=str(origin_time),
        jdate="%s%s"%(origin_time.year,origin_time.julday),
        lon=evlo,
        lat=evla,
        depth=depth/1E3,
        mag=mag,
        auth=auth
        )
        
    outfile = "datetime.csv"
    with open(outfile,"w") as f:
        f.write("evid,origin,jdate,lon,lat,depth,%s,auth\n"%magtype)
        f.write(event_out)
        
    # Dowanload waveforms and metadata
    if download_bool:
        mseed_storage = "%s/waveforms"%outdir
        stationxml_storage = "%s/stations"%outdir
        mdl = MassDownloader(providers=[dataCenter])
        mdl_helper = mdl.download(domain, restrictions,
            mseed_storage=mseed_storage,stationxml_storage=stationxml_storage)
        print("%s download completed"%outdir)
        
        
    print("%s is DONE."%outdir)

output

[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,556] - obspy.clients.fdsn.mass_downloader - INFO: Initializing FDSN client(s) for IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,577] - obspy.clients.fdsn.mass_downloader - INFO: Successfully initialized 1 client(s): IRIS.
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,595] - obspy.clients.fdsn.mass_downloader - INFO: Total acquired or preexisting stations: 0
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:08,606] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Requesting reliable availability.
[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,237] - obspy.clients.fdsn.mass_downloader - ERROR: Client 'IRIS' - Failed getting availability: Bad request. If you think your request was valid please contact the developers.
HTTP Status code: 400
Detailed response of server:


[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,247] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - No data available.
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,254] - obspy.clients.fdsn.mass_downloader - INFO: ============================== Final report
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,263] - obspy.clients.fdsn.mass_downloader - INFO: 0 MiniSEED files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,273] - obspy.clients.fdsn.mass_downloader - INFO: 0 StationXML files [0.0 MB] already existed.
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,285] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 MiniSEED files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,294] - obspy.clients.fdsn.mass_downloader - INFO: Client 'IRIS' - Acquired 0 StationXML files [0.0 MB].
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.
[2024-04-21 13:21:09,299] - obspy.clients.fdsn.mass_downloader - INFO: Downloaded 0.0 MB in total.