pyacs.gts.lib.primitive package

Submodules

pyacs.gts.lib.primitive.add_obs module

pyacs.gts.lib.primitive.add_obs.add_obs(self, date, NEUSNSESUCNECNUCEU, in_place=False, check=True, verbose=False)[source]

Adds observation(s) as DN,DE,DU to a time series

Parameters
  • date – date in decimal year. float, a list or 1D numpy array

  • NEUSNSESUCNECNUCEU – value to be added in the Gts, provided as a list, a 1D numpy array or a 2D numpy array. requires at least NEU: North, East, UP values optional: SN, SE, SU, CNE, CNU, CEU: standard deviations and correlation coefficient between North, East and Up components. If not provided, SN=SE=SU=0.001 (1 mm) and CNE=CNU=CEU=0

  • in_place – boolean, if True add_obs to the current Gts, if False, returns a new Gts

  • check – check time order and duplicate dates

  • verbose – verbose mode

Returns

new Gts or the modified Gts if in_place

Note

if it exists, .data_xyz will be set to None for consistency.

pyacs.gts.lib.primitive.add_obs_xyz module

pyacs.gts.lib.primitive.add_obs_xyz.add_obs_xyz(self, date, XYZSXSYSZCXYCXZCYZ, in_place=False, check=True, neu=True, verbose=False)[source]

Adds observation(s) as XYZ to a time series

Parameters
  • date – date in decimal year. float, a list or 1D numpy array

  • XYZSXSYSZCXYCXZCYZ – value to be added in the Gts, provided as a list, a 1D numpy array or a 2D numpy array. requires at least X,Y,Z. Optional: SX, SY, SZ, CXY, CXZ, CYZ: standard deviations and correlation coefficients. If not provided, SX=SY=SZ=0.001 (1 mm) and CXY=CXZ=CYZ=0

  • in_place – boolean, if True add_obs to the current Gts, if False, returns a new Gts

  • check – check time order , duplicate dates and re-generate NEU time series (.data)

  • neu – regenerate .data from the updated .data_xyz

  • verbose – verbose mode

:return : new Gts or the modified Gts if in_place :note 1: by default .data will be updated from .data_xyz, and X0,Y0,Z0 will be updated. :note 2:

pyacs.gts.lib.primitive.add_offsets_dates module

pyacs.gts.lib.primitive.add_offsets_dates.add_offsets_dates(self, offsets_dates, in_place=False)[source]

add_offsets_dates to a time series if in_place = True then replace the current time series

pyacs.gts.lib.primitive.cdata module

pyacs.gts.lib.primitive.cdata.cdata(self, data=False, data_xyz=False, tol=0.001, verbose=False)[source]

Check data/data_xyz attributes

Parameters
  • data – boolean, if True, data attribute will be checked

  • data_xyz – boolean, if True, data_xyz attribute will be checked

  • tol – tolerance in days for two dates to be considered as the same (default 0.001 of day)

  • verbose – boolean, verbose mode

:return : boolean, True if everything is OK, False otherwise

:note : in future, this routine should also whether .data and .data_xyz value are consistent

pyacs.gts.lib.primitive.copy module

pyacs.gts.lib.primitive.copy.copy(self, data=True, data_xyz=True, loutliers=True)[source]

makes a (deep) copy of the time series.

By default, all attributes are also copied, including .data, .data_xyz, loutliers etc.

Default behaviour can be modified for the following attribute:

Parameters
  • data – can be set to None or a 2D numpy array of shape (n,10)

  • data_xyz – can be set to None or a 2D numpy array of shape (n,10)

  • loutliers – False will not copy the loutliers atrribute

pyacs.gts.lib.primitive.correct_duplicated_dates module

pyacs.gts.lib.primitive.correct_duplicated_dates.correct_duplicated_dates(self, action='correct', tol=0.1, in_place=False, verbose=False)[source]

Check or remove duplicated dates in a time series

Parameters
  • action – ‘correct’ (default) or ‘check’

  • tol – tolerance for two dates to be considered as the same (default = 0.1 day)

  • in_place – boolean, if True,

  • verbose – verbose mode

pyacs.gts.lib.primitive.decimate module

pyacs.gts.lib.primitive.decimate.decimate(self, time_step=30.0, dates=[], method='median', verbose=False)[source]

decimate a time series

Parameters
  • time_step – time step in days

  • dates – list of dates where point are forced to be written regardless time_step

  • method – method used to be used to calculated the position. choose among [‘median’,’mean’,’exact’]

  • verbose – verbose mode

:return : new Gts

pyacs.gts.lib.primitive.differentiate module

pyacs.gts.lib.primitive.differentiate.differentiate(self)[source]

differentiate the current time series :return: the differentiated time series as a new Gts object :note : differentiation is made on .data. .data_xyz is set to None.

pyacs.gts.lib.primitive.displacement module

pyacs.gts.lib.primitive.displacement.displacement(self, sdate=None, edate=None, window=None, method='median', speriod=[], eperiod=[], rounding='day', verbose=True)[source]

Calculates displacements between two dates or two periods

Parameters
  • sdate – start date in decimal year

  • edate – start date in decimal year

  • window – time window in days for searching available dates

  • method – method to calculate the position. ‘median’ or ‘mean’. default is ‘median’.

  • speriod – period for calculating the start position

  • eperiod – period for calculating the end position

  • rounding – rounding for dates. Choose among ‘day’,’hour’,’minute’ or ‘second’. default is ‘day’.

  • verbose – verbose mode

Returns

displacement as np.array([dn,de,du,sdn,sde,sdu])

pyacs.gts.lib.primitive.exclude_periods module

pyacs.gts.lib.primitive.exclude_periods.exclude_periods(self, lperiod, in_place=False, verbose=False)[source]

exclude periods of a Gts

Parameters
  • lperiod – a list [start_date,end_date] or a list of periods e.g. periods=[[2000.1,2003.5],[2009.3,2010.8]]

  • in_place – if True, will make change in place, if False, return s a new time series

Note 1

X0,Y0,Z0 attributes will be changed if necessary

Note 2

handles both .data and .data_xyz

pyacs.gts.lib.primitive.extract_dates module

pyacs.gts.lib.primitive.extract_dates.extract_dates(self, dates, tol=0.05, in_place=False, verbose=True)[source]

Returns a time series extracted for a given list of dates

Parameters
  • dates – dates either as a list or 1D numpy array of decimal dates

  • tol – date tolerance in days to assert that two dates are equal (default 0.05 day)

  • in_place – if True, will make change in place, if False, return s a new time series

  • verbose – boolean, verbose mode

pyacs.gts.lib.primitive.extract_ndates_after_date module

pyacs.gts.lib.primitive.extract_ndates_after_date.extract_ndates_after_date(self, date, n, verbose=False)[source]

Extract n values after a given date If n values are not available, returns all available values after date .data is set to None if no value at all is available

Parameters
  • date – date in decimal year

  • n – number of observations to be extracted

Returns

a new Gts

pyacs.gts.lib.primitive.extract_ndates_around_date module

pyacs.gts.lib.primitive.extract_ndates_around_date.extract_ndates_around_date(self, date, n)[source]

Extract n values before and n values after a given date If n values are not available, returns all available values .data is set to None if no value at all is available

Parameters
  • date – date in decimal year

  • n – number of observations to be extracted

Returns

a new Gts

pyacs.gts.lib.primitive.extract_ndates_before_date module

pyacs.gts.lib.primitive.extract_ndates_before_date.extract_ndates_before_date(self, date, n, verbose=False)[source]

Extract n values before a given date If n values are not available, returns all available values before date .data is set to None if no value at all is available

Parameters
  • date – date in decimal year

  • n – number of observations to be extracted

Returns

a new Gts

pyacs.gts.lib.primitive.extract_periods module

pyacs.gts.lib.primitive.extract_periods.extract_periods(self, lperiod, in_place=False, verbose=False, no_reset=False)[source]

extract periods of a Gts

Parameters
  • lperiod – a list [start_date,end_date] or a list of periods e.g. periods=[[2000.1,2003.5],[2009.3,2010.8]]

  • in_place – if True, will make change in place, if False, return s a new time series

Note 1

X0,Y0,Z0 attributes will be changed if necessary

Note 2

handles both .data and .data_xyz

pyacs.gts.lib.primitive.find_large_uncertainty module

pyacs.gts.lib.primitive.find_large_uncertainty.find_large_uncertainty(self, sigma_thresold=10, verbose=True, lcomponent='NE')[source]

Find dates with large uncertainty and flag them as outliers.

Parameters
  • sigma_threshold – value (mm) for a date to be flagged.

  • verbose – verbose mode

  • lcomponent – list of components to be checked. default = ‘NE’

pyacs.gts.lib.primitive.get_coseismic module

pyacs.gts.lib.primitive.get_coseismic.get_coseismic(self, eq_date, window_days=5, sample_after=1, method='median', in_place=False)[source]

Get coseismic displacement at a given date. Coseismic displacement is estimated as the position difference between the median of window_days before the earthquake date and the median of sample_after samples after the earthquake date.

note: only median method implemented

pyacs.gts.lib.primitive.insert_gts_data module

pyacs.gts.lib.primitive.insert_gts_data.insert_gts_data(self, gts, in_place=False, verbose=False)[source]

insert data (and/or) .data_xyz of a gts into the current gts

Parameters
  • gts – time series to be inserted

  • in_place – boolean, if True add_obs to the current Gts, if False, returns a new Gts

  • verbose – verbose mode

:return : new Gts or the modified Gts if in_place

pyacs.gts.lib.primitive.interpolate module

pyacs.gts.lib.primitive.interpolate.interpolate(self, date='day', kind='linear', gap=10, in_place=False, verbose=False)[source]
Parameters
  • self – Gts instance

  • date – ‘day’ will perform daily interpolation, alternatively date is a 1D numpy array with either datetime or decimal year

  • method – scipy.interpolate.interp1d kind argument

  • gap – maximum gap for interpolation

  • in_place – boolean.

  • verbose – verbose mode

Returns

pyacs.gts.lib.primitive.neu2xyz module

pyacs.gts.lib.primitive.neu2xyz.neu2xyz(self, corr=False, verbose=False)[source]

populates .data_xyz from .data requires X0,Y0,Z0 attributes to be set

Parameters
  • corr – if True, then standard deviation and correlations will also be calculated

  • verbose – verbose mode

pyacs.gts.lib.primitive.remove_velocity module

pyacs.gts.lib.primitive.remove_velocity.remove_velocity(self, vel_neu, in_place=False)[source]

remove velocity from a time series vel_neu is a 1D array of any arbitrary length, but with the velocities (NEU) to be removed in the first 3 columns if in_place = True then replace the current time series

pyacs.gts.lib.primitive.reorder module

pyacs.gts.lib.primitive.reorder.reorder(self, verbose=False)[source]

reorder data and/or data_xyz by increasing dates always in place

Parameters

verbose – verbose mode

pyacs.gts.lib.primitive.rotate module

pyacs.gts.lib.primitive.rotate.rotate(self, angle, in_place=False)[source]

rotates the axis by an angle

Parameters

angle – angle in decimal degrees clockwise

if in_place = True then replace the current time series

pyacs.gts.lib.primitive.set_zero_at_date module

pyacs.gts.lib.primitive.set_zero_at_date.set_zero_at_date(self, date, offset=None, in_place=False)[source]

make a translation of a time series, setting to 0 at a given date if the provided date does not exist, uses the next date available

Parameters
  • date – date in decimal year

  • offset – an offset (in mm) to be added. Could be a float, a list or 1D numpy array with 3 elements

pyacs.gts.lib.primitive.split_gap module

pyacs.gts.lib.primitive.split_gap.split_gap(self, gap=10, verbose=False)[source]
Parameters
  • gap – gap in number of days to split the time series

  • verbose – verbose mode

Returns

a list a gts split from the original

pyacs.gts.lib.primitive.substract_ts module

pyacs.gts.lib.primitive.substract_ts.substract_ts(self, ts, tol=0.05, verbose=True)[source]

substract the ts provided as argument to the current time series

Parameters
  • ts – time series to be substracted as a Gts instance

  • tol – date tolerance to decide whether two dates are identical in both time series. default = 1/4 day

  • verbose – verbose mode

:return : new Gts

pyacs.gts.lib.primitive.substract_ts_daily module

pyacs.gts.lib.primitive.substract_ts_daily.substract_ts_daily(self, ts, verbose=True)[source]

substract the ts provided as argument to the current time series

Parameters
  • ts – time series to be substracted as a Gts instance

  • verbose – verbose mode

:return : new Gts

Note

this method assumes daily time series

pyacs.gts.lib.primitive.xyz2neu module

pyacs.gts.lib.primitive.xyz2neu.xyz2neu(self, corr=False, ref_xyz=None, verbose=False)[source]

populates neu (data) using xyz (data_xyz) lon, lat and h will also be set.

Parameters
  • corr – if True, then standard deviation and correlations will also be calculated

  • ref_xyz – [X,Y,Z] corresponding to the 0 of the local NEU frame. If not provided, the first position is used as a reference

  • verbose – verbose mode

Note

this method is always in place

Module contents