### Summary

This metric reports the maximum gap size in seconds encountered within a 24-hour window calculated at query time. It determines gap size from time series coverage information stored in the rapidly-accessible IRIS SEED and PH5 archive database indexes (ts_index), as returned by the service.iris.edu/fdsnws/availability and service.iris.edu/ph5ws/availability web services.

In contrast, the standard MUSTANG max_gap metric retrieves and analyzes the archived time series in order to calculate gap size, which is a much slower process. Measurements for max_gap are calculated according to a schedule and updated regularly, but their values reflect the completeness of the archive when the measurement was made (lddate) rather than at query time.

The ts_max_gap metric is currently a prototype that will eventually replace the standard MUSTANG max_gap metric.

### Uses

Data gaps can indicate problems with data transmission configuration or performance, power cycling or other equipment down time, or data loss after transmission. The metric can also be used to cull data that is not continuous enough for certain research applications.

### Data Analyzed

**Traces** – one N.S.L.C (Network.Station.Location.Channel) per measurement

**Window** – 24 hours starting at 00:00:00 UTC

**Data Source** – IRIS miniSEED archive database time series index (ts_index)

**SEED Channel Types** –
All Time Series Channels

### Algorithm

- Request ts_index entries for 24 hours of a single N.S.L.C.
- Assume that missing data at the beginning of the day is a gap that begins at the day boundary and ends when the data begins.
- Assume that missing data at the end of the day is a gap that begins after the last data sample and ends at the day boundary.
- For x entries/data segments returned,
- Calculate the end time of each data segment:

endtime(x) = starttime(x) + ( (num_samples(x) - 1) / sample_rate)

- Calculate time between segments:

segdt(x) = endtime(x-1) – starttime(x)

- Calculate the gap size:

if ( segdt(x) > (1.5 / sample_rate) ) gap(x) = segdt(x) - 1 / sample_rate else gap(x) = 0

- Find the maximum gap length for this day:

max_gap(x) = max( (gap(x)>0), max_gap(x-1) )

- Calculate the end time of each data segment:

### Metric Values Returned

**value** – maximum daily gap length in seconds

**target** – the trace analyzed, labeled as N.S.L.C.Q (Network.Station.Location.Channel.Quality)

**start** – beginning of the data day requested (00:00:00 UTC)

**end** – end of the data day requested (truncated as 23:59:59 UTC)

**lddate** – local date/time the measurement was made

### Notes

Gap lengths currently are not measured across day boundaries. A gap crossing a day boundary is treated as two separate gaps for purposes of measuring maximum daily gap length.

If the user specified end date does not include hour:min:sec, then it defaults to 00:00:00.

If the requested start time is earlier than the metadata start time for the station-channel, the first 24-hour day returned will be 00:00:00-23:59:59 UTC for the day the metadata begins.

If the requested end time is later than the metadata end time for the station-channel, the last 24-hour day returned will be 00:00:00-23:59:59 UTC for the day the metadata ends.