Description Usage Arguments Details Value Author(s) See Also Examples
Perform a query to IRIS-WS
1 2 3 4 5 6 7 | query.iris(iquery, filename = "iris.query.results", is.binary = FALSE,
check = TRUE, verbose = TRUE, ...)
iris.query(iquery, filename = "iris.query.results", is.binary = FALSE,
check = TRUE, verbose = TRUE, ...)
check.query(iquery)
|
iquery |
character; the web service query |
filename |
character; the file to save query results to.
If this is |
is.binary |
logical; will the output be binary? (e.g., |
check |
logical; should |
verbose |
logical; should messages be given by this function, and |
... |
additional arguments to |
This function uses curlPerform in the RCurl package
to query the IRIS WS.
Firstly, it
checks query
for internal consistency, with check.query;
then, query is checked externally with url.exists.
If query passes the checks, then it is sent to the IRIS WS
and successfull results are written to filename (which is instantiated
with CFILE).
iris.query is simply a pointer to query.iris
A list (invisibly) with the filename, the query string, and a success flag
AJ Barbour
Other Utilities: irisws-package,
irisws-queryconstruction,
irisws-timeutilities,
irisws-wadl
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 | ## Not run:
#
# irisws can be used to get timeseries, etc
# but there is also a fair amount invested in
# preventing failure because of bad args, etc
#
# This query will create ANMO.png (setting duration, but could also use end=2005.002T00:00:00)
# constructor2 assembles all the options for a given webservice into a query
Q <- constructor2(net="IU", sta="ANMO", loc="00", cha="BHZ", starttime="2005.001T00:00:00", duration="1000", output="plot")
# and this performs the query
query.iris(Q, "ANMO.png")
# again, but in a temporary file
query.iris(Q, NULL)
#... and in the default file
query.iris(Q)
#
# This query will fail, obviously (unless there's a seismic network named 'XXXTHISWILLFAILXXX')
Q <- constructor("net=XXXTHISWILLFAILXXX")
query.iris(Q)
# Arbitrary query generation
q1 <- params2queryparams(a=1, defaults=list(a=TRUE))
q2 <- params2queryparams(a=1, defaults=list(a=TRUE,b=2,c=NA))
q3 <- params2queryparams(a=1, defaults=list(a=TRUE,b=2,c=FALSE))
q4 <- params2queryparams(a=1, defaults=list(a=TRUE,b=2,c=FALSE), exclude.empty.options=FALSE)
q5 <- params2queryparams(a=1, defaults=list(a=TRUE,b=2,c=TRUE))
q6 <- params2queryparams(a=1, defaults=list(a=TRUE,b=2,c=FALSE,d=NA,e=""))
q7 <- params2queryparams(a=1, defaults=list(a=TRUE,b=2,c=FALSE,d=NA,e=""), exclude.empty.options = FALSE, exclude.null.fields = FALSE)
q1;q2;q3;q4;q5;q6;q7
# Arbitrary query validation
try(check.query(q1)) # succeeds
try(check.query(q2)) # fails
try(check.query(q3)) # succeeds
try(check.query(q4)) # fails
try(check.query(q5)) # fails
try(check.query(q6)) # fails
try(check.query(q7)) # fails
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.