geodezyx.conv package

Submodules

geodezyx.conv.conv_angle module

Created on Thu Aug 13 15:11:12 2020

@author: psakic

This sub-module of geodezyx.conv deals with angle conversion.

it can be imported directly with: from geodezyx import conv

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU GPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (GFZ, pierre.sakic@gfz-postdam.de) GitHub repository : https://github.com/GeodeZYX/GeodeZYX-Toolbox_v4

geodezyx.conv.conv_angle.angle2equivalent_earth_parallel(angle_in, latitude_in, angtype='deg', earth_radius=6371008.8)

Quick and simple function which gives the equivalent distance on a Earth parallel circle of an angle

Useful to determine metric varaitions in longitude (but the latitude is also necessary to determine

the radius of the parallel)

angle can be : “deg”, “rad”, “mas”

geodezyx.conv.conv_angle.angle2equivalent_earth_radius(angle_in, angtype='deg', earth_radius=6371008.8)

Quick and simple function which gives the equivalent distance on a Earth great circle of an angle

Useful to determine metric varations in latitude

angle can be : “deg”, “rad”, “mas”

geodezyx.conv.conv_angle.angle_from_3_pts(p1, p2, p3)

Gives angle between 3 points p3 is the vertex (sommet)

http://www.les-mathematiques.net/phorum/read.php?8,596072,596231

geodezyx.conv.conv_angle.angle_interpolation_quick(A, B, w)

Determine the interpolation between angle A & B by conversion to the cartesian space the parameter w € [0,1] define the interpoled angle C(w) where C(w=0) = A & C(w=1) = B

https://stackoverflow.com/questions/2708476/rotation-interpolation

geodezyx.conv.conv_angle.anglesfromvects(xa, ya, xb, yb, angtype='deg')

Determines the angle between the points A(xa,ya) and B(xb,yb)

angle can be : “deg”, “rad”

geodezyx.conv.conv_angle.arcsec2deg(arcsec_in)

Angle conversion

Convert : Arcsecond => Degrees

NB : Not really useful, should be avoided

geodezyx.conv.conv_angle.cartesian2polar(x, y)

Coordinates conversion

cartesian => polar conversion

Parameters
  • x (numpy.array of float) – cartesian coordinates

  • y (numpy.array of float) – cartesian coordinates

Returns

r , theta – polar coordinates (radius / angle in radians)

Return type

float

geodezyx.conv.conv_angle.deg2arcsec(deg_in)

Angle conversion

Convert : Degrees => Arcsecond

NB : Not really useful, should be avoided

geodezyx.conv.conv_angle.deg_dec2dms(deg_in, only_dm=False)

Angle conversion

Convert : Decimal Degree => Degree Minute Seconds

Parameters

deg_in (float or iterable of floats) – Decimal degrees

Returns

deg , minu , sec – 3 arrays for Degrees, Minutes, Seconds

Return type

numpy.array of float

geodezyx.conv.conv_angle.dms2dec(dms_str, onlyDM=False)

Angle conversion

Convert : Degree Minute Second string Angle => decimal Degree float Angle

can manage only DM angle in input

NB : Too Complicated …. must be simplified

Parameters
  • dms_str (str) – string of DMS angle e.g. “2°20’35.09”E”

  • onlyDM (bool) – True if the string is only a Degree Minute Angle e.g. “40°52.0931’N” “28°31.4136’E”

Returns

dd_float – Decimal degree Angle

Return type

float

geodezyx.conv.conv_angle.dms2dec_num(deg, minn=0, sec=0)

Angle conversion

Convert : Degree Minute Second float Angle => decimal Degree float Angle

Parameters

& minn & sec (deg) – degres, minutes and seconds of the input Angle

Returns

dd_float – Decimal degree Angle

Return type

float

geodezyx.conv.conv_angle.polar2cartesian(r, theta, ang='deg')

Coordinates conversion

polar => cartesian conversion

Parameters
  • r (float or iterable of floats) – polar coordinates

  • theta (float or iterable of floats) – polar coordinates

  • ang (string) – ‘deg’ (degrees) or ‘rad’ (radian)

Returns

x , y – cartesian coordinates

Return type

numpy.array of float

geodezyx.conv.conv_coords module

Created on Thu Aug 13 15:11:12 2020

@author: psakic

This sub-module of geodezyx.conv deals with coordinate conversion.

it can be imported directly with: from geodezyx import conv

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU GPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (GFZ, pierre.sakic@gfz-postdam.de) GitHub repository : https://github.com/GeodeZYX/GeodeZYX-Toolbox_v4

geodezyx.conv.conv_coords.ECEF2ECI(xyz, utc_times)

Convert ECEF (Earth Centered Earth Fixed) positions to ECI (Earth Centered Inertial) positions

Parameters
  • xyz (numpy.array of floats) – XYZ are cartesian positions in ECEF. Should have shape (N,3)

  • utc_times (numpy.array of floats) – UTC_times are UTC timestamps, as datetime objects. Sould have shape (N)

Returns

eci – Earth Centered Inertial coordinates. will have shape (N,3)

Return type

numpy.array of floats

Note

Requires pyorbital module

[X] [C -S 0][X] [Y] = [S C 0][Y] [Z]eci [0 0 1][Z]ecf

C and S are cos() and sin() of gmst (Greenwich Meridian Sideral Time)

http://ccar.colorado.edu/ASEN5070/handouts/coordsys.doc Inspired from satellite-js (https://github.com/shashwatak/satellite-js)

geodezyx.conv.conv_coords.ECI2ECEF(xyz, utc_times)

Convert ECI (Earth Centered Inertial) positions to ECEF (Earth Centered Earth Fixed) positions

Parameters
  • xyz (numpy.array of floats) – XYZ are cartesian positions in Earth Centered Inertial. Should have shape (N,3)

  • utc_times (numpy.array of floats) – UTC_times are UTC timestamps, as datetime objects. Sould have shape (N)

Returns

ecef – Earth Centered Earth Fixed coordinates. will have shape (N,3)

Return type

numpy.array of floats

Note

Requires pyorbital module

[X] ([C -S 0])[X] [Y] = inv([S C 0])[Y] [Z]ecef ([0 0 1])[Z]eci

Empirically:

[X] [ C S 0][X] [Y] = [-S C 0][Y] [Z]ecef [ 0 0 1][Z]eci

C and S are cos() and sin() of gmst (Greenwich Meridian Sideral Time)

http://ccar.colorado.edu/ASEN5070/handouts/coordsys.doc Inspired from satellite-js (https://github.com/shashwatak/satellite-js)

Note

Quick mode of the reverse fct, can be improved

geodezyx.conv.conv_coords.ECI2RTN(P, V, C)

legacy wrapper of ECI2RTN_or_RPY

geodezyx.conv.conv_coords.ECI2RTN_or_RPY(P, V, C, out_rpy=False, rpy_theo_mode=False)

convert ECI coordinates in RTN (RIC) or RPY (Roll Pitch Yaw)

Parameters
  • P (numpy.array) – 3D vector, position of the ref object in ECI frame

  • V (numpy.array) – 3D vector, velocity of the ref object in ECI frame

  • C (numpy.array) – 3D Vector, coordinates in ECF frame that will be transformed

  • out_rpy (bool) – if True output in RPY frame, RTN instead

  • rpy_theo_mode (bool) – use the theoretical matrix composition, but wrong ans. empirically, only for debug !!

Returns

  • Cout (conversion of P in RTN or RPY ref. frame)

  • Source

  • ——

  • “Coordinate Systems”, ASEN 3200 1/24/06 George H. Born

geodezyx.conv.conv_coords.ENU2XYZ(E, N, U, x0, y0, z0, velocity_mode=False)

Coordinates conversion

ENU Topocentic => XYZ ECEF Geocentric

Parameters
  • E (numpy.array of floats) – cartesian coordinates E,N,U in meters

  • N (numpy.array of floats) – cartesian coordinates E,N,U in meters

  • U (numpy.array of floats) – cartesian coordinates E,N,U in meters

  • x0 (floats or numpy.array of floats) – coordinate of the topocentric origin point in the geocentric frame if they are iterable arrays (of the same size as E,N,U) a different x0,y0,z0 will be applied for each E,N,U element

  • y0 (floats or numpy.array of floats) – coordinate of the topocentric origin point in the geocentric frame if they are iterable arrays (of the same size as E,N,U) a different x0,y0,z0 will be applied for each E,N,U element

  • z0 (floats or numpy.array of floats) – coordinate of the topocentric origin point in the geocentric frame if they are iterable arrays (of the same size as E,N,U) a different x0,y0,z0 will be applied for each E,N,U element

  • velocity_mode (bool) – For the Velocity mode, coordinates of the topocentric origin point are NOT added at the end of the conversion Default is False

Returns

  • X,Y,Z (numpy.array of floats) – ECEF X,Y,Z Component (m)

  • Source

  • ——

  • https (//gssc.esa.int/navipedia/index.php/Transformations_between_ECEF_and_ENU_coordinates)

geodezyx.conv.conv_coords.ENU2XYZ_legacy(E, N, U, Xref, Yref, Zref)

KEPT FOR LEGACY REASONS, use ENU2XYZ

diffère de ENU2XYZ pour d’obscure raisons, à investiguer !!! est laissé pour des scripts de conversion de GINS (170119)

this fct compute the dXYZ and not the final XYZ

geodezyx.conv.conv_coords.ENU2XYZ_vector(ENU, xyz_ref)
geodezyx.conv.conv_coords.GEO2XYZ(phi, llambda, he, angle='deg', a=6378137.0, e2=0.00669438003)

Coordinates conversion

FLH Geographic => XYZ ECEF Cartesian

Parameters
  • phi (numpy.array of floats) – latitude (deg/rad), longitude (deg/rad), height (m)

  • llambda (numpy.array of floats) – latitude (deg/rad), longitude (deg/rad), height (m)

  • he (numpy.array of floats) – latitude (deg/rad), longitude (deg/rad), height (m)

  • angle (string) – describe the angle input type : ‘deg’ or ‘rad’

  • a (floats) – ellipsoid parameters (WGS84 per default)

  • e2 (floats) – ellipsoid parameters (WGS84 per default)

Returns

  • X,Y,Z (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • Source

  • ——

  • Based on PYACS of J.-M. Nocquet

geodezyx.conv.conv_coords.GEO2XYZ_vector(FLH, angle='deg', a=6378137.0, e2=0.00669438003)
geodezyx.conv.conv_coords.XYZ2ENU(dX, dY, dZ, lat0, lon0)

Coordinates conversion

XYZ ECEF Geocentric => ENU Topocentic

use XYZ2ENU_2 in priority

(XYZ2ENU is a core function for XYZ2ENU_2)

dXYZ = XYZrover - XYZref

Parameters
  • dX (floats or numpy.array of floats) – cartesian coordinates difference between the considered point(s) and the reference point

  • dY (floats or numpy.array of floats) – cartesian coordinates difference between the considered point(s) and the reference point

  • dZ (floats or numpy.array of floats) – cartesian coordinates difference between the considered point(s) and the reference point

  • lat0 (floats or numpy.array of floats) – if they are iterable arrays (of the same size as dX,dY,dZ) a different x0,y0,z0 will be applied for each dX,dY,dZ element

  • lon0 (floats or numpy.array of floats) – if they are iterable arrays (of the same size as dX,dY,dZ) a different x0,y0,z0 will be applied for each dX,dY,dZ element

Returns

  • E,N,U (numpy.array of floats) – East North Up Component (m) w.r.t. x0,y0,z0

  • Source

  • ——

  • https (//gssc.esa.int/navipedia/index.php/Transformations_between_ECEF_and_ENU_coordinates)

Note

This recursive fuction should be improved

geodezyx.conv.conv_coords.XYZ2ENU_2(X, Y, Z, x0, y0, z0)

Coordinates conversion

XYZ ECEF Geocentric => ENU Topocentic

Parameters
  • X (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • Y (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • Z (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • x0 (floats or numpy.array of floats) – coordinate of the wished topocentric origin point in the geocentric frame if they are iterable arrays (of the same size as X,Y,Z) a different x0,y0,z0 will be applied for each X,Y,Z element

  • y0 (floats or numpy.array of floats) – coordinate of the wished topocentric origin point in the geocentric frame if they are iterable arrays (of the same size as X,Y,Z) a different x0,y0,z0 will be applied for each X,Y,Z element

  • z0 (floats or numpy.array of floats) – coordinate of the wished topocentric origin point in the geocentric frame if they are iterable arrays (of the same size as X,Y,Z) a different x0,y0,z0 will be applied for each X,Y,Z element

Returns

  • E,N,U (numpy.array of floats) – East North Up Component (m) w.r.t. x0,y0,z0

  • Source

  • ——

  • https (//gssc.esa.int/navipedia/index.php/Transformations_between_ECEF_and_ENU_coordinates)

geodezyx.conv.conv_coords.XYZ2ENU_around_fix_pos(X, Y, Z)

Computes the mean of the X,Y,Z and return the topocentric ENU position around this mean position

Parameters
  • X (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • Y (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • Z (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

Returns

  • E,N,U (numpy.array of floats) – East North Up Component (m) w.r.t. the mean position

  • x0 , y0 , z0 (floats) – coordinates of the mean position in the geocentic frame

geodezyx.conv.conv_coords.XYZ2ENU_vector(XYZ, xyz0)
geodezyx.conv.conv_coords.XYZ2GEO(x, y, z, outdeg=True, A=6378137.0, E2=0.00669438003)

Coordinates conversion

XYZ ECEF Cartesian => FLH Geographic

Parameters
  • x (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • y (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • z (numpy.array of floats) – cartesian coordinates X,Y,Z in meters

  • outdeg (bool) – if True, degrees output for the angle, else radian

  • A (floats) – ellipsoid parameters (WGS84 per default)

  • E2 (floats) – ellipsoid parameters (WGS84 per default)

Returns

  • latitude, longitude, height (numpy.array of floats) – latitude (deg/rad), longitude (deg/rad), height (m)

  • Source

  • ——

  • Based on PYACS of J.-M. Nocquet

geodezyx.conv.conv_coords.XYZ2GEO_vector(XYZ, outdeg=True, A=6378137.0, E2=0.00669438003)
geodezyx.conv.conv_coords.normal_vector(phi, llambda, angle='deg', normalized=True)

Compute the Ellipsoid “Normale”

  1. Bosser (2012), Géométrie de l’Ellipsoïde, p27

geodezyx.conv.conv_coords.sENU2sFLH(F, L, H, sE, sN, sU, ang='deg', A=6378137.0, E2=0.00669438003)

Convert standard deviation Cartesian Topocentric ENU => Geographic FLH

Warning

Inputs values are assumed as uncorrelated, which is not accurate Must be improved

Linear Algebra, Geodesy, and GPS p332

geodezyx.conv.conv_coords.sFLH2sENU(F, L, H, sF, sL, sH, ang='deg')

Convert standard deviation Geographic FLH => Cartesian Topocentric ENU

Warning

Inputs values are assumed as uncorrelated, which is not accurate Must be improved

Linear Algebra, Geodesy, and GPS p332

geodezyx.conv.conv_coords.sFLH2sXYZ(F, L, H, sF, sL, sH, ang='deg')

Convert standard deviation Geographic FLH => Cartesian ECEF XYZ

Warning

Inputs values are assumed as uncorrelated, which is not accurate Must be improved

Linear Algebra, Geodesy, and GPS p332

geodezyx.conv.conv_coords.sXYZ2sENU(X, Y, Z, sX, sY, sZ, sXY=0, sYZ=0, sXZ=0)

Convert standard deviation Cartesian ECEF XYZ => Cartesian Topocentric ENU

Warning

Inputs values are assumed as uncorrelated, which is not accurate Must be improved

Linear Algebra, Geodesy, and GPS p332

geodezyx.conv.conv_coords.vector_separator(ABC)

Split a Nx3 Array/DataFrame in three separated 1-component vectors To simplify the usage of the conversion functions (which take single component vectors as input)

Parameters

ABC (Array or DataFrame) – Nx3 XYZ, ENU… array.

Returns

  • A (Array) – 1st component.

  • B (Array) – 2nd component.

  • C (Array) – 3rd component.

geodezyx.conv.conv_coords.wnorm(phi, a=6378137.0, e2=0.00669438003)

Compute the Ellipsoid “Grande Normale”

ALG0021 in NTG_71 (IGN Lambert Projection Tech document) Based on PYACS of J.-M. Nocquet

geodezyx.conv.conv_geometric module

Created on Thu Aug 13 15:11:12 2020

@author: psakicki

This sub-module of geodezyx.conv deals with low-level geometric operation.

it can be imported directly with: from geodezyx import conv

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU GPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (GFZ, pierre.sakic@gfz-postdam.de) GitHub repository : https://github.com/GeodeZYX/GeodeZYX-Toolbox_v4

geodezyx.conv.conv_geometric.barycenter(points_list_in)

Determines the barycenter of a list of points

geodezyx.conv.conv_geometric.dist(A, B)

Cartesian distance between 2 points A & B

Parameters
  • A (numpy.array of float) – Description param1

  • B (numpy.array of float) – Description param1

Returns

D – distance between A & B

Return type

float

geodezyx.conv.conv_geometric.dist_diff(A, B)

First derivative of cartesian distance between 2 points A & B

Parameters
  • A (numpy.array of float) – “points”, can be 2D or 3D vectors (list, np.array …)

  • B (numpy.array of float) – “points”, can be 2D or 3D vectors (list, np.array …)

Returns

  • diffA (numpy.array of float) – [ dD/dxa , dD/dya , dD/dza ]

  • diffB (numpy.array of float) – [ dD/dxb , dD/dyb , dD/dzb ] = -diffA

geodezyx.conv.conv_geometric.equilateral_triangle(side)

Gives coordinates of an equilateral triangle of a given side

geodezyx.conv.conv_geometric.line_maker(x1, y1, x2, y2, nbpts=10000)

Determine points of a line easily

Parameters
  • x1 (float) – Coordinates of the start point

  • y1 (float) – Coordinates of the start point

  • x2 (float) – Coordinates of the end point

  • y2 (float) – Coordinates of the end point

Returns

X,Y – points of the line

Return type

numpy.array of float

geodezyx.conv.conv_geometric.orthogonal_projection(Xa, Xb, Xv)

Project a point A on a line defined with a vector V and a point B

Parameters
  • Xa (list/numpy.array of float) – Coordinates of A point, we want to project

  • Xb (list/numpy.array of float) – Coordinates of B point, the origin point of the vector

  • Xv (list/numpy.array of float) – Coordinates of the line direction vector

Returns

  • Xh (numpy.array of float) – Coordinates of H point, projection of A

  • D (float) – Distance between A and H

geodezyx.conv.conv_geometric.pythagore(a, b, c=0)

Computes Pythagore’s formula

geodezyx.conv.conv_geometric.relative_orientation(x1, y1, x2, y2, trigo_orient=True)

Return the angle between a point 1 and a point 2 (reference vector : to the right)

geodezyx.conv.conv_geometric.vincenty_full(point1, point2, miles=False, full=True, azimuth_in_deg=True)

Vincenty’s formula (inverse method) to calculate the distance (in kilometers or miles) between two points on the surface of a spheroid. Gives also the Azimuth between 2 points

Parameters
  • point1 (iterable of float) – coordinates of the points

  • point2 (iterable of float) – coordinates of the points

  • miles (bool) – kilometers if True

  • full (bool) – Description param3

  • azimuth_in_deg (bool) – azimut in Rad if False

Returns

  • s (float) – Distance betwwen the 2 points

  • fwdAz,revAz (float) – Forward and Reverse Azimuth between the 2 points

  • Source

  • ——

  • https (//github.com/maurycyp/vincenty/blob/master/vincenty/)

Examples

>>> vincenty((0.0, 0.0), (0.0, 0.0))  # coincident points
0.0
>>> vincenty((0.0, 0.0), (0.0, 1.0))
111.319491
>>> vincenty((0.0, 0.0), (1.0, 0.0))
110.574389
>>> vincenty((0.0, 0.0), (0.5, 179.5))  # slow convergence
19936.288579
>>> vincenty((0.0, 0.0), (0.5, 179.7))  # failure to converge
>>> boston = (42.3541165, -71.0693514)
>>> newyork = (40.7791472, -73.9680804)
>>> vincenty(boston, newyork)
298.396057
>>> vincenty(boston, newyork, miles=True)
185.414657

geodezyx.conv.conv_interpolators module

Created on Tue Aug 24 13:58:51 2021

@author: psakicki

class geodezyx.conv.conv_interpolators.Slerp_time(times, rotations, extrapolate=True)

Bases: scipy.spatial.transform.rotation.Slerp

Slerp interpolation (for quaterinons) with datetime as inputs

This class inherites from scipy.spatial.transform.Slerp and can take as input datetime as X

  1. Sakic 2020-01

class geodezyx.conv.conv_interpolators.interp1d_time(x, y, kind='linear', axis=- 1, copy=True, bounds_error=None, fill_value=nan, assume_sorted=False)

Bases: scipy.interpolate.interpolate.interp1d

Interpolation with datetime as inputs

This class inherites from scipy.interpolate.interp1d and can take as input datetime as X

Pierre Sakic 2020-01

dtype

geodezyx.conv.conv_proj_carto module

Created on Thu Aug 13 15:11:12 2020

@author: psakicki

This sub-module of geodezyx.conv deals with cartographic projections.

it can be imported directly with: from geodezyx import conv

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU GPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (GFZ, pierre.sakic@gfz-postdam.de) GitHub repository : https://github.com/GeodeZYX/GeodeZYX-Toolbox_v4

geodezyx.conv.conv_proj_carto.lambert_projection(long, lat, n, c, e, lc, Xs, Ys)

ALG0003 in NTG_71 (IGN Lambert Projection Tech document)

geodezyx.conv.conv_proj_carto.lambert_projection_CC_frontend(long, lat, NZ=93)

Project WGS84/ITRF Latitude/Longitude to Lambert Conique Conforme

Parameters
  • long (float) – WGS84/ITRF Longitude/Latitude

  • lat (float) – WGS84/ITRF Longitude/Latitude

  • NZ (int) – Lambert93, NZ = 0 or = 93

Returns

  • X,Y (float) – Projected coordinates

  • Source

  • ——

  • https (//fr.wikipedia.org/wiki/Projection_conique_conforme_de_Lambert)

  • geodesie.ign.fr/contenu/fichiers/documentation/algorithmes/notice/NTG_71.pdf

  • https (//geodesie.ign.fr/contenu/fichiers/documentation/rgf93/Lambert-93.pdf)

geodezyx.conv.conv_proj_carto.lambert_secante_parameter(a, e, l0, phi0, phi1, phi2, X0, Y0)

ALG0054 in NTG_71 (IGN Lambert Projection Tech document)

geodezyx.conv.conv_proj_carto.latitude_isometric(phi, e)

ALG0001 in NTG_71 (IGN Lambert Projection Tech document)

geodezyx.conv.conv_rotation_matrices module

Created on Thu Aug 13 15:11:12 2020

@author: psakicki

This sub-module of geodezyx.conv deals with rotation, implemented with matrices.

it can be imported directly with: from geodezyx import conv

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU GPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (GFZ, pierre.sakic@gfz-postdam.de) GitHub repository : https://github.com/GeodeZYX/GeodeZYX-Toolbox_v4

geodezyx.conv.conv_rotation_matrices.C_2D(theta, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_cep2itrs(xpole, ypole)

xpole and ypole are given in mas, miliarcsecond

Hofmann-Wellenhof,et al. 2008 - GNSS - p21 Xu - 2007 - GPS - p17 Xu - Orbits - p15

geodezyx.conv.conv_rotation_matrices.C_ecef2enu(phi, llambda, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_ecef2ned(phi, llambda, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_eci2rtn(P, V)

gives the transformation matrix between ECI ref. frame and RTN (aka RIC or RSW)

Parameters
  • P (numpy.array) – 3D vector, position of the object in ECI frame

  • V (numpy.array) – 3D vector, velocity of the object in ECI frame

Returns

  • C_eci2rtn (numpy.array) – transformation matrix

  • Source

  • ——

  • “Coordinate Systems”, ASEN 3200 1/24/06 George H. Born

  • https (//www.colorado.edu/ASEN/asen3200/handouts/Coordinate%20System.pdf)

geodezyx.conv.conv_rotation_matrices.C_enu2ecef(phi, llambda, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_enu2ned()
geodezyx.conv.conv_rotation_matrices.C_euler(phi, theta, psi)

Gives the matrix of an Euler rotation

geodezyx.conv.conv_rotation_matrices.C_ned2ecef(phi, llambda, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_ned2enu()
geodezyx.conv.conv_rotation_matrices.C_rpy2enu(roll, pitch, yaw, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_rpy2enu2(roll, pitch, yaw, angtype='deg')
geodezyx.conv.conv_rotation_matrices.C_rtn2rpy()
geodezyx.conv.conv_rotation_matrices.C_x(theta)

Gives the rotation matrix along the X-axis

Manage iterable (list, array) as input

[1,0, 0] [0,C,-S] [0,S, C]

geodezyx.conv.conv_rotation_matrices.C_y(theta)

Gives the rotation matrix around the Y-axis

Manage iterable (list, array) as input

[ C,0,S] [ 0,1,0] [-S,0,C]

geodezyx.conv.conv_rotation_matrices.C_z(theta)

Gives the rotation matrix around the Z-axis

[C,-S,0] [S, C,0] [0, 0,1]

geodezyx.conv.conv_rotation_matrices.add_offset(Direction, Delta, Point=None, out_delta_enu=False)

Un mode adhoc a du être implémenté dans la fonction élémentaire vector_RPY pour que ça puisse marcher correctement, reste à comprendre pourquoi …

out_delta_enu est prioritaire sur les autres modes de sortie et renvoie le delta

par défaut on a le delta + le vecteur Direction et si Point est précisé : Point + Direction

geodezyx.conv.conv_rotation_matrices.rot_quelconq(theta, Vx, Vy, Vz, angtype='deg')
geodezyx.conv.conv_rotation_matrices.vector_RPY(V, out_deg=True, ad_hoc_mode=False)

Donne le “Roll Pitch Yaw” pour un Point/Vecteur (les coordonnées spheriques plus exactement, le roll sera tjrs nul)

le ad_hoc_mode est la pour corriger un bug que je n’explique pas pour l’utilisation de ads_offset (cette methode a été trouvé par les scripts ENURPY2 et ENURPY3)

geodezyx.conv.conv_time module

Created on Thu Aug 13 15:11:12 2020

@author: psakicki

This sub-module of geodezyx.conv deals with time conversion.

it can be imported directly with: from geodezyx import conv

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU GPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (GFZ, pierre.sakic@gfz-postdam.de) GitHub repository : https://github.com/GeodeZYX/GeodeZYX-Toolbox_v4

geodezyx.conv.conv_time.MJD2dt(mjd_in, seconds=None, round_to='1s')

Time representation conversion

Modified Julian Day => Python’s Datetime

Parameters
  • mjd_in (float/int or list/numpy.array of float/int.) – Modified Julian Day. Can handle several float/int in an iterable.

  • seconds (float/int or list/numpy.array of float/int.) – Handle a number

  • round_to (str or None) – round the output datetime see round_dt function for details

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

Note

Modified Julian Day starts at 0h Nov 17, 1858 (JD − 2400000.5)

https://en.wikipedia.org/wiki/Julian_day

geodezyx.conv.conv_time.convert_partial_year(number)

DISCONTINUED use year_decimal2dt instead (which is the same)

geodezyx.conv.conv_time.date2dt(date_in)

Time Python type conversion

Python’s Date => Python’s Datetime

Parameters

date_in (date or list/numpy.array of date.) – Date(s). Can handle several dates in an iterable.

Returns

L – Time as Datetime(s)

Return type

Datetime or list of Datetime

geodezyx.conv.conv_time.date_string_2_dt(strin)

Time representation conversion

String => Python’s Datetime

Wrapper of dateutil.parser.parse

The input string should looks like a timestamp

Parameters

strin (string or list/numpy.array of strings.) – string(s). Can handle several datetimes in an iterable.

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.date_to_jd(year, month, day)
geodezyx.conv.conv_time.datestr_gins_filename_2_dt(datestrin)

Time representation conversion

GINS filename time format => Python’s Datetime

GINS filename time format : ‘YYMMDD_HHMMSS’

It is the time format used in the listing names

Parameters

datestrin (string or list/numpy.array of string.) – GINS filename time format string(s). Can handle several string in an iterable.

Returns

dtout – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.datestr_sinex_2_dt(datestrin)

Time representation conversion

SINEX time format => Python’s Datetime

SINEX time format : ‘YY:DDD:SSSSS’ or ‘YYYY:DDD:SSSSS’

Parameters

datestrin (string or list/numpy.array of string.) – SINEX time format string(s). Can handle several string in an iterable.

Returns

dtout – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.datetime64_numpy2dt(npdt64_in)

Time Python type conversion

Numpy’s datetime64 => Python’s Datetime

This function is depreciated !!!!!

use numpy_dt2dt instead !!!!!

Parameters

npdt64_in (datetime64 or list/numpy.array of datetime64.) – Numpy’s datetime64(s). Can handle several datetimes in an iterable.

Returns

  • L (Datetime or list of Datetime) – Time as Datetime(s)

  • Source

  • ——

  • https (//stackoverflow.com/questions/13703720/converting-between-datetime-timestamp-and-datetime64)

geodezyx.conv.conv_time.datetime_improved(*args)
geodezyx.conv.conv_time.doy2dt(year, days, hours=0, minutes=0, seconds=0)

Time representation conversion

Day of Year Time => Python’s datetime

Parameters
  • year (float or list/numpy.array of floats.) – year, days of year

  • days (float or list/numpy.array of floats.) – year, days of year

  • hours (float or list/numpy.array of floats, optional) – hours, minutes, seconds

  • minutes (float or list/numpy.array of floats, optional) – hours, minutes, seconds

  • seconds (float or list/numpy.array of floats, optional) – hours, minutes, seconds

Returns

L – Datetime(s)

Return type

datetime or list/numpy.array of datetime.

geodezyx.conv.conv_time.dt2MJD(dtin)

Time representation conversion

Python’s Datetime => Modified Julian Day

Parameters

dtin (datetime or list/numpy.array of datetime.) – Datetime(s). Can handle several datetimes in an iterable.

Returns

L – Modified Julian Day(s)

Return type

float or list of floats

Note

Modified Julian Day starts at 0h Nov 17, 1858 (JD − 2400000.5)

https://en.wikipedia.org/wiki/Julian_day

geodezyx.conv.conv_time.dt2date(dt_in)

Time Python type conversion

Python’s Datetime => Python’s Date

Parameters

dt_in (datetime or list/numpy.array of datetime.) – Datetime(s). Can handle several datetimes in an iterable.

Returns

L – Time as Datetime(s)

Return type

Datetime or list of Datetime

geodezyx.conv.conv_time.dt2doy(dtin, outputtype=<class 'str'>)
geodezyx.conv.conv_time.dt2doy_year(dtin, outputtype=<class 'str'>)

Time representation conversion

Python’s datetime => Day of Year, Year

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

Returns

doy , year – Day of Year and Year Is a list of tuple if the input is an iterable

Return type

tuple of int

geodezyx.conv.conv_time.dt2fracday(dtin)

Time representation conversion

Python’s datetime => Fraction of the day

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

Returns

fraction_day – Fractional of the day Is a list of int if the input is an iterable

Return type

float

geodezyx.conv.conv_time.dt2gpstime(dtin, dayinweek=True, inp_ref='utc', outputtype=<class 'int'>)

Time scale conversion

Python’s datetime (UTC,TAI or GPS time scale) => GPS time

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

  • inp_ref (str) – “utc” : apply the 19 sec & leap second correction at the epoch “gps” : no correction applied “tai” : apply -19 sec correction

  • dayinweek (bool) –

    if True : returns GPS week, day in GPS week

    if False : returns GPS week, sec in GPS week

Returns

GPS_week, GPS_day/GPS_sec – GPS week or GPS day/GPS sec

Is a list of tuple if the input is an iterable

Return type

tuple of int

geodezyx.conv.conv_time.dt2gpsweek_decimal(dtin, return_middle_of_day=True)

Time representation conversion

Python’s datetime => GPS week

Return the GPS week in a decimal mode

(Easier for plots)

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

  • return_middle_of_day (bool) – if False, return the decimal part of the week at the begining of the day

Returns

GPS_week_decimal – decimal GPS week

Is a list of float if the input is an iterable

Return type

float

geodezyx.conv.conv_time.dt2jjulCNES(dtin, onlydays=True)

Time representation & scale conversion

Python’s Datetime => Julian Day CNES

Parameters
  • dtin (datetime or list/numpy.array of datetime.) – Datetime(s). Can handle several datetimes in an iterable.

  • only_days (bool) – if False, return also the seconds in the day

Returns

L – Julian Day CNES, [seconds in the Day]

Return type

int or list of int.

Note

Julian Day CNES starts at 0h Jan 1, 1950 (JD − 2433282.5)

https://www.aviso.altimetry.fr/fr/donnees/outils/jours-calendaires-ou-jours-juliens.html

geodezyx.conv.conv_time.dt2list(dtin, return_useful_values=True)

Time representation conversion

Python’s Datetime => Years, Months, Days, Hours, Minutes, Seconds

Parameters
  • dtin (datetime) – Datetime

  • return_useful_values (bool) – if True, returns only Years, Months, Days

Returns

L – Years, Months, Days, [Hours, Minutes, Seconds]

Return type

list of int

geodezyx.conv.conv_time.dt2posix(dtin, out_array=False)

Time representation conversion

Python’s Datetime => POSIX Time

Parameters
  • dtin (datetime or list/numpy.array of datetime.) – Datetime(s). Can handle several datetimes in an iterable.

  • out_array (bool) – if iterable as input, force the output as a Numpy array

Returns

L – POSIX Time(s)

Return type

float or list/numpy.array of floats

geodezyx.conv.conv_time.dt2secinday(dtin)

Time representation conversion

Python’s datetime => Seconds in days

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

Returns

secinday – Seconds in the day Is a list of int if the input is an iterable

Return type

int

geodezyx.conv.conv_time.dt2sp3_timestamp(dtin, start_with_star=True)

Time representation conversion

Python’s Datetime => SP3 Timestamp e.g.

  • 2000 5 28 0 0 0.00000000

geodezyx.conv.conv_time.dt2str(dtin, str_format='%Y-%m-%d %H:%M:%S')

Time representation conversion

Python’s Datetime => String

Just a wrapper of strftime

Parameters

dtin (datetime or list/numpy.array of datetime.) – Datetime(s). Can handle several datetimes in an iterable.

Returns

  • L (string or list of strings) – Time as string(s)

  • Source

  • ——

  • https (//stackoverflow.com/questions/7999935/python-datetime-to-string-without-microsecond-component)

  • http (//www.jacksay.com/tutoriaux/bash-shell/bashshell-utilisation-commande-date.html)

geodezyx.conv.conv_time.dt2tuple(dtin)
geodezyx.conv.conv_time.dt2year_decimal(dtin)

Time representation conversion

Python’s Datetime => Decimal Year

Parameters

dtin (datetime or list/numpy.array of datetime.) – Datetime(s). Can handle several datetimes in an iterable.

Returns

L – Decimal Year(s)

Return type

float or list/numpy.array of floats

geodezyx.conv.conv_time.dt2ymdhms(dtin, with_microsec=True)

Time representation conversion

Python’s Datetime => Lists of Years, Months, Days, Hours, Minutes, Seconds

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Python DateTime

  • with_microsec (bool) – if False : rounding the microsecs to the nearest sec

Returns

Return type

tuple with year , month , day , hour , minute , second , microsecond

geodezyx.conv.conv_time.dt_2_sinex_datestr(dtin, short_yy=True, year_sep=':')

Time representation conversion

Python’s Datetime => SINEX time format

Parameters

dtin (datetime) –

Returns

  • dtout (str) – Date in SINEX format

  • year_sep (str) – year separator, usually :, but can also be empty

geodezyx.conv.conv_time.dt_2_sp3_datestr(dtin)

Time representation conversion

Python’s Datetime => SP3 time format

Parameters

dtin (datetime) –

Returns

dtout – Date in SP3 format

Return type

str

geodezyx.conv.conv_time.dt_ceil(dtin)

Round a datetime object to the begining of the day

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime you want to round, default now. Can handle several datetimes in an iterable.

Returns

dtout – Rounded Datetime

Return type

datetime or list/numpy.array of datetime

geodezyx.conv.conv_time.dt_gpstime2dt_tai(dtgpsin, out_array=False)

Time scale conversion

Datetime in GPS Time Scale => Datetime in TAI Time Scale

Correct d the 19sec difference between GPS Time and TAI

Parameters
  • dtin (datetime or list/numpy.array of datetime.) – Datetime(s) in GPS Time Scale. Can handle several datetimes in an iterable.

  • out_array (bool) – if iterable as input, force the output as a Numpy array

Returns

L – Datetime(s) in TAI Time Scale

Return type

datetime or list/numpy.array of datetime.

geodezyx.conv.conv_time.dt_gpstime2dt_utc(dtgpsin, out_array=False)

Time scale conversion

Datetime in GPS Time Scale => Datetime in UTC Time Scale

Correct both the Leap second and the 19sec difference between GPS Time and UTC

Parameters
  • dtin (datetime or list/numpy.array of datetime.) – Datetime(s) in GPS Time Scale. Can handle several datetimes in an iterable.

  • out_array (bool) – if iterable as input, force the output as a Numpy array

Returns

L – Datetime(s) in UTC Time Scale

Return type

datetime or list/numpy.array of datetime.

geodezyx.conv.conv_time.dt_improved(*args)
geodezyx.conv.conv_time.dt_in_local_timezone2posix(dtin)
geodezyx.conv.conv_time.dt_range(start_dt, end_dt, day_step=1, sec_step=0)

Range of datetime between a start and end (included)

Parameters
  • start_dt (datetime) – Datetimes

  • end_dt (datetime) – Datetimes

Returns

Out_range – range of dates

Return type

list of datetime

geodezyx.conv.conv_time.dt_round(dtin=None, roundTo=60)

Round a datetime object to any time laps in seconds

This function is depreciated !!! Use round_dt instead !!!

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Datetime you want to round, default now. Can handle several datetimes in an iterable.

  • roundTo (int) – Closest number of seconds to round to, default 1 minute.

Returns

dtout – Rounded Datetime

Return type

datetime or list/numpy.array of datetime

geodezyx.conv.conv_time.dt_tai2dt_tt(dtin)

Time scale conversion

Python’s datetime in TAI => Python’s datetime in Terrestrial Time (TT)

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

Returns

  • L (list of datetime) – converted DateTimes

  • Source

  • ——

  • https (//en.wikipedia.org/wiki/Terrestrial_Time)

Note

Realization of the TT by the BIPM (restimation and correction by dozen of µsec) https://www.bipm.org/en/bipm-services/timescales/time-ftp/ttbipm.html

geodezyx.conv.conv_time.dt_tai2dt_utc(dtin)

Time scale conversion

Python’s datetime in TAI => Python’s datetime in UTC

(Wrapper to correct the leap second)

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

Returns

L – converted DateTimes

Return type

list of datetime

Note

TAI is (currently) ahead of UTC

geodezyx.conv.conv_time.dt_utc2dt_tai(dtin)

Time scale conversion

Python’s datetime in UTC => Python’s datetime in TAI

(Wrapper to correct the leap second)

Parameters

dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

Returns

L – converted DateTimes

Return type

list of datetime

Note

TAI is (currently) ahead of UTC

geodezyx.conv.conv_time.dt_utc2dt_ut1(dtin, dUT1)

Time scale conversion

Python’s datetime in UTC => Python’s datetime in UT1

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

  • dUT1 (float) – UT1-UTC in seconds.

Returns

L – converted DateTimes

Return type

list of datetime

geodezyx.conv.conv_time.dt_utc2dt_ut1_smart(dtin, DF_EOP_in, use_interp1d_obj=True, EOP_interpolator=None)

Time scale conversion

Python’s datetime in UTC => Python’s datetime in UT1 using an EOP DataFrame provided by files_rw.read_eop_C04

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Datetime(s). Can handle several datetimes in an iterable.

  • DF_EOP_in (DataFrame) – EOP DataFrame for the UT1-UTC provided by files_rw.read_eop_C04

  • use_interp1d_obj (TYPE, optional) – Use an interp1d_time Interpolator object for the EOP determination at the right epoch. Faster in recursive mode when dtin is a list/array The default is True.

  • EOP_interpolator (interp1d_time object, optional) – The interp1d_time Interpolator object for the EOP determination Will be determined automatically inside the function The default is None.

Returns

DESCRIPTION.

Return type

TYPE

geodezyx.conv.conv_time.epo_epos_converter(inp, inp_type='mjd', out_type='yyyy', verbose=False)

Frontend for the GFZ EPOS epo converter

Parameters
  • inp (string or int) – the input day, like 58773 2019290 20754 …

  • inp_type (str) – An output format managed by epo command : wwwwd,yyddd,yyyyddd,yyyymmdd

  • out_type (str) – An output format managed by epo command : mjd,yyyy,yy,ddd,mon,dmon,hour,min,sec,wwww,wd

Returns

year – Year as integer. Years preceding 1 A.D. should be 0 or negative. The year before 1 A.D. is 0, 10 B.C. is year -9.

Return type

int

geodezyx.conv.conv_time.find_leapsecond(dtin, get_leapsec_lis=[], apply_initial_delta=True)

Find the TAI-UTC leap second for a given datetime

Parameters
  • dtin (datetime) – Epoch for which the leap second is researched

  • get_leapsec_lis (list, optional) – A list of leap second, provided by get_leapsecond_frontend() automatically determined if given list is empty

  • apply_initial_delta (bool, optional) – See note below

Returns

leapsec_out – The leap second for the given epoch

Return type

int

Note

Le temps universel (UT1) et le Temps atomique international (TAI) ont été définis comme égaux en 1958. Lors de la mise en place d’UTC en 1972, UT1 s’était décalé d’environ 10 secondes par rapport au TAI. On choisit donc un décalage initial de 10 secondes entre UTC et TAI .

In 1972, the leap-second system was introduced so that the broadcast UTC seconds could be made exactly equal to the standard SI second, while still maintaining the UTC time of day and changes of UTC date synchronized with those of UT1 (the solar time standard that superseded GMT).[11] By then, the UTC clock was already 10 seconds behind TAI, which had been synchronized with UT1 in 1958, but had been counting true SI seconds since then. After 1972, both clocks have been ticking in SI seconds, so the difference between their readouts at any time is 10 seconds plus the total number of leap seconds that have been applied to UTC (37 seconds as of January 2017).

geodezyx.conv.conv_time.get_leapsecond_frontend()

INTERNAL_FUNCTION

Nota :

Le temps universel (UT1) et le Temps atomique international (TAI) ont été définis comme égaux en 1958. Lors de la mise en place d’UTC en 1972, UT1 s’était décalé d’environ 10 secondes par rapport au TAI. On choisit donc un décalage initial de 10 secondes entre UTC et TAI .

the initial 10sec are added in find_leapsecond

geodezyx.conv.conv_time.gpstime2dt(gpsweek, gpsdow_or_seconds, dow_input=True, output_time_scale='utc')

Time scale & representation conversion

GPS Time => Python’s datetime

Parameters
  • gpsweek (int) – year, days of year

  • gpsdow_or_seconds (int) – Day of Week OR Seconds in Weeks

  • dow_input (bool) – select if Day of Week (True) OR Seconds in Weeks (False)

  • output_time_scale (str) – gives the wished time scale : “utc”, “tai”, “gps”

Returns

L – DateTime

Return type

datetime or list/numpy.array of datetime.

Note

Only reliable at the day level for the moment

the leapsecond is found only after a first calc without leapsecond it can be some side effects when the input time is close to a leap second jump

https://gist.github.com/jeremiahajohnson/eca97484db88bcf6b124

geodezyx.conv.conv_time.gpstime2utc_bad(gpsweek, gpssecs, utc_offset)

DISCONTINUED FUNCTION, TOO UNSTABLE (171017) use gpstime2dt instead

[year,month,day,hour,minute,sec] = gpstime2utc(gpsweek,gpssecs,utc_offset) Converts GPS week and seconds into UTC time, Python version, March 2009

geodezyx.conv.conv_time.gpsweek_decimal2dt(gpsweekdec_in)

Time representation conversion

Decimal GPS Week => Python’s datetime

Parameters

gpsweekdec_in (float or list/numpy.array of float) – GPS week in decimal form.

Returns

L – converted DateTimes

Return type

list of datetime

geodezyx.conv.conv_time.hr_to_Day(hr, minu, sec)

Convert Julian Day to date.

Parameters

jd (float) – Julian Day

Returns

  • year (int) – Year as integer. Years preceding 1 A.D. should be 0 or negative. The year before 1 A.D. is 0, 10 B.C. is year -9.

  • month (int) – Month as integer, Jan = 1, Feb. = 2, etc.

  • day (float) – Day, may contain fractional part.

Examples

Convert Julian Day 2446113.75 to year, month, and day.

>>> jd_to_date(2446113.75)
(1985, 2, 17.25)
geodezyx.conv.conv_time.jd_to_date(jd)

Convert Julian Day to date.

Parameters

jd (float) – Julian Day

Returns

  • year (int) – Year as integer. Years preceding 1 A.D. should be 0 or negative. The year before 1 A.D. is 0, 10 B.C. is year -9.

  • month (int) – Month as integer, Jan = 1, Feb. = 2, etc.

  • day (float) – Day, may contain fractional part.

Examples

Convert Julian Day 2446113.75 to year, month, and day.

>>> jd_to_date(2446113.75)
(1985, 2, 17.25)
geodezyx.conv.conv_time.jd_to_mjd(jd)

Convert Julian Day to Modified Julian Day

Parameters

jd (float) – Julian Day

Returns

mjd – Modified Julian Day

Return type

float

geodezyx.conv.conv_time.jjulCNES2dt(jjulin)

Time representation & scale conversion

Julian Day CNES => Python’s Datetime

Parameters

jjulin (float/int or list/numpy.array of float/int.) – Julian Day CNES. Can handle several float/int in an iterable.

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

Note

Julian Day CNES starts at 0h Jan 1, 1950 (JD − 2433282.5)

https://www.aviso.altimetry.fr/fr/donnees/outils/jours-calendaires-ou-jours-juliens.html

geodezyx.conv.conv_time.leap_seconds(f)
Return a list of tuples of this format: (timestamp, number_of_seconds)

timestamp: a 32-bit timestamp, seconds since the UNIX epoch number_of_seconds: how many leap-seconds occur at timestamp

INTERNAL_FUNCTION

http://stackoverflow.com/questions/19332902/extract-historic-leap-seconds-from-tzdata

geodezyx.conv.conv_time.matlab_time2dt(matlab_datenum)

Time representation conversion

MATLAB Time => Datetime

Parameters

matlab_datenum (float or list/numpy.array of float) – MATLAB time(s). Can handle several time floats in a list.

Returns

python_datetime – Converted Datetime(s)

Return type

datetime or list/numpy.array of datetime

geodezyx.conv.conv_time.mjd_to_jd(mjd)

Convert Modified Julian Day to Julian Day.

Parameters

mjd (float) – Modified Julian Day

Returns

jd – Julian Day

Return type

float

geodezyx.conv.conv_time.numpy_datetime2dt(npdtin)

Time representation conversion

Numpy Datetime => Datetime

This function is depreciated !!! Use numpy_dt2dt instead !!!

Parameters

npdtin (np.datetime64 or list/numpy.array of np.datetime64) – Numpy Datetime. Can handle several time in a list.

Returns

  • python_datetime (datetime or list/numpy.array of datetime) – Converted Datetime(s)

  • Source

  • ——

  • https (//stackoverflow.com/questions/29753060/how-to-convert-numpy-datetime64-into-datetime/29755657)

geodezyx.conv.conv_time.numpy_dt2dt(numpy_dt_in)

Time representation conversion

Numpy datetime64 object => Python’s Datetime

Parameters

numpy_dt_in (numpy datetime64 object) – numpy datetime64 object

Returns

  • dt (datetime or list/numpy.array of datetime) – Converted Datetime(s) If the input is a Pandas Series, the output is forced as an array

  • source

  • ——

  • https (//gist.github.com/blaylockbk/1677b446bc741ee2db3e943ab7e4cabd)

geodezyx.conv.conv_time.pandas_timestamp2dt(timestamp_in)

Time Python type conversion

Pandas’s Timestamp => Python’s Datetime

Parameters

timestamp_in (Timestamp or list/numpy.array of Timestamp.) – Pandas’s Timestamp(s). Can handle several datetimes in an iterable.

Returns

L – Time as Datetime(s)

Return type

Datetime or list of Datetime

geodezyx.conv.conv_time.posix2dt(posixin, out_array=False)

Time representation conversion

POSIX Time => Python’s Datetime

Parameters
  • posixin (float or list/numpy.array of floats.) – POSIX Time. Can handle several time in a list.

  • out_array (bool) – if iterable as input, force the output as a Numpy array

Returns

L – Converted Datetime(s)

Return type

datetime or list/numpy.array of datetime.

geodezyx.conv.conv_time.posix2dt_in_local_timezone(posixin)
geodezyx.conv.conv_time.print_leaps(leap_lst)

INTERNAL_FUNCTION

geodezyx.conv.conv_time.rinex_regex(compressed=True, compiled=False)

Return a regex corresponding to a RINEX name (old convention)

Parameters
  • compressed (bool) – return a the regex for a compressed rinex

  • compiled (bool) – return a Python regex object already compliled

Returns

out – a regex

Return type

string or python’s regex

geodezyx.conv.conv_time.rinex_regex_new_name(compressed=None, compiled=False)

Return a regex corresponding to a RINEX name (new convention)

Parameters

compressed (bool or None) – return a the regex for a compressed rinex if None, does not matter (return both compressed or not)

compiledbool

return a Python regex object already compliled

Returns

out – a regex

Return type

string or python’s regex

geodezyx.conv.conv_time.rinex_regex_new_name_brdc(compressed=None, compiled=False)

Return a regex corresponding to a BROADCAST RINEX name (new convention)

Parameters

compressed (bool or None) – return a the regex for a compressed rinex if None, does not matter (return both compressed or not)

compiledbool

return a Python regex object already compliled

Returns

out – a regex

Return type

string or python’s regex

geodezyx.conv.conv_time.rinex_regex_new_name_brdc_gfz_godc(compressed=None, compiled=False)

Return a regex corresponding to a BROADCAST RINEX name (new convention) from the GFZ’s GODC archive

Parameters

compressed (bool or None) – return a the regex for a compressed rinex if None, does not matter (return both compressed or not)

compiledbool

return a Python regex object already compliled

Returns

out – a regex

Return type

string or python’s regex

geodezyx.conv.conv_time.rinexname2dt(rinexpath)

Time representation conversion

RINEX Name (old or new naming convention) => Python’s Datetime

Extract the date in a RINEX name

Parameters

rinexpath (string) – RINEX path. The RINEX basename will be extracted automatically.

Returns

dt – Datetime

Return type

datetime

geodezyx.conv.conv_time.roundTime(*args)

Wrapper of dt_round for legacy reasons

geodezyx.conv.conv_time.round_dt(dtin, round_to, python_dt_out=True)

Round a datetime object to any time laps in seconds

Parameters
  • dtin (datetime or list/numpy.array of datetime) – Datetime you want to round Can handle several datetimes in an iterable.

  • round_to (str) –

    The way to round the datetime.

    It follows the Pandas’ Series conventions, e.g.:

    • one-day rounding: ‘1D’

    • one-minute rounding: ‘1min’

    • one-second rounding: ‘1s’

    Full list is in the Note’s link

  • python_dt_out (bool, optional) – If True, it returns the date as a legacy Python’s DateTime. If False, it returns a Pandas Timestamp. The default is True.

Returns

dtout – Rounded Datetime

Return type

datetime or list/numpy.array of datetime

geodezyx.conv.conv_time.sp3name2dt(sp3path)

Time representation conversion

Orbit SP3 Name (legacy/new naming convention) => Python’s Datetime

Extract the date in a Orbit SP3 name

Parameters

sp3path (string) – Orbit SP3 path. The basename will be extracted automatically.

Returns

dt – Datetime

Return type

datetime

geodezyx.conv.conv_time.sp3name_leg_2dt(sp3path)

Time representation conversion

Orbit SP3 Name (old/legacy naming convention) => Python’s Datetime

Extract the date in a Orbit SP3 name

Parameters

sp3path (string) – Orbit SP3 path. The basename will be extracted automatically.

Returns

dt – Datetime

Return type

datetime

geodezyx.conv.conv_time.sp3name_v3_2dt(sp3path)

Time representation conversion

Orbit SP3 Name (new naming convention) => Python’s Datetime

Extract the date in a Orbit SP3 name

Parameters

sp3path (string) – Orbit SP3 path. The basename will be extracted automatically.

Returns

dt – Datetime

Return type

datetime

geodezyx.conv.conv_time.statname_dt2rinexname(statname, datein, rnxtype='d.Z', session_a_instead_of_daily_session=False)

Time representation conversion

Python’s Datetime (and station name) => RINEX name

Create a RINEX name from a station name and date

Parameters
  • statname (string) – name of the station

  • datein (datetime) – date of the wished RINEX name

  • rnxtype (string) – extension of the RINEX (“d.Z”,”.o”) …

  • session_a_instead_of_daily_session (bool) – if True, gives an hourly session name (a,b,c …) instead of a daily session (0)

Returns

rinexname – The name of the RINEX

Return type

string

geodezyx.conv.conv_time.str_date2dt(strin)

Time representation conversion

String => Python’s Datetime

Wrapper of dateutil.parser.parse

The input string should looks like a timestamp

Parameters

strin (string or list/numpy.array of strings.) – string(s). Can handle several datetimes in an iterable.

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.strdate2dt(strin)

Time representation conversion

String => Python’s Datetime

Wrapper of dateutil.parser.parse

The input string should looks like a timestamp

Parameters

strin (string or list/numpy.array of strings.) – string(s). Can handle several datetimes in an iterable.

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.string_date2dt(strin)

Time representation conversion

String => Python’s Datetime

Wrapper of dateutil.parser.parse

The input string should looks like a timestamp

Parameters

strin (string or list/numpy.array of strings.) – string(s). Can handle several datetimes in an iterable.

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.tgipsy2dt(tin)

Time representation conversion

GIPSY Time => Datetime

Parameters

tin (float or list/numpy.array of float) – GIPSY time(s). Can handle several time float in a list.

Returns

dtout – Converted Datetime(s)

Return type

datetime or list/numpy.array of datetime

Note

GIPSY time is not the ‘real’ J2000 but only counted starting from 1st January 2000 at Noon

geodezyx.conv.conv_time.toYearFraction(date)

DISCONTINUED use dt2year_decimal instead (which is the same)

geodezyx.conv.conv_time.tup_or_lis2dt(lisin)

Time representation conversion

Date-looking strings => Python’s datetime

Parameters

lisin (iterable (tuple/list/numpy.array) of string.) – list of Date-looking strings like : [“2018”,”12”,”31”,”12”,”30”,”00”]

Returns

L – converted DateTimes

Return type

list of datetime

geodezyx.conv.conv_time.utc2gpstime(year, month, day, hour, min, sec)

looks useless and discontinued (210219)

geodezyx.conv.conv_time.utc2gpstime_bad(year, month, day, hour, min, sec)
geodezyx.conv.conv_time.year_decimal2dt(yearin)

Time representation conversion

Decimal Year => Python’s Datetime

Parameters

yearin (float or list/numpy.array of floats.) – Decimal year(s). Can handle several floats in an iterable.

Returns

L – Datetime(s)

Return type

datetime or list of datetime.

geodezyx.conv.conv_time.ymdhms2dt(y=0, mo=0, d=0, h=0, mi=0, s=0, ms=0)

Improved time representation conversion to Datetime

can manage list, array, or floats as input can manage NaN too (return POSIX 0 epoch if NaN)

Parameters
  • y (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

  • mo (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

  • d (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

  • h (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

  • mi (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

  • s (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

  • ms (float or list/numpy.array of floats.) – year , month… . Can handle several times in lists.

Returns

Converted Datetime(s)

Return type

Datetime

geodezyx.conv.conv_time.ymdhms_vectors2dt(yrlis, mlis, dlis, hlis, minlis, slis)

Time representation conversion

Lists of Years, Months, Days, Hours, Minutes, Seconds => Python’s Datetime

Parameters
  • yrlis (float or list/numpy.array of floats.) – Lists of Years, Months, Days, Hours, Minutes, Seconds

  • mlis (float or list/numpy.array of floats.) – Lists of Years, Months, Days, Hours, Minutes, Seconds

  • dlis (float or list/numpy.array of floats.) – Lists of Years, Months, Days, Hours, Minutes, Seconds

  • hlis (float or list/numpy.array of floats.) – Lists of Years, Months, Days, Hours, Minutes, Seconds

  • minlis (float or list/numpy.array of floats.) – Lists of Years, Months, Days, Hours, Minutes, Seconds

  • slis (float or list/numpy.array of floats.) – Lists of Years, Months, Days, Hours, Minutes, Seconds

Returns

L – Datetime(s)

Return type

datetime or list/numpy.array of datetime.