| getEvent | R Documentation |
The getEvent method obtains seismic event data from
the USGS NEIC event webservice or other FDSN event webservice.
getEvent(obj, starttime, endtime, minmag, maxmag, magtype,
mindepth, maxdepth, ...)
obj |
an |
starttime |
optional POSIXct class limiting results to events occurring after starttime (GMT) |
endtime |
optional POSIXct class limiting results to events occurring before endtime (GMT) |
minmag |
optional minimum magnitude |
maxmag |
optional maximum magnitude |
magtype |
optional magnitude type |
mindepth |
optional minimum depth (km) |
maxdepth |
optional maximum depth (km) |
... |
optional other arguments |
The getEvent method uses the event web service to obtain data for all
events that meet the criteria defined by the arguments and returns that data in
a dataframe. Each row of the dataframe represents a unique event.
getEvent calls to the IRIS event webservice now go to
https://earthquake.usgs.gov/fdsnws/event/1/. If obj@site is
something other than "https://service.earthscope.org", getEvent will point to
obj@site/fdsnws/event/1/. The event service must be able to output
format=text.
The USGS NEIC event service defaults to 'NOW - 30 days' if starttime is not provided. It defaults to 'present time' if endtime is not provided.
The optional other arguments are any other parameters accepted by the event web service being used. A full list of available parameters for the USGS NEIC event service can be found at: https://earthquake.usgs.gov/fdsnws/event/1/
A dataframe with the following columns:
eventId ,time, latitude, longitude, depth, author, cCatalog, contributor, contributorId, magType, magnitude, magAuthor, eventLocationName
Rows are ordered by time.
NOTE: column names are identical to the names returned from the event web service with the exception of "latitude" for "lat" and "longitude" for "lon". The longer names are used for internal consistency – all other web services return columns named "latitude" and "longitude".
Jonathan Callahan jonathan@mazamascience.com
The USGS NEIC event web service: https://earthquake.usgs.gov/fdsnws/event/1/
IrisClient-class,
## Not run:
# NOTE: 'maps' and 'mapdata' packages must be installed
#require(maps)
#require(mapdata)
# Open a connection to EarthScope webservices
iris <- new("IrisClient")
# Get events > mag 5.0 with a minimum depth of 20km over a week in June of 2012
starttime <- as.POSIXct("2012-06-21", tz="GMT")
endtime <- starttime + 3600 * 24 * 7
result <- try(events <- getEvent(iris, starttime, endtime, minmag=5.0, mindepth=20))
if (inherits(result,"try-error")) {
message(geterrmessage())
} else {
# Look at all events
print(paste(nrow(events),"earthquakes found with magnitude > 5.0 and depth >= 20 km"))
# Plot events on a map
#map('world')
#points(events$longitude, events$latitude, pch=16, cex=1.5, col='red')
#labels <- paste(" ", as.character(round(events$magnitude,1)), sep="")
#text(events$longitude, events$latitude, labels=labels, pos=4, cex=1.2, col='red3')
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.