Skip to contents

Thin wrapper around readTS(); see there for full semantics.

Usage

readVT(.x, path)

Arguments

.x

data.table with columns RecordID, OwnerID, EventID, StationID (one row per record). Output of selectRecords().

path

Records root, either relative to the working directory or absolute. The function reads per-station files under <path>/<OwnerID>/<EventID>/<StationID>/raw/. Required – no default.

Value

See readTS().

Examples

root <- file.path(tempdir(), "gmsp-readvt-example")
unlink(root, recursive = TRUE)
raw <- file.path(root, "AAA", "E1", "S1", "raw")
dir.create(raw, recursive = TRUE)
data.table::fwrite(data.table::data.table(H1 = c(1, 2)),
                   file.path(raw, "VT.R1.csv"))
jsonlite::write_json(list(dt = 0.01), file.path(raw, "VT.R1.json"),
                     auto_unbox = TRUE)
selection <- data.table::data.table(
  RecordID = "R1", OwnerID = "AAA", EventID = "E1", StationID = "S1"
)
readVT(selection, path = root)
#>    RecordID OwnerID EventID StationID     t    H1
#>      <char>  <char>  <char>    <char> <num> <int>
#> 1:       R1     AAA      E1        S1  0.00     1
#> 2:       R1     AAA      E1        S1  0.01     2