mapComponents: Map provider components to canonical processed components.

View source: R/mapComponents.R

mapComponentsR Documentation

Map provider components to canonical processed components.

Description

Classifies a single three-component record, preserves provider channel names in OCID, and records canonical processed directions in DIR (H1, H2, UP). This helper is for processed products; raw extraction continues to preserve provider OCID values.

Usage

mapComponents(DT, rotate = TRUE, output = c("long", "wide"))

Arguments

DT

LONG data.table(t, OCID, s) or WIDE ⁠data.table(t, <OCID1>, <OCID2>, <OCID3>)⁠ for ONE record.

rotate

Logical scalar. If TRUE, rotate the two horizontal components to their principal axes and store attr(out, "theta").

output

"long" (default) returns provider OCID, canonical DIR, and signal s; "wide" returns data.table(t, H1, H2, UP).

Value

A data.table in the requested output shape, or NULL when the record cannot be mapped. Both shapes carry attr(out, "componentMap") and attr(out, "rotate"); rotated outputs also carry attr(out, "theta").

See Also

extractRecord()

Examples

t <- seq(0, 1, by = 0.1)
x <- data.table::rbindlist(list(
  data.table::data.table(t = t, OCID = "N", s = sin(2 * pi * t)),
  data.table::data.table(t = t, OCID = "E", s = 0.5 * cos(2 * pi * t)),
  data.table::data.table(t = t, OCID = "Z", s = 0.1 * sin(2 * pi * t))
))
mapped <- mapComponents(x, rotate = FALSE)
head(mapped)


gmsp documentation built on July 18, 2026, 5:07 p.m.