spacepy.toolbox.tOverlapHalf

spacepy.toolbox.tOverlapHalf(ts1, ts2, presort=False)[source]

Find overlapping elements in two lists of datetime objects

This is one-half of tOverlap, i.e. it finds only occurrences where ts2 exists within the bounds of ts1, or the second element returned by tOverlap.

Parameters:
ts1list

first set of datetime object

ts2list

datatime object

presortbool
Set to use a faster algorithm which assumes ts1 and

ts2 are both sorted in ascending order. This speeds up the overlap comparison by about 50x, so it is worth sorting the list if one sort can be done for many calls to tOverlap

Returns:
outlist

indices of ts2 within interval of ts1

note: Returns empty list if no overlap found

See also

tOverlap
tCommon