dnb: Search Neighbours in Time and Space Within Specified Ranges
Description
A brute force neighbor search implementation to identify observed data points within a given distance around location and time interval.
Usage
dnb(query, obs, th, future=TRUE)
Value
A vector, row numbers in the observed data matrix, that are within the given distance threshold and time lag of the query location.
Arguments
query
a vector; the x, y coordinates and the time stamp of the query point
obs
a matrix; the x, y coordinates and time stamps of the spatiotemporal locations
th
a vector; the distance threshold and time lag
future
logical, whether include observed spatiotemporal points future in time relative to the query spatiotemporal location.
Author
Dong Liang (dliang@umces.edu)
Details
Implementation involves first calculating the time lags between query point and observed data (with locational coordinates and time); for observed locations within time lag of query, the function calculates the Euclidean distances between query location and all potential neighbors and select those within specified distance threshold.
The future argument can be used to exclude data in the future in neighbor search. This is useful in an extrapolation application.