getEvent | R Documentation |
The getEvent
method obtains seismic event data from
the USGS NEIC event
webservice.
getEvent(obj, starttime, endtime, minmag, maxmag, magtype, mindepth, maxdepth)
obj |
an |
starttime |
POSIXct class limiting results to events occurring after starttime (GMT) |
endtime |
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) |
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.iris.edu", getEvent will point to obj@site
/fdsnws/event/1/. The event service must be able to output
format=text.
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 event webservice: 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 IRIS DMC webservices iris <- new("IrisClient") # Get events > mag 5.0 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)) if (inherits(result,"try-error")) { message(geterrmessage()) } else { # Look at all events print(paste(nrow(events),"earthquakes found with magnitude > 5.0")) # 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.