GTITRIM Name
GTITRIM
Author
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov Purpose
Normalize a Good Time Interval (GTI) - no overlapping and adjoining
Calling Sequence
NEWGTI = GTITRIM(GTI, COUNT=, MAXGAP=, MINGTI=)
Description
A good time interval is by definition a list of intervals which
represent "good" or acceptable portions of the real number line.
In this library a GTI is a 2xNINTERVAL array where NINTERVAL is
the number of intervals.
The numbers in the array represent the start and stop times of
each interval. Thus, the array [[0,10],[20,30],[40,50]] represent
intervals ranging from 0-10, 20-30 and 40-50. Formally, this
example GTI represents times which would satisfy the following
expression, for each time T and interval number i:
T GE GTI(0,i) AND T LT GTI(1,i)
Note that the endpoint is closed on the left but open on the
right.
However, not every 2xNINTERVAL array is a valid or "normalized"
GTI as used by this library. The array must satisfy several
conditions:
* time ordered (ascending)
* no overlapping intervals
* no adjoining intervals (intervals that start and stop at the
same point; e.g. the point 10 in this array [[0,10],[10,20]])
A user who desires to create his or her own GTI array can proceed
as follows.
First, the array is placed in time order. This can be
accomplished simply using the built-in function SORT. This
statement sorts the array by start times.
GTI = GTI(*, SORT(GTI(0,*)))
Second, the GTITRIM function is used to fully normalize the set of
intervals:
GTI = GTITRIM(GTI)
After these two procedures the GTI is considered valid and can be
passed to the other routines of the library. Of course if the
user can guarantee the above requirements without using GTITRIM
then this is acceptable as well.
It should be noted that this function is not constrained to
operation only on time arrays. It should work on any
one-dimensional quantity with intervals.
Inputs
GTI - a 2xNINTERVAL array where NINTERVAL is the number of
intervals. GTI(*,i) represents the start and stop times of
interval number i. The intervals must be non-overlapping
and time-ordered (use GTITRIM to achieve this).
A scalar value of zero indicates that the GTI is empty, ie,
there are no good intervals.
Keywords
MAXGAP - Maximum allowable gap for merging existing good time
intervals. Intervals with gaps smaller than MAXGAP will
be combined into a single interval.
Default: 0 (any gap keeps intervals separate)
MINGTI - Minimum size interval. If any interval is smaller than
MINGTI then it is discarded.
Default: 0 (all intervals are preserved)
COUNT - upon return, the number of resulting intervals. A value
of zero indicates no good time intervals.
Returns
A new GTI array containing the normalized intervals. The array is
2xCOUNT where COUNT is the number of resulting intervals.
GTI(*,i) represents the start and stop times of interval number i.
The intervals are non-overlapping and time-ordered.
If COUNT is zero then the returned array is a scalar value of
zero, indicating no good intervals were found.
See Also
GTIMERGE
Modification History
Written, CM, 1997-2001
Documented, CM, Apr 2001
Corrected bug which bypassed MIN/MAXGTI, CM, 20 Jul 2003