Description Usage Arguments Details Value Author(s) References See Also Examples
From [1]: The ws-timeseries service provides access to individual channels of time series data for a specified time range. Requested segments may be up to 30 days in length and optional signal processing may be applied to return data. The time series may be returned in a variety of formats.
1 2 3 4 5 6 7 8 9 10 11 | ws.timeseries(network, station, location, channel, starttime, duration,
endtime = NULL, output = c("sac.bin", "ascii", "plot", "ascii.values",
"sac.asc", "miniseed", "audio"), filename = NA, endianness = c("auto",
"little", "big"), load.results = TRUE, verbose = TRUE,
curl.verbose = FALSE, opts = list(), ...)
timeseries.ws(network, station, location, channel, starttime, duration,
endtime = NULL, output = c("sac.bin", "ascii", "plot", "ascii.values",
"sac.asc", "miniseed", "audio"), filename = NA, endianness = c("auto",
"little", "big"), load.results = TRUE, verbose = TRUE,
curl.verbose = FALSE, opts = list(), ...)
|
network |
character; the network code |
station |
character; the station code |
location |
character; the location code |
channel |
character; the channel code |
starttime |
character; the beginning of the record |
duration |
numeric; the length of the record, in seconds. This will
be ignored if |
endtime |
character; the end of the record |
output |
character; the type of file to output to. See Details |
filename |
|
endianness |
character; specify the endianness of binary SAC output.
|
load.results |
logical; should the program try and load the file within R?
Currently the following formats can be loaded:
|
verbose |
logical; should messages be given? |
curl.verbose |
logical; should messages from |
opts |
list; additional query parameters.
Because |
... |
additional parameters to XXX |
The query is generated with constructor2
,
and executed with query.iris
, which throws
errors based on check.query
.
output=
)'miniseed'
: miniSEED
'sac.asc'
: SAC Alpha (ASCII)
'sac.bin'
: SAC binary (either big or little endian)
'audio'
: Audio (WAV format)
'plot'
: PNG plot
'ascii.values'
: ASCII (values only)
'ascii'
: ASCII (values, and datetimes)
The SAC formats are read in through read.sac
.
filename=
)NA
: An auto-generated file.
NULL
: A temporary file.
<character string>: Any desired name.
Autogenerated files are of the form:
iriswsQ.<network>.<station>.<location>.<channel>.<starttime>.<end>.<extension>
where end
is either 'endtime
', or '<duration>s
'
and extension
will depend on output
.
Temporary files are generated within query.iris
.
high, low and band-pass filter ()
remove mean value ()
scaling by constant value ()
deconvolution of instrument response (with frequency limits and unit conversion) ()
differentiation and integration ()
decimation to lower sample rates ()
A list (invisibly) with the query string, and data from the result
AJ Barbour
[1] http://service.iris.edu/irisws/timeseries/1/
[2] http://www.iris.edu/dms/nodes/dmc/data/formats/simple-ascii/
timestring
to make properly formatted time strings
read.sac
for SAC data reader
Other WebServices: distaz
,
flinnengdahl
,
irisws-webservices
, resp
,
traveltime
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ## Not run:
#
# El Mayor Cucapah earthquake (M7.2 April 4, 2010)
#
net <- "PB"
sta <- "B084"
loc <- "--"
cha <- "LDD" # pore fluid pressure
elmayor <- "2010.094T22:00:00.000000" # or "2010-04-04T00:00:00"
dur <- 7200
ws.timeseries(net, sta, loc, cha, elmayor, dur, output="plot")
#
# or use the string builder
elmayor <- timestring(2010,94,22,0,0)
ws.timeseries(net, sta, loc, cha, elmayor, dur, output="plot")
sacd <- ws.timeseries(net, sta, loc, cha, elmayor, dur, output="sac.bin")
print(str(sacd))
plot(ts(sacd$querydata$amp, deltat=sacd$querydata$dt))
#
#
# SAC FORMAT: ASCII
xa <- ws.timeseries(net, sta, loc, cha, elmayor, dur, output="sac.asc")
# SAC binary
xb <- ws.timeseries(net, sta, loc, cha, elmayor, dur, output="sac.bin")
plot(xa$querydata$amp)
lines(xb$querydata$amp, col="red")
#
#
# REGULAR ASCII
# ascii with a datetime string and values
# (the datetime string is converted to POSIXlt with lubridate)
xa <- ws.timeseries(net, sta, loc, cha, elmayor, dur, output="ascii")
plot(xa$querydata, type="s")
#
# ASCII, again, but only values are returned (and metadata)
xa <- ws.timeseries(net, sta, loc, cha, elmayor, dur, output="ascii.values")
dat <- xa$querydata$value
plot(dat, type="s")
#
# we can use the header metadata to align in time
hdr <- attr(xa$querydata,"header")
require(lubridate)
tst <- ymd_hms(hdr[7])
npt <- as.numeric(hdr[3])
sps <- as.numeric(hdr[5])
datDatetime <- seq(from=tst, to=(tst+npt*sps), length.out=npt)
plot(datDatetime, dat, type="s")
#
#
# PNG plot
require(png)
xp <- ws.timeseries(net, sta, loc, cha, elmayor, dur, output="plot")
plot(1:2)
rasterImage(xa$querydata, 1, 1, 2, 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.