Example #1
0
    # settings to cut exactly 24 hours file from without including
    # previous/next day
    iday = "%s" % (day[4:6])
    imonth = "%s" % (day[2:4])
    print("imonth ==", imonth)
    iyear = "20%s" % (day[0:2])
    iiyear = int(iyear)
    print(iyear, imonth, iday)
    iimonth = int(imonth)
    iiday = int(iday)
    iihour = 23
    iimin = 59
    iisec = 0

    for itemp in range(t_start, t_stop):
        stt.clear()
        # open file containing detections
        fout = "%s.%s.cat" % (str(itemp), day[0:6])
        f = open(fout, "w+")
        print("itemp == ...", str(itemp))
        # open statistics file for each detection
        fout1 = "%s.%s.stats" % (str(itemp), day[0:6])
        f1 = open(fout1, "w+")
        # open file including magnitude information
        fout2 = "%s.%s.stats.mag" % (str(itemp), day[0:6])
        f2 = open(fout2, "w+")
        # open file listing exceptions
        fout3 = "%s.%s.except" % (str(itemp), day[0:6])
        f3 = open(fout3, "w+")

        ot = cat[itemp].origins[0].time
build_taup_model(tvel)

# generate list of days to process
year = int(dateperiod[0])
month = int(dateperiod[1])
day = int(dateperiod[2])
period = int(dateperiod[3])
days_from_par = listdays(year, month, day, period)
days = create_day_list(cat, days_from_par)

for ista in stations:

    for day in days:
        print("day == ", day)
        inpfiles = cont_dir + day + "." + ista + ".???"
        st.clear()

        for file in glob.glob(inpfiles):
            st += read(file)

        st.merge(method=1, fill_value=0)
        st.detrend("constant")
        st.filter("bandpass", freqmin=bandpass[0], freqmax=bandpass[1], zerophase=True)
        dataYY = int("20" + day[0:2])
        dataMM = int(day[2:4])
        dataDD = int(day[4:6])

        # to avoid errors in the input trim.par at stop_itemp
        if stop_itemp > ncat:
            stop_itemp = ncat