from HinetPy import Client, win32
from datetime import datetime
client = Client("UserName", "Password")

startdates = [line.rstrip('\n') for line in open('days.txt')]
for startdate in startdates:
	print(startdate)
	client.get_arrivaltime(startdate, 1)



예제 #2
0
from datetime import datetime, timedelta
import time
from HinetPy import Client, win32
import os
from obspy import read

sDate = datetime(2012, 2, 1) + timedelta(days=0)  #days=30+100+30-400)
count = 200  # how many days

spanDays = 1  #365*8
client = Client("***", "***")  #username passwd
filename = "event_lst"
client.get_arrivaltime(sDate, spanDays, filename=filename)

eventDir = 'eventDir/'
eventDir2 = 'event/'

while count > 0:
    try:
        cmd = "rm -r " + eventDir + "/D*"
        os.system(cmd)
        count = count - 1
        sDate = sDate + timedelta(days=1)
        client.get_arrivaltime(sDate, spanDays, filename=filename)
        ### set requirement
        client.get_event_waveform(sDate.strftime("%Y-%m-%d %H:%M:%S"),\
            (sDate+timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S"),minmagnitude=-1, maxmagnitude=9.9,\
            include_unknown_mag=True,minlatitude=30, maxlatitude=50, minlongitude=125,\
            maxlongitude=150)
        cmd = "mv  D* " + eventDir
        os.system(cmd)