# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")
# Date of Nisqually quake
starttime <- as.POSIXct("2001-02-28",tz="GMT")
endtime <- starttime + 2*24*3600
# Use getEvent web service to retrieve events in this time period
result <- try(events <- getEvent(iris,starttime,endtime,6.0))
if (inherits(result,"try-error")) {
message(geterrmessage())
} else {
events
# biggest event is Nisqually
eIndex <- which(events$magnitude == max(events$magnitude))
e <- events[eIndex[1],]
# Find all BHZ channels collecting data at the time of the quake and within
# 5 degrees of the quake epicenter
result <- try(channels <- getAvailability(iris,"*","*","*","BHZ",starttime,endtime,
lat=e$latitude,long=e$longitude,maxradius=5))
if (inherits(result,"try-error")) {
message(geterrmessage())
} else {
channels
}
}
Run the code above in your browser using DataLab