timeseries: Access to the 'timeseries' Web Service for obtaining...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

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.

Usage

 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(), ...)

Arguments

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 enddate is not NULL.

endtime

character; the end of the record

output

character; the type of file to output to. See Details

filename

NA for an auto-generated filename based on the inputs; NULL for a temporary filename; or, a character string of the user's choosing. See Details for details about the auto-generated name.

endianness

character; specify the endianness of binary SAC output. 'auto' uses the platform value, or 'little' and 'big' can be used to force a specific structure.

load.results

logical; should the program try and load the file within R? Currently the following formats can be loaded: 'sac.bin', 'ascii', 'plot', 'ascii.values', 'sac.asc'

verbose

logical; should messages be given?

curl.verbose

logical; should messages from curlPerform be given?

opts

list; additional query parameters. Because constructor2 is used, any bogus options are ignored.

...

additional parameters to XXX

Details

The query is generated with constructor2, and executed with query.iris, which throws errors based on check.query.

Output format options (output=)

The SAC formats are read in through read.sac.

Filename options (filename=)

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.

Signal processing options

Value

A list (invisibly) with the query string, and data from the result

Author(s)

AJ Barbour

References

[1] http://service.iris.edu/irisws/timeseries/1/

[2] http://www.iris.edu/dms/nodes/dmc/data/formats/simple-ascii/

See Also

timestring to make properly formatted time strings

read.sac for SAC data reader

Other WebServices: distaz, flinnengdahl, irisws-webservices, resp, traveltime

Examples

 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)

abarbour/irisws documentation built on May 10, 2019, 4:07 a.m.