View source: R/buildRawIntensityTable.R
| buildRawIntensityTable | R Documentation |
For each station with raw/AT.<RID>.csv / .json, calls
getRawIntensities() to compute the 20 AT-derivable scalars per
direction via getIntensity(). Emits one row per
(RecordID, DIR) - three rows per record.
buildRawIntensityTable(
path.records,
path.index,
owners = NULL,
incremental = TRUE,
force = FALSE
)
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 |
incremental |
Logical. If |
force |
Logical. If |
Schema:
RecordID, DIR, OCID, AI, AId, AIu, ARMS, ATn, ATo, AZC, CAV, CAV5, D0575, D0595, D2080, Dmax, EPI, Fs, NP, PDI, PGA, TmA, dt
All amplitude scalars are in TARGET_UNITS = "mm"-derived units
(mm/s2, mm/s, etc. per getIntensity() contract).
Invisibly, the per-owner row counts.
root <- file.path(tempdir(), "gmsp-raw-intensity-table-example")
index <- file.path(tempdir(), "gmsp-raw-intensity-table-index")
unlink(c(root, index), recursive = TRUE)
raw <- file.path(root, "AAA", "E1", "S1", "raw")
dir.create(raw, recursive = TRUE)
dir.create(index)
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
)
suppressMessages(buildRawIntensityTable(root, index, owners = "AAA",
incremental = FALSE))
data.table::fread(file.path(index, "RawIntensityTable.AAA.csv"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.