Skip to contents

Flags each row with the FIRST applicable reason from a fixed precedence: lat/lon NA, lat/lon out of range, depth negative, Repi above outlier threshold, Rhyp < Repi (geometric impossibility). Rows with no issue are dropped from the output.

Usage

auditDistances(DT, repiOutlier = 5000)

Arguments

DT

master data.table.

repiOutlier

threshold in km above which Repi is flagged (default 5000).

Value

data.table of flagged rows with column Reason.

Details

Does NOT read record.json or provider flatfiles. Comparison against raw/flatfile distances is deferred to v2.

Examples

x <- data.table::data.table(
  EventLatitude = c(0, 95),
  EventLongitude = c(0, 0),
  StationLatitude = c(0.1, 0.1),
  StationLongitude = c(0.1, 0.1),
  EventDepth = c(10, 10),
  Repi = c(15, 20),
  Rhyp = c(18, 25)
)
auditDistances(x)
#>    EventLatitude EventLongitude StationLatitude StationLongitude EventDepth
#>            <num>          <num>           <num>            <num>      <num>
#> 1:            95              0             0.1              0.1         10
#>     Repi  Rhyp      Reason
#>    <num> <num>      <char>
#> 1:    20    25 eventLatOOR