geodezyx.time_series package

Submodules

geodezyx.time_series.ts_class module

Created on Fri Aug 2 13:55:33 2019

@author: psakicki

class geodezyx.time_series.ts_class.Attitude(R=0, P=0, Y=0, T=0, sR=0, sP=0, sY=0, devID='NULL', angtype='deg')

Bases: object

Qcalc()
RPYget()
RPYset(R=0, P=0, Y=0, sR=0, sP=0, sY=0)
Tset(T=0)
class geodezyx.time_series.ts_class.Point(A=0.0, B=0.0, C=0.0, T=0.0, initype='XYZ', sA=0.0, sB=0.0, sC=0.0, name='noname')

Bases: object

ENUcalc_pt(refENU)
ENUset(E=nan, N=nan, U=nan, sE=nan, sN=nan, sU=nan)
FLHset(F=0, L=0, H=0, sF=0, sL=0, sH=0)
NEDset(N=nan, E=nan, D=nan, sN=nan, sE=nan, sD=nan)
Tset(T=0)
UTMcalc_pt(ellips='wgs84')
UTMset(Eutm=nan, Nutm=nan, Uutm=nan, sEutm=nan, sNutm=nan, sUutm=nan)
XYZset(X=0, Y=0, Z=0, sX=0, sY=0, sZ=0)
add_offset(dA, dB, dC)
helmert_trans(params='itrf2008_2_etrf2000', invert=False)
keysanex()
velocity_trans(vx, vy, vz, epoc_init='auto', epoc_end='auto')

auto == epoc of the measures

class geodezyx.time_series.ts_class.TimeSerieObs(typeobs='NULL', filepath='')

Bases: object

LES DIFFERENCES AVEC TSPOINT * Les objets ne contiennent qu’un type de données sous une seul forme (a la difference d’un point qui peut exister sous plusieurs formes) * Dans un fichier en input, il peut y avoir plusieurs “devices”

=> les fonctions de lectures produisent donc obligatoirement des listes de TS (le cas échéant une liste à 1 élt) => la methode readfile() nécessite donc l’indice de la device

add_obs(inObs)
aleaobs()
del_data()
enddate()
interp_get(T)
interp_set(interptype='slinear')
interval_nominal()
meta_set(path='', devID='NULL', name='')
plot(diapt=10, alpha=0.8, fig=1, new_style=True)
readfile(filein, indtab=0)
startdate()
timewin(windows, mode='keep')

IL EST TRES DANGEREUX DE L’APPLIQUER UN FENETRAGE A SOI MEME

to_list()
class geodezyx.time_series.ts_class.TimeSeriePoint(stat='STAT')

Bases: object

ENUcalc(refENU)

Method to determine the ENU components based on a reference point

Parameters:

refENU (Point Object or TimeSeriePoint Object) – Reference point.

Return type:

None.

ENUcalc_from_first_posi()

Method to determine the ENU components based directly on the mean/median position

Return type:

None.

ENUcalc_from_mean_posi(mean_type='median')

Method to determine the ENU components based directly on the mean/median position

Return type:

None.

UTMcalc()

Method to determine the UTM E and N projected coordinates

Return type:

None.

add_offset(dA, dB, dC)

NOTE 160415 : add_offset as method are hazardous … use fct add_offset_ts instead

add_point(inPoint)

Method to add a Point in the TimeSerie Object

Parameters:

inPoint (Point Object) –

Return type:

None.

aleapt()

Method to get a random Point in the TimeSeries

Return type:

Point Object

decimate(dec)

Method to decimate a TimeSerie

Parameters:

dec (int) – keep 1/dec point in the TimeSerie.

Return type:

None.

del_data()

Method to purge the data in the TimeSeriePoint

Return type:

None.

discont_manu_click(fig=1)

manual discontinuities are both recorded in the “main” discont list and in a new discont_manu list, thus the manual discontinuites can be identified

IMPORTANTcursor objects (multi , cid)

must be stored as global variables like this : multi , cid = tsout.discont_manu_click()

NOTEThis method was created before point_n_click_plot():

this other one is more complete both has to be merged ASAP !!!!!

enddate()

Method to get the last epoch of the data in the TimeSerie

Return type:

DateTime

find_point(tin, tol=0.001, stop_when_found=True)

Method to find a specific point according to its timestamp

Parameters:
  • tin (float or datetime) – timestamp of the researched point.

  • tol (float, optional) – tolerence of the research. The default is 0.001.

  • stop_when_found (bool, optional) – Stop the research when a point is found. The default is True.

Returns:

  • Point Object – Point Found.

  • int or list of int – index of the point.

from_list(T, A, B, C, coortype='XYZ', sA=[], sB=[], sC=[])

Method to load data from lists to the TimeSerie

Parameters:
  • T (float) – Time.

  • A (list of float) – X, F (latitude), E..

  • B (list of float) – Y, L (longitude), N.

  • C (list of float) – Z, H (hight), U.

  • coortype (str, optional) – The coordinates type. The default is ‘XYZ’.

  • sA (list of float, optional) – sigma of A component. The default is [].

  • sB (list of float, optional) – sigma of B component. The default is [].

  • sC (list of float, optional) – sigma of C component. The default is [].

Return type:

None.

from_uniq_point(Point, startdate, enddate, pas=1)
initype()
interp_get(T, coortype='ENU')

Method to get the coordinate interpolators

Parameters:
  • T (float or list of float) – Time (IN POSIX Time) where the interpolation is wished.

  • coortype (str, optional) – The coordinates type. The default is ‘ENU’.

Returns:

DESCRIPTION.

Return type:

tsout

interp_set(interptype='slinear')

Method to set the coordinate interpolators

Parameters:

interptype (TYPE, optional) – Interpolation type. The default is ‘slinear’.

Return type:

None.

interval_nominal()

Method to get the nominal internal between two epochs.

Returns:

interval nominal.

Return type:

float

len_period(output_seconds=False)

Method to get the period length

Return type:

timedelta or

mean_posi(coortype='XYZ', outtype='point', mean_type='median')

Method to determine the mean position of the TimeSerie

Parameters:
  • coortype (TYPE, optional) – The coordinates type. The default is ‘XYZ’.

  • outtype (TYPE, optional) – ‘point’ or ‘tuple’. The default is ‘point’.

  • mean_type (TYPE, optional) – ‘mean’ or ‘median’. The default is ‘median’.

Return type:

Point or coordinates tuple

meta_set(path='', stat='STAT', name='')

Set meta data about the TimeSerie

Parameters:
  • path (str, optional) – file path. The default is ‘’.

  • stat (str, optional) – station 4-char. code. The default is ‘STAT’.

  • name (str, optional) – free name of for the TS, like the experience, the periode , the software … The default is ‘’.

Return type:

None.

property nbpts

Method to have the length of the TimeSerie

Returns:

Length of the TimeSerie.

Return type:

int

plot(coortype='ENU', diapt=2, alpha=0.8, fig=1, errbar=True, new_style=True, symbol='.', errbar_width=1)

Plot data in a TimeSerie Object

Parameters:
  • coortype (str, optional) – The coordinates type. The default is ‘ENU’.

  • diapt (float, optional) – Point diamaeter. The default is 2.

  • alpha (float, optional) – Alpha (transparency) of points. The default is 0.8.

  • fig (int or Figure object, optional) – Figure ID where the data will be plotted can accept a int (id of a Figure) OR the figure Object itself. The default is 1.

  • errbar (bool, optional) – Plot the error bars. The default is True.

  • new_style (bool, optional) – Plot in a new style. The old style is only kept for legacy The default is True.

  • symbol (str, optional) – symbol. The default is ‘.’.

  • errbar_width (TYPE, optional) – coefficient for the error bar size. The default is 1.

Return type:

The matplotlib Figure object.

plot_discont(fig=1)

Plot discontinuties of a TimeSerie Object contained in discont list

Parameters:

fig (int or Figure object, optional) – Figure ID where the data will be plotted can accept a int (id of a Figure) OR the figure Object itself. The default is 1.

Return type:

None.

readfile(filein)

Method to read the data form a file Should be used with care

Parameters:

filein (str) – path of the file.

Return type:

None.

remove_duplicate_pts(coortype='XYZ')
set_discont(indiscont)

Method to set the discontinuties list

Parameters:

indiscont (list of time) – Discontinuities in the TimeSerie.

Return type:

None.

sort()

Internal method to sort the point in the TimeSerie Object

Return type:

None.

startdate()

Method to get the first epoch of the data in the TimeSerie

Return type:

DateTime

time_win(windows, mode='keep')

IL EST TRES DANGEREUX DE L’APPLIQUER UN FENETRAGE A SOI MEME

to_dataframe(coortype='XYZ')

Export the TimeSerie Object as DataFrame

Parameters:

coortype (str or iterable of str.) – The coordinates type exported to the DataFrame. ‘XYZ’, ‘FLH’, ‘ENU’, ‘NED’ can be also an iterable like (‘XYZ’,’FLH’) The default is ‘XYZ’.

Returns:

DF – output DataFrame.

Return type:

DataFrame

to_list(coortype='XYZ', specific_output=None, time_as_datetime=False)

Export the TimeSerie Object as Lists (Numpy Arrays)

Parameters:
  • coortype (str, optional) –

  • list. (The coordinates type exported to the) –

  • 'XYZ'. (The default is) –

  • specific_output (int, optional) – ask for a specific list, ranges between 0 and 6. The default is None.

  • time_as_datetime (bool, optional) – if True the Time list is exported in datetime if False the Time list is exported in Posix time

Returns:

A,B,C,T,sA,sB,sC – A = X, F (latitude), E. B = Y, L (longitude), N. C = Z, H (hight), U. T = Time sA = sigma of A component sB = sigma of B component sC = sigma of C component

Return type:

lists

class geodezyx.time_series.ts_class.point_n_click_plot

Bases: object

This method allow to do “point and click” on a plot, to localize offsets for instance

Usage

Data have to be ploted already in a figure

PnC = point_n_click_plot()
multi , cid = PnC(fig=1,Xdata_are_time=True)
PnC.selectedX

i.e.

Create an object point_n_click_plot (here it is PnC in the exemple below)

Call the object like a function with as 1st argument the id of the plot figure or the plot figure itself

Make your selection using the SPACE key

Get your results in a list called PnC.selectedX

Important

cursor objects (i.e. multi & cid) must be stored as global variables when you call the method like this :

multi , cid = PnC(fig=1)

geodezyx.time_series.ts_export module

Created on Fri May 12 15:56:33 2023

@author: psakicki

geodezyx.time_series.ts_export.export_ts(ts, outdir, coordtype='ENU', outprefix='', write_header=False)

export the timeserie

write_header not well implemented !!!

geodezyx.time_series.ts_export.export_ts_as_hector_enu(tsin, outdir, outprefix, coordtype='ENU')

export to a HECTOR .enu (and not .neu !) compatible format This format is simpler : just gives MJD E N U

This format is necessary to force a sampling period.

outfile will be writed in /outdir/outprefixSTAT.enu

geodezyx.time_series.ts_export.export_ts_as_midas_tenu(tsin, outdir, outprefix, coordtype='ENU', export_step=True)

export to a MIDAS .tneu compatible format

outfile will be writed in /outdir/outprefixSTAT.tneu

if export_step == True: export a step file as /outdir/outprefixSTAT.step

geodezyx.time_series.ts_export.export_ts_as_neu(tsin, outdir, outprefix, coordtype='ENU')

export to a HECTOR .neu compatible format

outfile will be writed in /outdir/outprefixSTAT.neu

NB: The XYZ mode is quite dirty (191001)

geodezyx.time_series.ts_export.export_ts_as_pbo_pos(tsin, outdir, outprefix='', force=None, force_1st_pt_as_ref=True, verbose=False)

Write a time series in GAMIT/GLOBK PBO pos format

Parameters:
  • idir – output directory

  • outprefix – if not blank then the output pos file will be CODE_add_key.pos, CODE.pos otherwise.

  • force – set force to ‘data’ or ‘data_xyz’ to force pos to be written from .data or .data_xyz

:note1:default behaviour (force = None)

if data and data_xyz are not None, then print them independently if there are data only, then uses X0,Y0,Z0 to write data_xyz if there are data_xyz only, recreate data and write it

geodezyx.time_series.ts_export.export_ts_figure_pdf(fig, export_path, filename, close=False)

fig can accept a int (id of a Figure) OR the figure Object itself

geodezyx.time_series.ts_export.export_ts_plot(tsin, export_path, coortype='ENU', export_type=('pdf', 'png'), plot_B=False, close_fig_after_export=True)

Very beta … to be implemented : merge w/ the export_figure_pdf fct

geodezyx.time_series.ts_fcts module

Created on Fri Aug 2 17:38:41 2019

@author: psakicki

geodezyx.time_series.ts_fcts.add_offset_point(ptin, dA, dB, dC, coortype='ENU')

ONLY IMPLEMENTED FOR ENU FOR THE MOMENT 150415 : remark still necessary ???

coortype == ‘UXYZ’ :

specific case where we correct an Up offset directly in the XYZ coords very usefull for an antenna offset in for a moving GPS (but works only for the up)

geodezyx.time_series.ts_fcts.add_offset_smart_for_GINS_kine(tsin, tslist_offset_3ple, list_windows, coortype='XYZ')

tslist_offset_3ple : list of len N containing (dX,dY,dZ) offsets list_windows : list of len N-1 containing dates of changes

geodezyx.time_series.ts_fcts.add_offset_ts(tsin, dA, dB, dC, coortype='ENU')

return a copy of the tsin (tsin won’t be affected)

coortype == ‘UXYZ’ :

specific case where we correct an Up offset directly in the XYZ coords very usefull for an antenna offset in for a moving GPS (but works only for the up)

geodezyx.time_series.ts_fcts.baselines_calc(ts_list, plani_only=False, substract_offset=<function median>, symetric_calc=False, symetric_storage=True)
Parameters:
  • ts_list (list) – list of TimeSeries.

  • plani_only (bool, optional) – If True, compute the baseline varation on the East and North component only. The default is False.

  • substract_offset (function or None, optional) – A function to substract the offset. Can be np.mean (substract the mean value), np.median (substract the median value), or lambda x: x[0] (substract the 1st value) The default is np.median.

  • symetric_calc (bool, optional) – If True, compute the baseline variation 2 times, for stat1 > stat2 and stat2 > stat1 Might be useful to compare planimetic computation The default is False.

  • symetric_storage (bool, optional) – If True, store the baseline variation 2 times, dictstore[stat1][stat2] and dictstore[stat2][stat1] symetric_calc overrides this option The default is True.

Returns:

dictstore – A dictionnary of dictionnaries of Pandas Series, containing the baseline variations e.g. dictstore[stat1][stat2] = bl_series

Return type:

dict

geodezyx.time_series.ts_fcts.bool_cleaner(tsin, boollist, verbose=False)

A partir d’une liste de bool de meme longeur que le nbre de points on ne conserve que les points True

geodezyx.time_series.ts_fcts.compar(tstup, coortype='ENU', seuil=3.0, win=[], mode='keep', Dtype='2D3D', namest=0, namend=10, alpha=0.8, diapt=5, verbose=True, print_report=True, plot=True, interp=True)

si seuil == 0, pas de nettoyage

On preconise compar en mode keep : Ainsi le Tref est strictement cantonné aux bonnes valeurs des Ti En mode del, les Ti sont extrapolé aux valeur de Tref => nan => pbs pour la mad

if 2D3D /3D2D : selectionne 2D ou 3D (selon) en prioritaire pour dD mais détermine 2D et 3D et les introduit dans des clés adhoc dD2D dD3D ‘’’

geodezyx.time_series.ts_fcts.compar2(tstup, coortype='ENU', seuil=3.0, win=[], mode='keep', Dtype='3D', namest=0, namend=10, alpha=5, diapt=5, verbose=True, print_report=True, plot=True)

160903 cette fonction semble discontinuée

geodezyx.time_series.ts_fcts.compar_elts_in_ts(ts1, ts2)

ts2 must contains less elts than ts1 (ts2 = cleaned one)

geodezyx.time_series.ts_fcts.compar_plot(dico_list_in, namest=0, namend=10, alpha=0.8, diapt=1.5, new_style=True, colormap='gnuplot')
geodezyx.time_series.ts_fcts.decimate_cleaner(tsin, minval, in_place=False)

in_place DOES’NT WORK !!!

geodezyx.time_series.ts_fcts.decimate_cleaner_2(tsin, N, in_place=False)

keep a value every N vals

geodezyx.time_series.ts_fcts.detrend_ts(tsin, coortype='ENU', t_origin=None)
geodezyx.time_series.ts_fcts.dist_btwn_2pts(ptA, ptB, coortype='XYZ')
geodezyx.time_series.ts_fcts.dist_diff_btwn_2pts(ptA, ptB)
geodezyx.time_series.ts_fcts.find_pts_from_ts_with_time(tin, tstupin, tol=0.001)
geodezyx.time_series.ts_fcts.helmert_trans(tsin, params='itrf2008_2_etrf2000', invert=False)
geodezyx.time_series.ts_fcts.interpolator_light(T, X, Y, Z)
geodezyx.time_series.ts_fcts.interpolator_with_extrapolated(T, X, Y, Z)
geodezyx.time_series.ts_fcts.linear_regress_find_coeff(tsin, coortype='ENU')
geodezyx.time_series.ts_fcts.linear_regress_ts(tsin, coortype='ENU', titledetails='')

doit être cablé ASAP linear_regress_find_coeff

geodezyx.time_series.ts_fcts.linear_regress_ts_discont(tsin, coortype='ENU')
geodezyx.time_series.ts_fcts.mad_cleaner(tsin, seuil=3.5, method='dist', coortype='ABC', detrend_first=False, output_detrended=False, verbose=False)
methodmethode d’élimination :

dist : on élimine les point qu sont trop loin en distance de la posi de ref indep : on traite les point independaments

dist est a privilégier

output_detrended ne marche que si detrend_first est activé

geodezyx.time_series.ts_fcts.mean_list_of_pts(ptslisin)

useful for merge fct ONLY IMPLEMENTED FOR ENU coords for the moment

geodezyx.time_series.ts_fcts.mean_posi_multi(tstup)
geodezyx.time_series.ts_fcts.merge(tsin, N)

merge N points in one

geodezyx.time_series.ts_fcts.merge_ts(ts_list_in)

Merge several TimeSeriePoint into one

Parameters:

ts_list_in (list of TimeSeriePoint) – list of TimeSeriePoint.

Returns:

ts_out – merged TimeSeriePoint.

Return type:

TimeSeriePoint

geodezyx.time_series.ts_fcts.print4compar(dA, dB, dC, dD, coortype)
geodezyx.time_series.ts_fcts.print4compar_tabular(dicolist, split=0, print_2D3D_if_any=True)
geodezyx.time_series.ts_fcts.refENU_for_tslist(tslist_in, tsref_marker=0)

tsref_marker : indice of the reference time serie OR the ‘all’ keyword in this case all the time series mean position will be averaged

geodezyx.time_series.ts_fcts.retrend_ts(tsin, a_coef, b_coef, coortype='ENU', t_origin=None)

a_coefs,b_coefs = 3-tuple/list for the 3 component a_coef = m/s

geodezyx.time_series.ts_fcts.rotate_points_class(tsattin, ptslin, Rtype='R1', xyzreftuple=([1, 0, 0], [0, 1, 0], [0, 0, 1]), angtype='deg')
geodezyx.time_series.ts_fcts.rotate_pt_cls_solo(tsattin, pointin, Rtype='R1', xyzreftuple=([1, 0, 0], [0, 1, 0], [0, 0, 1]), angtype='deg')
ENTREEtsattinune TS d’attitude (N angles)

pointin : UN Point en entrée

SORTIE : une TSpoint de N points

geodezyx.time_series.ts_fcts.round_time(tsin, round_to, mode='round')
geodezyx.time_series.ts_fcts.sigma_cleaner(tsin, seuil=3, coortype='ABC', cleantype='any', verbose=False)
geodezyx.time_series.ts_fcts.std_dev_cleaner(tsin, stddev_threshold, coortype='ABC', cleantype='any', verbose=False)

A rebooted (1807) version of sigma_cleaner just remove values in a timeserie with a high sigma/std deviation

geodezyx.time_series.ts_fcts.time_gap(tsin, marge=2, mode='del')

ENTREE une TimeSerie SORTIE une window (liste de listes)

geodezyx.time_series.ts_fcts.time_win(tsin, windows, mode='keep', outbool=False)
geodezyx.time_series.ts_fcts.time_win_T(Tin, win, mode='del')
geodezyx.time_series.ts_fcts.time_win_multi(inplis)
geodezyx.time_series.ts_fcts.ts_from_list(A, B, C, T, initype, sA=[], sB=[], sC=[], stat='STAT', name='NoName')
geodezyx.time_series.ts_fcts.velocity_trans(tsin, vx, vy, vz, epoc_init='auto', epoc_end='auto')