pyacs.gts.lib.offset module

Offset detection and correction for Gts time series.

This package distributes the former single-module offset functionality into separate modules. All public Gts methods are re-exported here for backward compatibility.

Use:

import pyacs.gts.lib.offset
Gts.apply_offsets = pyacs.gts.lib.offset.apply_offsets
# or
from pyacs.gts.lib.offset import apply_offsets, find_offsets
pyacs.gts.lib.offset.apply_offsets(self, np_offset, opposite=False, in_place=False, verbose=False)[source]

Apply given offsets to the time series.

Parameters:
  • np_offset (numpy.ndarray or list) – 1D or 2D array (or list of lists): offset_dates, north, east, up, s_north, s_east, s_up.

  • opposite (bool, optional) – If True, apply opposite of offsets. Default is False.

  • in_place (bool, optional) – If True, modify self; else return new Gts. Default is False.

  • verbose (bool, optional) – Verbose mode. Default is False.

Returns:

self (if in_place) or new Gts.

Return type:

Gts

pyacs.gts.lib.offset.delete_small_offsets(self, offsets, del_by_pricise=False)[source]

Estimate offsets with clean data, then remove offsets that are too small.

Parameters:
  • offsets (list) – List of offset dates (decimal year).

  • del_by_pricise (bool, optional) – If True, also require offset > sigma. Default is False.

Returns:

Filtered list of offset dates, or None.

Return type:

list or None

pyacs.gts.lib.offset.estimate_local_offset(self, window_length=4, in_place=False)[source]

Estimate local offset amplitudes using window_length positions before and after each offset.

Returns:

New Gts (or self if in_place) with offsets_values set.

Return type:

Gts

pyacs.gts.lib.offset.find_offsets(self, threshold=3, n_max_offsets=9, conf_level=95, lcomponent='NE', verbose=True, in_place=False)[source]

Simple empirical procedure to find offsets.

Parameters:
  • threshold (float, optional) – Threshold for preliminary offset detection. Default is 3.

  • n_max_offsets (int, optional) – Maximum number of offsets to detect. Default is 9.

  • conf_level (float, optional) – Confidence level (percent) to accept offset. Default is 95.

  • lcomponent (str, optional) – Components for detection (‘N’,’E’,’U’). Default is ‘NE’.

  • verbose (bool, optional) – Verbose mode. Default is True.

  • in_place (bool, optional) – If True, modify self. Default is False.

Returns:

New Gts (or self if in_place) with offsets_dates and outliers set.

Return type:

Gts

pyacs.gts.lib.offset.find_offsets_ivel(self, ivelts=None, lcomponent='EN', threshold_offset=100, offsets_file=None)[source]

Find offsets using l1trend filtering and instantaneous velocity

parameters:

ivelts: Sgts

ivel time series

lcomponent: string

component to use for the analysis

threshold_offset: float

threshold for the offset in mm/yr

offsets_file: string

name of the file to append the offsets. If None, no file is written

notes:

The function uses the l1trend of the time series. It then detects large ivel values and check whether they last for more than one day. If so, an offset is estimated by integrating ivel over two successive dates and offset is applied to the time series. Format of offsets_file is: code date (datetime.isoformat()) lon lat offset_e offset_n offset_u std_offset_e std_offset_n std_offset_u comment

pyacs.gts.lib.offset.find_offsets_t_scan(self, threshold=0.8, window=250, in_place=False, lcomponent='NE', verbose=True, debug=True)[source]

Find suspected offsets using t-scan step detection.

pyacs.gts.lib.offset.find_time_offsets(self, option=None, ndays=7, th_detection_rms=3, th_detection_offset=3)[source]

Find the time of suspected offsets by RMS time series calculated over ndays.

pyacs.gts.lib.offset.local_offset_robust(self, date, n, verbose=False, debug=False)[source]

Estimate a local offset (no velocity) with a robust method.

Parameters:
  • date (float) – Offset date in decimal year.

  • n (int) – Number of dates before/after used in estimation.

  • verbose (bool, optional) – Verbose mode. Default is False.

  • debug (bool, optional) – Debug output. Default is False.

Returns:

1D array [date, north, east, up, s_north, s_east, s_up].

Return type:

numpy.ndarray

pyacs.gts.lib.offset.suspect_offsets(self, threshold=3, verbose=True, lcomponent='NE', n_max_offsets=10, in_place=False)[source]

Try to find offsets in a time series from day-to-day differences.

pyacs.gts.lib.offset.suspect_offsets_mf(self, threshold=3, verbose=True, lcomponent='NE', n_max_offsets=5, in_place=False, debug=False)[source]

Try to find offsets in a time series using a median filter.

pyacs.gts.lib.offset.test_offset_significance(self, date, conf_level=95, lcomponent='NE', verbose=True, debug=False, mode='local')[source]

Test whether an offset is statistically significant.

Parameters:
  • date (float) – Offset date in decimal year.

  • conf_level (float, optional) – Confidence level in percent. Default is 95.

  • lcomponent (str, optional) – Components to test (‘N’,’E’,’U’). Default is ‘NE’.

  • verbose (bool, optional) – Verbose mode. Default is True.

  • debug (bool, optional) – Debug output. Default is False.

  • mode (str, optional) – ‘local’, ‘detrend’, or ‘detrend_seasonal’. Default is ‘local’.

Returns:

True if significant, else False.

Return type:

bool

pyacs.gts.lib.offset.test_offsets(self, verbose=False, debug=True, window_length=None)[source]

Test offsets: delete small, F-ratio test, re-check small offsets.