For given sites and phenomena, a SOS is queried and the data returned as data.frame.

getData(sos, phenomena, sites, spatialBBox = NA, begin = NA, end = NA, ...)

Arguments

sos

An SOS object from a call to SOS containing the URL of a SOS v2.0.

phenomena

A list, vector or one-column data.frame with characters identifying the relevant phenomena.

sites

A list, vector or one-column data.frame with characters identifying the relevant sites.

spatialBBox

A 2-by-2 matrix with x and y in the rows and min and max in the columns. See Spatial-class for details. If sites is set, this argument is ignored.

begin

Object of class POSIXt. Note that creating timestamps with as.POSIXct(..) will use your local timezone.

end

Object of class POSIXt. Note that creating timestamps with as.POSIXct(..) will use your local timezone.

...

Named arguments forwarded to other wrapper functions internally.

Value

A data.frame containing the data in long form where each row contains a siteID, the time stamp of the observation and the observed measurements for each phenomenon in a separate column. The measurements are provided with units using units.

Examples

if (FALSE) { mySos <- SOS(url = "https://climate-sos.niwa.co.nz/", binding = "KVP", useDCPs = FALSE, version = "2.0.0") observationData <- getData(sos = mySos, phenomena = phenomena[18,1], sites = siteList[1:2,1]) }