Skip to contents

Reads <path>/<OwnerID>/<EventID>/<StationID>/raw.owner/ according to the owner's format and returns LONG (t, OCID, s). NPTS divergence between components is not enforced.

Usage

parseRecord(.x, path)

Arguments

.x

data.table subset of master for ONE record (same OwnerID, EventID, StationID).

path

Absolute path to the records root. The function expects per-station files under <path>/<OwnerID>/<EventID>/<StationID>/raw.owner/. Required – no default.

Value

LONG data.table(t, OCID, s).

Details

Quantity (ID = "AT"|"VT"|"DT") is NOT set here.

Examples

root <- file.path(tempdir(), "gmsp-parse-example")
unlink(root, recursive = TRUE)
raw <- file.path(root, "ESM", "E1", "S1", "raw.owner")
dir.create(raw, recursive = TRUE)
writeLines(c("0 1", "0.01 2", "0.02 3"), file.path(raw, "N_acc.txt"))
writeLines(c("0 2", "0.01 3", "0.02 4"), file.path(raw, "E_acc.txt"))
writeLines(c("0 0", "0.01 1", "0.02 0"), file.path(raw, "Z_acc.txt"))
rows <- data.table::data.table(
  OwnerID = "ESM", EventID = "E1", StationID = "S1",
  FileID = c("N_acc.txt", "E_acc.txt", "Z_acc.txt")
)
parseRecord(rows, path = root)
#>        t   OCID     s
#>    <num> <char> <int>
#> 1:  0.00      N     1
#> 2:  0.01      N     2
#> 3:  0.02      N     3
#> 4:  0.00      E     2
#> 5:  0.01      E     3
#> 6:  0.02      E     4
#> 7:  0.00      Z     0
#> 8:  0.01      Z     1
#> 9:  0.02      Z     0