Description Usage Arguments Details Value Author(s) References See Also Examples
Constructs a query function
1 2 3 4 5 6 7 8 9 10 11 12 | constructor(..., service = c("timeseries", "distaz", "traveltime",
"flinnengdahl", "resp"), ws.version = c("1", "2"), query.field = "query?")
constructor2(...)
## Default S3 method:
constructor2(..., service = c("timeseries", "distaz",
"tt.deg", "tt.km", "tt.llpairs", "resp", "flinnengdahl"),
list.fields.only = FALSE, ws.version = "1")
params2queryparams(..., defaults, exclude.empty.options = TRUE,
exclude.null.fields = TRUE)
|
... |
query parameters.
For |
service |
character; the type of web service to construct for. |
ws.version |
character; corresponds to the documentation version (See [1]). |
query.field |
character; the user should not need to change this (it only exists to give the function wider applicability). |
list.fields.only |
logical; return names of default arguments |
defaults |
list; the parameters to merge |
exclude.empty.options |
logical; should the result not contain optional arguments which were not specified? |
exclude.null.fields |
logical; should |
These functions form correctly formatted queries for IRIS WS.
constructor
is a basic constructor which simply
collapses the arguments into a single query.
constructor2
also does this, but enforces
parameter inputs so the
query at least has a chance for success.
params2queryparams
is a function
to collapse arguments into a single query string
character string(s)
A.J. Barbour; and, see [2]
[1] http://service.iris.edu/irisws/
[2] http://pages.stern.nyu.edu/~dbackus/BCH/data/FRED/fredplot.R
was the motivation for params2queryparams
.
iris.query
to query IRIS WS
irisws-wadl
for using .wadl files
Other Utilities: irisws-package
,
irisws-timeutilities
,
irisws-wadl
, query.iris
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 | ## Not run:
# Basic construction:
constructor()
constructor("net=1","sta=2")
#
# parameter flattening
params2queryparams(net=1,sta=2)
params2queryparams(net=1,sta=NULL)
# this only adds parameters
params2queryparams(a=1, b=2, defaults=c(a=1, b=1,c=2))
# this adds mandatory/optional (TRUE/FALSE) parameters:
params2queryparams(a=1, b=2, defaults=c(a=TRUE, b=FALSE))
# missing optionals are excluded by default
params2queryparams(a=1, defaults=c(a=TRUE, b=FALSE, c=TRUE))
# include them:
params2queryparams(a=1, defaults=c(a=TRUE, b=FALSE, c=TRUE), exclude.empty.options=FALSE)
#
# Constrained construction:
Q <- constructor2(net=1, sta=2)
print(Q) # note the 'MISSING.MANDATORY' field values
# check that it's valid:
try(check.query(Q)) # it's not.
#
# Another... Distaz
# What needs to be given though??
constructor2(service="distaz", list.fields.only=TRUE)
# fill them in...
Q <- constructor2(stalat=45, stalon=-120, evtlat=30.0, evtlon=-100.0, service="distaz")
print(Q)
# check that it's valid:
try(check.query(Q)) # it is.
#
# 'endtime' is an optional default, by default, and also
not recognized if it is NULL
all.equal(constructor2(), constructor2(endtime=NULL))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.