GetValues: GetValues

Description Usage Arguments Value Examples

View source: R/GetValues.R

Description

This function gets the time series data values from the WaterML web service

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
GetValues(
  server,
  siteCode = NULL,
  variableCode = NULL,
  startDate = NULL,
  endDate = NULL,
  methodID = NULL,
  sourceID = NULL,
  qcID = NULL,
  daily = NULL
)

Arguments

server

The URL of the web service, for example: http://worldwater.byu.edu/interactive/rushvalley/services/index.php/cuahsi_1_1.asmx?WSDL. This can be also a custom REST URL or the file name of the WaterML file.

siteCode

The site code. To get a list of available site codes, see GetSites() function and use the FullSiteCode field.

variableCode

The variable code. To get a list of possible variable codes, see GetVariables() function and use the FullVariableCode field

startDate

(optional) The start date in "yyyy-mm-dd" format

endDate

(optional) The end date in "yyyy-mm-dd" format

methodID

(optional) The ID of the observation method. To get a list of possible method IDs, see methodID column in the output of GetSiteInfo(). If methodID is not specified, then the observations in the output data.frame won't be filtered by method.

sourceID

(optional) The ID of the source. To get a list of possible source IDs, see sourceID column in the output of GetSiteInfo(). If sourceID is not specified, then the observations in the output data.frame won't be filtered by source.

qcID

(optional) The ID of the quality control level. Typically 0 is used for raw data and 1 is used for quality controlled data. To get a list of possible quality control level IDs, see QualityControlLevelID column in the output of GetSiteInfo(). If qcID is not specified, then the observations in the output data.frame won't be filtered by quality control level.

daily

(optional) If you set daily="max", daily="min" or daily="mean", then the data values are aggreagted to daily time step.

Value

a data.frame of data values with the following columns:

The output data.frame also has attributes with information about the status: download.time, parse.time, download.status, parse.status These attributes can be used for troubleshooting WaterOneFlow/WaterML server errors. If parse status is "NO_VALUES_FOUND", then this time series doesn't have any available data for the selected time period.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#example 1: Get Values from a known site and variable from Ipswich River server.
server <- "http://hydroportal.cuahsi.org/ipswich/cuahsi_1_1.asmx?WSDL"
v1 <- GetValues(server, site="IRWA:FB-BV", variable="IRWA:DO",
                startDate="1999-01-01", endDate="1999-12-31")
#example 2: Get values from an external REST URL (in this case the Provo USGS NWIS site id 10163000)
url <- "http://waterservices.usgs.gov/nwis/dv/?format=waterml,1.1&sites=10163000&parameterCd=00060"
v2 <- GetValues(url)
#example 3: Get values from WaterML 2.0 file and show year, month, day
url2 <- "http://www.waterml2.org/KiWIS-WML2-Example.wml"
waterml2_data <- GetValues(url2)
waterml2_data$year <- strftime(waterml2_data$time, "%Y")
waterml2_data$month <- strftime(waterml2_data$time, "%M")
waterml2_data$day <- strftime(waterml2_data$time, "%d")

WaterML documentation built on April 10, 2021, 9:05 a.m.