Learn R Programming

sos4R (version 0.4.2)

getData: This function queries a SOS v2.0 for time series data

Description

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

Usage

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

Run this code
# NOT RUN {
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])
# }

Run the code above in your browser using DataLab