Skip to contents

Filters a record metadata table by any combination of RecordID, EventID, StationID, and OwnerID, then deduplicates to one row per record. Output is the canonical selection shape consumed by the readTS() family (readAT() / readVT() / readDT()) and writeSelection().

Usage

selectRecords(
  M,
  RecordID = NULL,
  EventID = NULL,
  StationID = NULL,
  OwnerID = NULL
)

Arguments

M

record metadata data.table.

RecordID

character. Filter by RecordID. Default NULL.

EventID

character. Filter by EventID. Default NULL.

StationID

character. Filter by StationID. Default NULL.

OwnerID

character. Filter by OwnerID. Default NULL.

Value

data.table(RecordID, OwnerID, EventID, StationID).

Details

Filter args are character vectors (length 1+). NULL means "no restriction on this dimension". With all NULL, returns every record in M – protect with explicit filters for non-trivial work.

For richer filters (magnitude, distance, intensity), filter M first and pass the subset:

selectRecords(M[EventMagnitude > 7 & Repi < 100 & PGA > 600 & DIR == "H1"])

Examples

master <- data.table::data.table(
  RecordID = c("R1", "R1", "R2"),
  OwnerID = c("AAA", "AAA", "BBB"),
  EventID = c("E1", "E1", "E2"),
  StationID = c("S1", "S1", "S2"),
  DIR = c("H1", "H2", "H1")
)
selectRecords(master, OwnerID = "AAA")
#>    RecordID OwnerID EventID StationID
#>      <char>  <char>  <char>    <char>
#> 1:       R1     AAA      E1        S1