Skip to contents

Scans <path.records>/<OwnerID>/<EventID>/<StationID>/raw/AT.*.json and emits one row per RecordID to <path.index>/RawRecordTable.<OwnerID>.csv.

Usage

buildRawRecordTable(path.records, path.index, owners = NULL)

Arguments

path.records

Absolute path to the records root. Required – no default.

path.index

Absolute path to the index root where per-owner CSVs are written. Required – no default.

owners

Character vector of OwnerIDs. NULL = scan all subdirs of path.records.

Value

Invisibly, the per-owner row counts.

Details

Schema:

RecordID, EventID, StationID, OwnerID, NP, Fs, pad

where NP = max(json$NP) (post-align) and pad = max(json$NP) - min(json$NP).

This table carries zero per-direction metadata: directional detail (PGA, AI, ARMS, ...) lives in RawIntensityTable.<Owner>.csv. The per-layer Raw* prefix leaves room for downstream processors to emit their own <ProcessID>RecordTable.<Owner>.csv.

Examples

root <- file.path(tempdir(), "gmsp-raw-record-example")
index <- file.path(tempdir(), "gmsp-raw-record-index")
unlink(c(root, index), recursive = TRUE)
raw <- file.path(root, "AAA", "E1", "S1", "raw")
dir.create(raw, recursive = TRUE)
dir.create(index)
jsonlite::write_json(
  list(RecordID = "R1", OwnerID = "AAA", EventID = "E1",
       StationID = "S1", NP = c(4, 4, 4), Fs = 100),
  file.path(raw, "AT.R1.json"), auto_unbox = TRUE
)
suppressMessages(buildRawRecordTable(root, index, owners = "AAA"))
data.table::fread(file.path(index, "RawRecordTable.AAA.csv"))
#>    RecordID EventID StationID OwnerID    NP    Fs   pad
#>      <char>  <char>    <char>  <char> <int> <int> <int>
#> 1:       R1      E1        S1     AAA     4   100     0