geodezyx.time_series package

Submodules

geodezyx.time_series.ts_class module

Created on Fri Aug 2 13:55:33 2019

@author: psakic

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', anex=None)

Bases: object

ENUcalc_pt(refENU)

Calculate East-North-Up (ENU) coordinates relative to a reference point.

Parameters:

refENU (Point) – Reference point for ENU coordinate calculation.

Return type:

None

Notes

Updates the E, N, U attributes and calculates sigmas if available.

ENUset(E=nan, N=nan, U=nan, sE=nan, sN=nan, sU=nan)

Set East-North-Up local topocentric coordinates for the Point.

Parameters:
  • E (float, optional) – East component in meters. The default is NaN.

  • N (float, optional) – North component in meters. The default is NaN.

  • U (float, optional) – Up component in meters. The default is NaN.

  • sE (float, optional) – Sigma (standard deviation) of E. The default is NaN.

  • sN (float, optional) – Sigma (standard deviation) of N. The default is NaN.

  • sU (float, optional) – Sigma (standard deviation) of U. The default is NaN.

Return type:

None

FLHset(F=0.0, L=0.0, H=0.0, sF=0.0, sL=0.0, sH=0.0)

Set geodetic coordinates (F=latitude, L=longitude, H=height) for the Point.

Parameters:
  • F (float, optional) – Latitude in decimal degrees. The default is 0.

  • L (float, optional) – Longitude in decimal degrees. The default is 0.

  • H (float, optional) – Height (altitude) in meters. The default is 0.

  • sF (float, optional) – Sigma (standard deviation) of F. The default is 0.

  • sL (float, optional) – Sigma (standard deviation) of L. The default is 0.

  • sH (float, optional) – Sigma (standard deviation) of H. The default is 0.

Return type:

None

NEDset(N=nan, E=nan, D=nan, sN=nan, sE=nan, sD=nan)

Set North-East-Down local topocentric coordinates for the Point.

Parameters:
  • N (float, optional) – North component in meters. The default is NaN.

  • E (float, optional) – East component in meters. The default is NaN.

  • D (float, optional) – Down component in meters. The default is NaN.

  • sN (float, optional) – Sigma (standard deviation) of N. The default is NaN.

  • sE (float, optional) – Sigma (standard deviation) of E. The default is NaN.

  • sD (float, optional) – Sigma (standard deviation) of D. The default is NaN.

Return type:

None

Tset(T=0)

Set the time/epoch of the Point.

Parameters:

T (float or datetime.datetime, optional) – Time value. If 0, defaults to current time. Can be POSIX timestamp or datetime object. The default is 0.

Return type:

None

Notes

The time is stored in both POSIX timestamp format (self.T) and datetime object format (self.Tdt).

UTMcalc_pt(ellips='wgs84')

Calculate UTM projected coordinates.

Parameters:

ellips (str, optional) – Ellipsoid model to use. The default is ‘wgs84’.

Return type:

None

Notes

Updates the Eutm, Nutm, Uutm attributes.

UTMset(Eutm=nan, Nutm=nan, Uutm=nan, sEutm=nan, sNutm=nan, sUutm=nan)

Set UTM projected coordinates for the Point.

Parameters:
  • Eutm (float, optional) – UTM Easting coordinate in meters. The default is NaN.

  • Nutm (float, optional) – UTM Northing coordinate in meters. The default is NaN.

  • Uutm (float, optional) – Height (altitude) in meters. The default is NaN.

  • sEutm (float, optional) – Sigma (standard deviation) of Eutm. The default is NaN.

  • sNutm (float, optional) – Sigma (standard deviation) of Nutm. The default is NaN.

  • sUutm (float, optional) – Sigma (standard deviation) of Uutm. The default is NaN.

Return type:

None

XYZset(X=0.0, Y=0.0, Z=0.0, sX=0.0, sY=0.0, sZ=0.0)

Set Cartesian XYZ coordinates for the Point.

Parameters:
  • X (float, optional) – X Cartesian coordinate. The default is 0.

  • Y (float, optional) – Y Cartesian coordinate. The default is 0.

  • Z (float, optional) – Z Cartesian coordinate. The default is 0.

  • sX (float, optional) – Sigma (standard deviation) of X. The default is 0.

  • sY (float, optional) – Sigma (standard deviation) of Y. The default is 0.

  • sZ (float, optional) – Sigma (standard deviation) of Z. The default is 0.

Return type:

None

add_offset(dA, dB, dC, coortype='ENU')

Add an offset to the Point coordinates.

Parameters:
  • dA (float) – Offset for the A component (depends on coortype).

  • dB (float) – Offset for the B component (depends on coortype).

  • dC (float) – Offset for the C component (depends on coortype).

  • coortype (str, optional) – Coordinate type (‘ENU’, ‘XYZ’, ‘FLH’, ‘NED’, ‘UTM’). The default is ‘ENU’.

Return type:

None

helmert_trans(params='itrf2008_2_etrf2000', invert=False)

Apply Helmert transformation to the Point coordinates.

Parameters:
  • params (str, optional) – Transformation parameter set name. The default is ‘itrf2008_2_etrf2000’.

  • invert (bool, optional) – If True, apply inverse transformation. The default is False.

Return type:

None

Notes

Updates the Point coordinates in-place based on the Helmert transformation.

keysanex()

Get the keys of the anex (annex data) dictionary.

Returns:

List of keys in the anex dictionary.

Return type:

list

velocity_trans(vx, vy, vz, epoc_init='auto', epoc_end='auto')

Apply velocity-based coordinate transformation over time.

Parameters:
  • vx (float) – Velocity in X direction (m/year).

  • vy (float) – Velocity in Y direction (m/year).

  • vz (float) – Velocity in Z direction (m/year).

  • epoc_init (float or 'auto', optional) – Initial epoch in decimal years. If ‘auto’, uses the point’s epoch. The default is ‘auto’.

  • epoc_end (float or 'auto', optional) – Final epoch in decimal years. If ‘auto’, uses the point’s epoch. The default is ‘auto’.

Return type:

None

Notes

At least one of epoc_init or epoc_end must not be ‘auto’. Updates the Point coordinates based on the velocity transformation.

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

Bases: object

ENUcalc(refENU)

Calculate ENU coordinates relative to a reference point or time series.

Parameters:

refENU (Point or TimeSeriePoint) – Reference point or time series for ENU calculation.

Return type:

None

Notes

If refENU is a TimeSeriePoint, interpolation is performed to get reference coordinates at each measurement epoch.

ENUcalc_from_first_posi()

Calculate ENU coordinates relative to the first position in the TimeSerie.

Return type:

None

ENUcalc_from_mean_posi(mean_type='median')

Calculate ENU coordinates relative to the mean/median position of the TimeSerie.

Parameters:

mean_type (str, optional) – Type of mean to use (‘median’ or ‘mean’). The default is ‘median’.

Return type:

None

UTMcalc()

Calculate UTM projected coordinates for all points in the TimeSerie.

Return type:

None

Notes

Updates the UTM coordinates (Eutm, Nutm, Uutm) for all points. Sets boolUTM to True.

add_offset(dA, dB, dC, coortype='ENU')

Add an offset to all points in the TimeSerie.

Parameters:
  • dA (float) – Offset for the A component.

  • dB (float) – Offset for the B component.

  • dC (float) – Offset for the C component.

  • coortype (str, optional) – Coordinate type for offset (‘ENU’, ‘XYZ’, etc.). The default is ‘ENU’.

Return type:

None

add_point(point_inp)

Add a Point to the TimeSerie.

Parameters:

point_inp (Point) – Point object to add to the time series.

Return type:

None

Notes

Marks interpolation as outdated and should be recalculated if needed.

aleapt()

Get a random Point from the TimeSeries.

Returns:

Randomly selected Point object.

Return type:

Point

decimate(dec)

Decimate the TimeSerie by keeping 1 out of every dec points.

Parameters:

dec (int) – Decimation factor (keep 1/dec points).

Return type:

None

Notes

Modifies the TimeSerie in place, removing points to reduce data density.

del_data()

Method to purge the data in the TimeSeriePoint

Return type:

None.

discont_manu_click(fig=1)

Interactively record manual discontinuities by clicking on plot.

Parameters:

fig (int or matplotlib.figure.Figure, optional) – Figure ID or Figure object for interaction. The default is 1.

Returns:

(multi, cid) cursor objects that must be stored as global variables.

Return type:

tuple

Notes

Manual discontinuities are recorded in both the “main” discont list and a separate discont_manu list for identification.

Use SPACE key to record a discontinuity at the cursor position.

Important: cursor objects must be stored as global variables:

multi, cid = tsout.discont_manu_click()

See also

point_n_click_plot

More complete interactive plotting method.

enddate()

Get the last epoch of the data in the TimeSerie.

Returns:

Last timestamp in the time series.

Return type:

datetime.datetime

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

Find a Point by timestamp with tolerance.

Parameters:
  • tin (float or datetime.datetime) – Target timestamp (POSIX or datetime).

  • tol (float, optional) – Tolerance in seconds. The default is 0.001.

  • stop_when_found (bool, optional) – If True, stop at first match. If False, return all matches. The default is True.

Returns:

If stop_when_found=True: (Point, int) - Point and its index If stop_when_found=False: (list of Point, list of int) - Points and indices

Return type:

tuple

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

Load data from lists into the TimeSerie.

Parameters:
  • T (list of float) – Times (POSIX timestamps).

  • A (list of float) – First component (X, F latitude, or E depending on coortype).

  • B (list of float) – Second component (Y, L longitude, or N depending on coortype).

  • C (list of float) – Third component (Z, H height, or U depending on coortype).

  • coortype (str, optional) – Coordinate type (‘XYZ’, ‘FLH’, ‘ENU’, ‘NED’, ‘UTM’). The default is ‘XYZ’.

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

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

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

Return type:

None

from_uniq_point(Point, startdate, enddate, pas=1)

Create a TimeSerie from a single Point with defined time range.

Parameters:
  • Point (Point) – Reference Point object to replicate at different epochs.

  • startdate (float or datetime.datetime) – Start date (POSIX timestamp or datetime object).

  • enddate (float or datetime.datetime) – End date (POSIX timestamp or datetime object).

  • pas (float, optional) – Time step in seconds. The default is 1.

Return type:

None

Notes

Creates a time series by replicating the Point at regular intervals from startdate to enddate.

initype()

Get the most common coordinate type in the TimeSerie.

Returns:

The coordinate type that appears most frequently (‘XYZ’, ‘FLH’, ‘ENU’, etc.).

Return type:

str

interp_get(T, coortype='ENU')

Get interpolated coordinates at given times.

Parameters:
  • T (float or list of float) – Time(s) in POSIX format where interpolation is desired.

  • coortype (str, optional) – Coordinate type (‘ENU’, ‘XYZ’, ‘FLH’, ‘UTM’). The default is ‘ENU’.

Returns:

New TimeSerie with interpolated points at requested times.

Return type:

TimeSeriePoint

Notes

Interpolators must be set up first using interp_set(). If interpolators are outdated, they are automatically recalculated.

interp_set(interptype='slinear')

Set up coordinate interpolators for the TimeSerie.

Parameters:

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

Return type:

None

Notes

Creates interpolation functions for each available coordinate type (ENU, XYZ, FLH, UTM). Interpolators are stored as attributes (EfT, NfT, UfT, etc.) for later use.

interval_nominal()

Get the nominal interval between consecutive epochs.

Returns:

Nominal interval between epochs in seconds (rounded to 1 decimal place).

Return type:

float

len_period(output_seconds=False)

Get the period length of the TimeSerie.

Parameters:

output_seconds (bool, optional) – If True, return the result in seconds. If False, return as timedelta. The default is False.

Returns:

Period length (as timedelta if output_seconds=False, as int seconds otherwise).

Return type:

int or datetime.timedelta

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

Calculate the mean position of the TimeSerie.

Parameters:
  • coortype (str, optional) – Coordinate type for calculation (‘XYZ’, ‘FLH’, ‘ENU’, ‘UTM’). The default is ‘XYZ’.

  • outtype (str, optional) – Output format (‘point’ for Point object, ‘tuple’ for coordinates). The default is ‘point’.

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

Returns:

Mean position as Point object or tuple of coordinates (A, B, C, T).

Return type:

Point or tuple

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

Set metadata about the TimeSerie.

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

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

  • name (str, optional) – Free name for the TimeSerie (e.g., experiment, period, software name). 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=1.5, alpha=0.8, fig=1, errbar=True, symbol='.', errbar_width=1, ylim=None, legend_loc='best', legend_ncol=1)

Plot data in a TimeSerie Object

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

  • diapt (float, optional) – Point diameter. The default is 1.

  • 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.

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

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

  • ylim (tuple, optional) – Y-axis limits. The default is None.

  • legend_loc (str, optional) – Location of the legend. The default is ‘best’.

  • legend_ncol (int, optional) – Number of columns in the legend. The default is 1.

Returns:

  • figobj (Figure object) – figure object of the plot.

  • axes (array of Axes objects) – array of the 3 axes objects of the plot.

plot_discont(fig=1)

Plot discontinuities of the TimeSerie on existing plot.

Parameters:

fig (int or matplotlib.figure.Figure, optional) – Figure ID or Figure object where discontinuities will be plotted. The default is 1.

Return type:

None

readfile(filein)

Read time series data from a file.

Parameters:

filein (str) – Path of the file to read.

Return type:

None

Notes

Should be used with care. Replaces all internal data.

rm_duplicat_pts(coortype='XYZ')

Remove duplicate points from the time series.

Parameters:

coortype (str, optional) – The coordinate type to consider for duplication check. The default is “XYZ”.

Return type:

None

set_discont(indiscont)

Set the list of discontinuities in the TimeSerie.

Parameters:

indiscont (list of datetime or float) – List of discontinuity times (datetime objects or POSIX timestamps).

Return type:

None

Notes

Discontinuities are typically used for visualization and can be detected or manually set.

sort()

Sort points in the TimeSerie by time (in-place).

Return type:

None

Notes

Modifies the internal list of points in chronological order.

startdate()

Get the first epoch of the data in the TimeSerie.

Returns:

First timestamp in the time series.

Return type:

datetime.datetime

time_win(windows, mode='keep')

Apply a time window filter to the TimeSerie.

Parameters:
  • windows (list of tuple or list of datetime) – Time windows to process. Format depends on implementation.

  • mode (str, optional) – Filter mode (‘keep’ or ‘remove’). The default is ‘keep’.

Return type:

None

Notes

This operation replaces the internal data. Be cautious when applying this method as it modifies the TimeSerie in place.

to_dataframe(coortype='XYZ', anex_key_list=None)

Export the TimeSerie as a pandas DataFrame.

Parameters:
  • coortype (str or iterable of str, optional) – Coordinate type(s) to export (‘XYZ’, ‘FLH’, ‘ENU’, ‘UTM’). Can be a single string or tuple of strings for multiple coordinates. The default is ‘XYZ’.

  • anex_key_list (list of str, optional) – List of keys from the point’s anex (annex) dictionary to add as columns. The default is None.

Returns:

df – DataFrame with columns for epoch, time, coordinates, and uncertainties.

Return type:

pandas.DataFrame

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

Export the TimeSerie as lists of numpy arrays.

Parameters:
  • coortype (str, optional) – Coordinate type to export (‘XYZ’, ‘FLH’, ‘ENU’, ‘UTM’). The default is ‘XYZ’.

  • specific_output (int, optional) – If specified, return only one array (index 0-6). The default is None (returns all 7 arrays).

  • time_as_datetime (bool, optional) – If True, return time as datetime objects. If False, return POSIX timestamps. The default is False.

Returns:

(A, B, C, T, sA, sB, sC) where: - A, B, C depend on coortype (e.g., X, Y, Z for XYZ) - T is time (datetime or POSIX depending on time_as_datetime) - sA, sB, sC are standard deviations

Return type:

tuple of 7 numpy arrays

geodezyx.time_series.ts_class_xtra module

Created on Fri Apr 3 2026

@author: psakic

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

Bases: object

Attitude (Roll, Pitch, Yaw) representation.

Qcalc()

Calculate quaternion from Roll, Pitch, Yaw angles.

Return type:

None

Notes

Stores the quaternion in self.Q.

RPYget()

Get Roll, Pitch, Yaw angles.

Returns:

(Roll, Pitch, Yaw) in degrees.

Return type:

tuple

RPYset(R=0, P=0, Y=0, sR=0, sP=0, sY=0)

Set Roll, Pitch, Yaw angles and their standard deviations.

Parameters:
  • R (float, optional) – Roll angle in degrees. The default is 0.

  • P (float, optional) – Pitch angle in degrees. The default is 0.

  • Y (float, optional) – Yaw angle in degrees. The default is 0.

  • sR (float, optional) – Standard deviation of Roll. The default is 0.

  • sP (float, optional) – Standard deviation of Pitch. The default is 0.

  • sY (float, optional) – Standard deviation of Yaw. The default is 0.

Return type:

None

Tset(T=0)

Set the time/epoch of the Attitude.

Parameters:

T (float or datetime.datetime, optional) – Time value. If 0, defaults to current time. Can be POSIX timestamp or datetime object. The default is 0.

Return type:

None

Notes

The time is stored in both POSIX timestamp format (self.T) and datetime object format (self.Tdt).

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

Bases: object

Time series observation class for homogeneous observation data.

Unlike TimeSeriePoint, objects contain only one type of observation data in a single coordinate form. When reading from files with multiple devices, the read functions return a list of TimeSerieObs objects.

obs

List of observation objects.

Type:

list

typeobs

Type of observations (e.g., ‘RPY’ for Roll-Pitch-Yaw).

Type:

str

nbobs

Number of observations.

Type:

int

add_obs(inObs)

Add an observation to the TimeSerieObs.

Parameters:

inObs (Attitude or observation object) – Observation to add.

Return type:

None

Notes

Marks interpolation as outdated.

aleaobs()

Get a random observation from the TimeSerieObs.

Returns:

Randomly selected observation.

Return type:

observation object

del_data()

Delete all observations from the TimeSerieObs.

Return type:

None

enddate()

Get the last epoch of observations.

Returns:

Last POSIX timestamp.

Return type:

float

interp_get(T)

Get interpolated observations at given times.

Parameters:

T (float or list of float) – Time(s) in POSIX format where interpolation is desired.

Returns:

New TimeSerieObs with interpolated observations at requested times.

Return type:

TimeSerieObs

Notes

Interpolators must be set up first using interp_set().

interp_set(interptype='slinear')

Set up observation interpolators.

Parameters:

interptype (str, optional) – Interpolation type (e.g., ‘slinear’). The default is ‘slinear’.

Return type:

None

Notes

Creates interpolation functions for each observation component. For RPY observations, creates RfT, PfT, YfT interpolators.

interval_nominal()

Get the nominal interval between consecutive observations.

Returns:

Nominal interval in seconds (rounded to 1 decimal place).

Return type:

float

meta_set(path='', devID='NULL', name='')

Set metadata for the TimeSerieObs.

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

  • devID (str, optional) – Device identifier. The default is ‘NULL’.

  • name (str, optional) – Observation series name. The default is ‘’.

Return type:

None

plot(diapt=10, alpha=0.8, fig=1, new_style=True)

Plot observations as multi-panel figure.

Parameters:
  • diapt (float, optional) – Point marker size. The default is 10.

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

  • fig (int or matplotlib.figure.Figure, optional) – Figure ID or Figure object. The default is 1.

  • new_style (bool, optional) – If True, use 410 layout. If False, use 220 layout. The default is True.

Return type:

None

Notes

Creates a 4-panel plot with phase space and time series for each component.

readfile(filein, indtab=0)

Read observation data from a file.

Parameters:
  • filein (str) – Path to the file to read.

  • indtab (int, optional) – Index of the device/table to read. The default is 0.

Return type:

None

Notes

Replaces all internal data with data from file.

startdate()

Get the first epoch of observations.

Returns:

First POSIX timestamp.

Return type:

float

timewin(windows, mode='keep')

Apply a time window filter to the TimeSerieObs.

Parameters:
  • windows (list) – Time windows to process.

  • mode (str, optional) – Filter mode (‘keep’ or ‘remove’). The default is ‘keep’.

Return type:

None

to_list()

Export observations as lists of numpy arrays.

Returns:

(A, B, C, T, sA, sB, sC) where: - A, B, C are the main observation components (e.g., R, P, Y for RPY) - T is time (POSIX timestamps) - sA, sB, sC are standard deviations

Return type:

tuple of 7 numpy arrays

class geodezyx.time_series.ts_class_xtra.point_n_click_plot

Bases: object

Interactive point selection tool for plots.

Allows interactive selection of points on a plot by clicking, useful for identifying offsets, discontinuities, or other features of interest.

selectedX

List of selected X-values (timestamps if Xdata_are_time=True).

Type:

list

ver_bar_stk

Stack of vertical bar objects for visualization.

Type:

list

Examples

Basic usage:

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

Notes

  • Press SPACE to record a point

  • Press R to remove the last recorded point

  • Cursor objects (multi, cid) must be stored as global variables to keep them in scope during interactive use

See also

TimeSeriePoint.discont_manu_click

Similar functionality for discontinuities

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 a time series to a custom .ts.dat format.

Parameters:
  • ts (TimeSeries) – Input time series object containing geodetic data.

  • outdir (str) – Directory where the output file will be saved.

  • coordtype (str, optional) – Coordinate type to use for the export (e.g., ‘ENU’), by default ‘ENU’.

  • outprefix (str, optional) – Prefix to add to the output file name, by default an empty string.

  • write_header (bool, optional) – If True, writes a header to the output file, by default False.

Notes

  • The function writes a .ts.dat file containing the time series data.

  • The file includes geodetic coordinates (East, North, Up or other types) and their uncertainties.

  • The header, if enabled, describes the columns in the file.

Returns:

The function writes the output file to the specified directory and does not return any value. write_header not well implemented !!!

Return type:

None

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 a time series to a MIDAS .tneu compatible format.

Parameters:
  • tsin (TimeSeries) – Input time series object containing geodetic data.

  • outdir (str) – Directory where the output .tneu file will be saved.

  • outprefix (str) – Prefix to add to the output file name.

  • coordtype (str, optional) – Coordinate type to use for the export, by default ‘ENU’.

  • export_step (bool, optional) – If True, exports a step file containing discontinuities, by default True.

Notes

  • The function writes a .tneu file containing the time series data in MIDAS format.

  • If export_step is True and the time series contains discontinuities, a separate step file is created.

  • The .tneu file includes geodetic displacements (East, North, Up) relative to the first point.

Returns:

The function writes the output file(s) to the specified directory and does not return any value.

Return type:

None

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

Export a time series to a HECTOR .neu compatible format.

Parameters:
  • tsin (TimeSeries) – Input time series object containing geodetic data.

  • outdir (str) – Directory where the output .neu file will be saved.

  • outprefix (str) – Prefix to add to the output file name.

  • coordtype (str, optional) – Coordinate type to use for the export, by default ‘ENU’.

Notes

  • The function writes a .neu file containing the time series data in HECTOR format.

  • The header includes metadata such as the reference epoch, reference position, and field descriptions.

  • The data section includes geodetic displacements (North, East, Up) relative to the first point.

  • If the time series lacks XYZ attributes, default values are used for the reference position.

Returns:

The function writes the output file to the specified directory and does not return any value.

Return type:

None

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

Export a time series to the GAMIT/GLOBK PBO position (.pos) format.

Parameters:
  • tsin (TimeSeries) – Input time series object containing geodetic data.

  • outdir (str) – Directory where the output .pos file will be saved.

  • outprefix (str, optional) – Prefix to add to the output file name, by default an empty string.

  • force (str, optional) – Determines the data source to use for the export. Can be ‘data’ or ‘data_xyz’. If None, the function decides based on the available attributes, by default None.

  • force_1st_pt_as_ref (bool, optional) – If True, forces the first point of the time series to be used as the reference position, by default True.

  • verbose (bool, optional) – If True, enables verbose logging for debugging purposes, by default False.

Notes

  • The function writes a .pos file containing the time series data in the PBO format.

  • The header includes metadata such as the reference epoch, reference position, and field descriptions.

  • The data section includes geodetic coordinates (X, Y, Z) and their uncertainties, along with other metadata.

Returns:

outfile_path – Path to the exported PBO file

Return type:

str

geodezyx.time_series.ts_export.export_ts_as_spotgins(tsin, outdir, ac, data_src='unknown', version=3)

Export time series to SPOTGINS format.

Parameters:
  • tsin (TimeSeries) – Input time series object

  • outdir (str) – Output directory path

  • ac (str) – Analysis Center acronym (3-4 characters)

  • data_src (str, optional) – Data source identifier, by default “unknown”

  • version (int, optional) – SPOTGINS format version (2 or 3), by default 2

Returns:

outfile_path – Path to the exported SPOTGINS file

Return type:

str

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)

Compare time series data.

This function compares multiple time series data by calculating differences between a reference time series and other time series. It supports various coordinate types and can perform outlier cleaning using the Median Absolute Deviation (MAD) method.

Parameters:
  • tstup (tuple of TimeSeriePoint) – Tuple of time series to compare. The first one is the reference.

  • coortype (str, optional) – Coordinate type (‘ENU’, ‘XYZ’, etc.). Default is ‘ENU’.

  • seuil (float, optional) – Threshold for MAD cleaning. Default is 3.

  • win (list, optional) – Time window for comparison. Default is an empty list.

  • mode (str, optional) – Mode for time window (‘keep’ or ‘del’). Default is ‘keep’.

  • Dtype (str, optional) – Type of distance calculation (‘2D’, ‘3D’, ‘2D3D’). Default is ‘2D3D’.

  • namest (int, optional) – Start index for name slicing. Default is 0.

  • namend (int, optional) – End index for name slicing. Default is 10.

  • alpha (float, optional) – Alpha value for plotting. Default is 0.8.

  • diapt (float, optional) – Marker size for plotting. Default is 5.

  • verbose (bool, optional) – If True, print detailed logs. Default is True.

  • print_report (bool, optional) – If True, print comparison report. Default is True.

  • plot (bool, optional) – If True, generate comparison plots. Default is True.

  • interp (bool, optional) – If True, perform interpolation. Default is True.

Returns:

output – If plot is True, returns a tuple (dicolist, fig). Otherwise, returns dicolist.

Return type:

list or tuple

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')

Generate comparison plots for time series data.

This function creates plots to compare multiple time series data. It supports different coordinate types and allows customization of plot appearance.

Parameters:
  • dico_list_in (list of dict) – List of dictionaries containing time series data to plot.

  • namest (int, optional) – Start index for name slicing. Default is 0.

  • namend (int, optional) – End index for name slicing. Default is 10.

  • alpha (float, optional) – Alpha value for plot markers. Default is 0.8.

  • diapt (float, optional) – Marker size for plot markers. Default is 1.5.

  • new_style (bool, optional) – If True, use a new style for the plots. Default is True.

  • colormap (str, optional) – Colormap to use for the plots. Default is ‘gnuplot’.

Returns:

fig – The generated figure containing the comparison plots.

Return type:

matplotlib.figure.Figure

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)

Clean time series using Median Absolute Deviation (MAD) method.

Parameters:
  • tsin (TimeSerie) – Input time series object

  • seuil (float) – Threshold for outlier detection (default 3.5)

  • method (str) –

    Method of elimination:

    • 'dist': eliminate points that are too far in distance from ref position

    • 'indep': treat points independently

    dist is preferred

  • coortype (str) – Coordinate type (default 'ABC')

  • detrend_first (bool) – Remove trend before cleaning (default False)

  • output_detrended (bool) – Output detrended data (only works if detrend_first is True)

  • verbose (bool) – Print verbose output (default False)

Returns:

tsout – Cleaned time series

Return type:

TimeSerie

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.plot_timeseries(coor_inp, coortype='ENU', diapt=1.5, alpha=0.8, fig=1, errbar=True, symbol='.', errbar_width=1, ylim=None, legend_loc='best', legend_ncol=1, name='', stat='')

Standalone function to plot TimeSerie data.

This function can be called independently to plot time series data with three components (A, B, C) and their uncertainties.

Parameters:
  • coor_inp (tuple or pd.DataFrame) –

    Input coordinates data. It can be either: - a 7-tuple (A, B, C, T, sA, sB, sC) where:

    • A, B, C: coordinate components as numpy arrays

    • T: time epochs as numpy array (POSIX timestamps)

    • sA, sB, sC: uncertainties of the components as numpy arrays

    • a DataFrame with columns corresponding to the coordinate type (e.g., ‘e’, ‘n’, ‘u’ for ENU) and their uncertainties (e.g., ‘se’, ‘sn’, ‘su’), along with an ‘epoch’ column for time epochs.

  • coortype (str, optional) – The coordinates type. The default is ‘ENU’. Options: ‘ENU’, ‘XYZ’, ‘FLH’, ‘UTM’

  • diapt (float, optional) – Point diameter. The default is 1.5.

  • 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 an 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.

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

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

  • ylim (tuple, optional) – Y-axis limits. The default is None.

  • legend_loc (str, optional) – Location of the legend. The default is ‘best’.

  • legend_ncol (int, optional) – Number of columns in the legend. The default is 1.

  • name (str, optional) – Name for the plot legend. The default is “”.

  • stat (str, optional) – Station name for the figure title. The default is “”.

Returns:

  • figobj (Figure object) – Figure object of the plot.

  • axes (array of Axes objects) – Array of the 3 axes objects of the plot.

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_multi(inplis)
geodezyx.time_series.ts_fcts.time_win_t(Tin, win, mode='del')
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')