View source: R/getRawIntensities.R
| getRawIntensities | R Documentation |
Reads 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.
getRawIntensities(path)
path |
Absolute path to a station folder containing |
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).
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.