Compute KIND-derivable intensities for one raw record.
getRawIntensities.RdReads raw/<KIND>.<RID>.csv (WIDE provider OCID columns) plus
raw/<KIND>.<RID>.json, builds a long TSL with ID set to the
file's KIND (AT, VT, or DT), and calls getIntensity() to
compute the per-direction intensity scalars.
Value
Wide data.table with intensity columns
(e.g. RecordID, DIR, OCID, AI, AIu, AId, PGA, ARMS, AZC, ATo, ATn, D0595, D2080, D0575, TmA, CAV, CAV5, NP, dt, Fs, Dmax, EPI, PDI
for AT inputs).
Returns NULL if the station has no raw/<KIND>.<RID>.csv / .json.
Details
Output (WIDE): one row per (RecordID, DIR) with the KIND-derivable
intensity columns.
DIR (H1/H2/UP) is recovered from the JSON sidecar's explicit
DIR/OCID mapping. The CSV column names remain provider OCID
values such as HHE, HNZ, or L/T/V.
Assumes signal already in TARGET_UNITS = "mm" (per extractRecord).
Examples
station <- file.path(tempdir(), "gmsp-raw-intensity-example")
unlink(station, recursive = TRUE)
raw <- file.path(station, "raw")
dir.create(raw, recursive = TRUE)
t <- seq(0, 1, by = 0.01)
data.table::fwrite(
data.table::data.table(
H1 = sin(2 * pi * t),
H2 = 0.5 * cos(2 * pi * t),
UP = 0.25 * sin(4 * pi * t)
),
file.path(raw, "AT.R1.csv")
)
jsonlite::write_json(
list(RecordID = "R1", OwnerID = "AAA", EventID = "E1",
StationID = "S1", NetworkID = "NW",
DIR = c("H1", "H2", "UP"), OCID = c("H1", "H2", "UP"),
NP = rep(length(t), 3), dt = 0.01, Fs = 100, Units = "mm"),
file.path(raw, "AT.R1.json"), auto_unbox = TRUE
)
getRawIntensities(station)
#> RecordID DIR OCID AI AId AIu ARMS ATn ATo AZC CAV CAV5
#> <char> <char> <char> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1: R1 H1 H1 0 0 0 1 0 0 1 1 0
#> 2: R1 H2 H2 0 0 0 0 0 0 2 0 0
#> 3: R1 UP UP 0 0 0 0 0 0 3 0 0
#> D0575 D0595 D2080 Dmax EPI Fs NP PDI PGA TmA dt
#> <num> <num> <num> <num> <int> <int> <int> <int> <int> <num> <num>
#> 1: 0.6 0.7 0.6 1 0 100 101 0 1 0.5 0.01
#> 2: 0.8 1.0 0.8 1 0 100 101 0 0 0.5 0.01
#> 3: 0.7 0.8 0.7 1 0 100 101 0 0 0.3 0.01