Coordinate Frame Transforms

Introduction

The satkit.frametransform module provides functions for transforming between various coordinate frames used in satellite tracking and orbit determination. These include multiple variations of “inertial” coordinate frames, and multiple verisons of “Earth-fixed” coordinate frames.

Some notes:

  • Most of the algorithms in this module are from the book `”Fundamentals of Astrodynamics and Applications”`` by David Vallado.

  • The frame transforms are defined as arbitrary rotations in a 3-dimensional space. The rotations are a function of time, and are represented as Quaternions

  • The rotation from the Geocentric Celestial Reference Frame (GCRF) to the Earth-Centered Inertial (ECI) frame is defined by the International Astronomical Union (IAU), available here. See IERS Technical Note 36 for the latest values.

API Reference

Transformations between coordinate frames, and associated utility functions

Coordinate frame transforms are mostly pulled from Vallado: https://www.google.com/books/edition/Fundamentals_of_satkitdynamics_and_Applic/PJLlWzMBKjkC?hl=en&gbpv=0

or the IERS: https://www.iers.org/

satkit.frametransform.earth_orientation_params(time: earth_orientation_params.time) tuple[float, float, float, float] | None

Get Earth Orientation Parameters at given instant

Parameters:

time (satkit.time) – Instant at which to query parameters

Returns:

Tuple with following elements:

0 : (UT1 - UTC) in seconds 1 : X polar motion in arcsecs 2 : Y polar motion in arcsecs 3 : LOD: instantaneous rate of change in (UT1-UTC), msec/day 4 : dX wrt IAU-2000A nutation, milli-arcsecs 5 : dY wrt IAU-2000A nutation, milli-arcsecs

Return type:

(float, float, float, float, float, float) | None

satkit.frametransform.earth_rotation_angle(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) float | numpy.typing.ArrayLike[numpy.float]

Earth Rotation Angle

Notes

  • See: IERS Technical Note 36, Chapter 5, Equation 5.15

  • Calculation Details:
    • Let t be UT1 Julian date

    • let f be fractional component of t (fraction of day)

    • ERA = 2𝜋 ((0.7790572732640 + f + 0.00273781191135448 * (t - 2451545.0))

Parameters:

tm (satkit.time|datetime.datetime|list|numpy.array) – Time[s] at which to calculate Earth Rotation Angle

Returns:

Earth Rotation Angle at input time[s] in radians

Return type:

float|numpy.array

satkit.frametransform.gast(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) float | numpy.typing.ArrayLike[numpy.float]

Greenwich Apparent Sideral Time

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – scalar, list, or numpy array of astro.time or datetime.datetime representing time at which to calculate output

Returns:

Greenwich apparant sidereal time, radians, at input time(s)

Return type:

float | npt.ArrayLike[np.float]

satkit.frametransform.gmst(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) float | numpy.typing.ArrayLike[numpy.float]

Greenwich Mean Sidereal Time

Notes

  • GMST is the angle between the vernal equinox and the Greenwich meridian

  • Vallado algorithm 15

  • GMST = 67310.5481 + (876600h + 8640184.812866) * tᵤₜ₁ * (0.983104 + tᵤₜ₁ * −6.2e−6)

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – scalar, list, or numpy array of astro.time or datetime.datetime representing time at which to calculate output

Returns:

Greenwich Mean Sideral Time, radians, at intput time(s)

Return type:

float | npt.ArrayLike[np.float]

satkit.frametransform.qcirs2gcrf(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Rotation from Celestial Intermediate Reference System to Geocentric Celestial Reference Frame

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from CIRS to GCRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qgcrf2itrf(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Quaternion representing rotation from the Geocentric Celestial Reference Frame (GCRF) to the International Terrestrial Reference Frame (ITRF)

Notes

  • Uses full IAU2010 Reduction

  • See IERS Technical Note 36, Chapter 5

  • Does not include solid tides, ocean tides

  • Very computationally expensive

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from GCRF to ITRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qgcrf2itrf_approx(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Quaternion representing approximate rotation from the Geocentric Celestial Reference Frame (GCRF) to the International Terrestrial Reference Frame (ITRF)

Notes

  • Accurate to approx. 1 arcsec

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from GCRF to ITRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qitrf2gcrf(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Quaternion representing rotation from the International Terrestrial Reference Frame (ITRF) to the Geocentric Celestial Reference Frame (GCRF)

Notes

  • Uses full IAU2010 Reduction

  • See IERS Technical Note 36, Chapter 5

  • Does not include solid tides, ocean tides

  • Very computationally expensive

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from ITRF to GCRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qitrf2gcrf_approx(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Quaternion representing approximate rotation from the International Terrestrial Reference Frame (ITRF) to the Geocentric Celestial Reference Frame (GCRF)

Notes

  • Accurate to approx. 1 arcsec

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from ITRF to GCRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qitrf2tirs(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Rotation from Terrestrial Intermediate Reference System to Celestial Intermediate Reference Systems

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from ITRF to TIRS at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qteme2gcrf(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Rotation from True Equator Mean Equinox (TEME) to Geocentric Celestial Reference Frame (GCRF)

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from TEME to GCRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qteme2itrf(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Quaternion representing rotation from the True Equator Mean Equinox (TEME) frame to the International Terrestrial Reference Frame (ITRF)

Notes

  • This is equation 3-90 in Vallado

  • TEME is the output frame of the SGP4 propagator used to compute position from two-line element sets.

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from TEME to ITRF at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

satkit.frametransform.qtirs2cirs(tm: satkit.satkit.time | numpy.typing.ArrayLike[satkit.satkit.time] | datetime.datetime | numpy.typing.ArrayLike[datetime.datetime]) satkit.satkit.quaternion | numpy.typing.ArrayLike[satkit.satkit.quaternion]

Rotation from Terrestrial Intermediate Reference System (TIRS) to the Celestial Intermediate Reference System (CIRS)

Parameters:

tm (satkit.time | npt.ArrayLike[satkit.time] | datetime.datetime | npt.ArrayLike[datetime.datetime]) – Time[s] at which to calculate the quaternion

Returns:

Quaternion representing rotation from TIRS to CIRS at input time(s)

Return type:

quaternion | npt.ArrayLike[quaternion]

class satkit.frametransform.quaternion

Quaternion representing rotation of 3D Cartesian axes

Quaternions perform right-handed rotation of a vector, e.g. rotation of +xhat 90 degrees by +zhat give +yhat

This is different than the convention used in Vallado, but it is the way it is commonly used in mathematics and it is the way it should be done.

For the uninitiated: quaternions are a more-compact and computationally efficient way of representing 3D rotations. They can also be multipled together and easily renormalized to avoid problems with floating-point precision eventually causing changes in the rotated vecdtor norm.

For details, see:

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

Notes

  • Under the hood, this is using the “UnitQuaternion” object in the rust “nalgebra” crate.

angle() float

Return the angle in radians of the rotation

Returns:

Angle in radians of the rotation

Return type:

float

as_euler() Tuple[float, float, float]

Return equivalent rotation angle represented as rotation angles: (“roll”, “pitch”, “yaw”) in radians:

Returns:

Tuple with 3 elements representing the rotation angles in radians

Return type:

tuple[float, float, float]

as_rotation_matrix() numpy.typing.ArrayLike[numpy.float64]

Return 3x3 rotation matrix representing equivalent rotation

Returns:

3x3 rotation matrix representing equivalent rotation

Return type:

npt.ArrayLike[np.float64]

axis() numpy.typing.ArrayLike[numpy.float64]

Return the axis of rotation as a unit vector

Returns:

3-element array representing the axis of rotation as a unit vector

Return type:

npt.ArrayLike[np.float64]

conj() quaternion

Return conjugate or inverse of the rotation

Returns:

Conjugate or inverse of the rotation

Return type:

satkit.quaternion

conjugate() quaternion

Return conjugate or inverse of the rotation

Returns:

Conjugate or inverse of the rotation

Return type:

satkit.quaternion

static from_axis_angle(axis: numpy.typing.ArrayLike[numpy.float64], angle: float) quaternion

Quaternion representing right-handed rotation of vector by “angle” degrees about the given axis

Parameters:
  • axis (npt.ArrayLike[np.float64]) – 3-element array representing axis of rotation

  • angle (float) – angle of rotation in radians

Returns:

Quaternion representing rotation by “angle” degrees about the given axis

Return type:

satkit.quaternion

static from_rotation_matrix(mat: numpy.typing.ArrayLike[numpy.float64]) quaternion

Return quaternion representing identical rotation to input 3x3 rotation matrix

Parameters:

mat (npt.ArrayLike[np.float64]) – 3x3 rotation matrix

Returns:

Quaternion representing identical rotation to input 3x3 rotation matrix

Return type:

satkit.quaternion

static rotation_between(v1: numpy.typing.ArrayLike[numpy.float64], v2: numpy.typing.ArrayLike[numpy.float64]) quaternion

Quaternion represention rotation between two input vectors

Parameters:
  • v1 (npt.ArrayLike[np.float64]) – vector rotating from

  • v2 (npt.ArrayLike[np.float64]) – vector rotating to

Returns:

Quaternion that rotates from v1 to v2

Return type:

satkit.quaternion

static rotx(theta) quaternion

Quaternion representing right-handed rotation of vector by “theta” radians about the xhat unit vector

Parameters:

theta (float) – angle of rotation in radians

Returns:

Quaternion representing right-handed rotation of vector by “theta” radians about the xhat unit vector

Return type:

satkit.quaternion

Notes

Equivalent rotation matrix: | 1 0 0| | 0 cos(theta) -sin(theta)| | 0 sin(theta) cos(theta)|

static roty(theta) quaternion

Quaternion representing right-handed rotation of vector by “theta” radians about the yhat unit vector

Parameters:

theta (float) – angle of rotation in radians

Returns:

Quaternion representing right-handed rotation of vector by “theta” radians about the yhat unit vector

Return type:

satkit.quaternion

Notes

Equivalent rotation matrix: | cos(theta) 0 sin(theta)| | 0 1 0| | -sin(theta) 0 cos(theta)|

static rotz(theta) quaternion

Quaternion representing right-handed rotation of vector by “theta” radians about the zhat unit vector

Parameters:

theta (float) – angle of rotation in radians

Returns:

Quaternion representing right-handed rotation of vector by “theta” radians about the zhat unit vector

Return type:

satkit.quaternion

Notes

Equivalent rotation matrix: | cos(theta) -sin(theta) 0| | sin(theta) cos(theta) 0| | 0 0 1|

slerp(other: quaternion, frac: float, epsilon: float = 1e-06) quaternion

Spherical linear interpolation between self and other

Parameters:
  • other (quaternion) – Quaternion to perform interpolation to

  • frac (float) – fractional amount of interpolation, in range [0,1]

  • epsilon (float, optional) – Value below which the sin of the angle separating both quaternions must be to return an error. Default is 1.0e-6

Returns:

Quaternion representing interpolation between self and other

Return type:

quaternion

class satkit.frametransform.time(*args)

Representation of an instant in time

This has functionality similar to the “datetime” object, and in fact has the ability to convert to an from the “datetime” object. However, a separate time representation is needed as the “datetime” object does not allow for conversion between various time epochs (GPS, TAI, UTC, UT1, etc…)

Notes

  • If no arguments are passed in, the created object represents the current time

  • If year is passed in, month and day must also be passed in

  • If hour is passed in, minute and second must also be passed in

Parameters:
  • year (int, optional) – Gregorian year (e.g., 2024)

  • month (int, optional) – Gregorian month (1 = January, 2 = February, …)

  • day (int, optional) – Day of month, beginning with 1

  • hour (int, optional) – Hour of day, in range [0,23] (optional), default is 0

  • min (int, optional) – Minute of hour, in range [0,59], default is 0

  • sec (float, optional) – floating point second of minute, in range [0,60), default is 0

  • scale (satkit.timescale, optional) – Time scale , default is satkit.timescale.UTC

  • str (str, optional) – string representation of time, in format “YYYY-MM-DD HH:MM:SS.sssZ” or if other will try to guess

Returns:

Time object representing input date and time, or if no arguments, the current date and time

Return type:

satkit.time

Example

>>> print(satkit.time(2023, 3, 5, 11, 3, 45.453))
2023-03-05 11:03:45.453Z
>>> print(satkit.time(2023, 3, 5))
2023-03-05 00:00:00.000Z
as_date() Tuple[int, int, int]

Return tuple representing as UTC Gegorian date of the time object.

Returns:

Tuple with 3 elements representing the Gregorian year, month, and day of the time object

Return type:

tuple[int, int, int]

Fractional component of day are truncated Month is in range [1,12] Day is in range [1,31]

as_gregorian(scale=timescale.UTC) Tuple[int, int, int, int, int, float]

Return tuple representing as UTC Gegorian date and time of the time object.

Parameters:

scale (timescale, optional) – Time scale. Default is satkit.timescale.UTC

Returns:

Tuple with 6 elements representing the Gregorian year, month, day, hour, minute, and second of the time object

Return type:

tuple[int, int, int, int, int, float]

Month is in range [1,12] Day is in range [1,31]

as_iso8601() str

Represent time as ISO 8601 string

Returns:

ISO 8601 string representation of time: “YYYY-MM-DDTHH:MM:SS.sssZ”

Return type:

str

as_jd(scale: timescale = timescale.UTC) float

Represent time instance as Julian Date with the provided time scale

If no time scale is provided, default is satkit.timescale.UTC

as_mjd(scale: timescale = timescale.UTC) float

Represent time instance as a Modified Julian Date with the provided time scale

If no time scale is provided, default is satkit.timescale.UTC

as_rfc3339() str

Represent time as RFC 3339 string

Returns:

RFC 3339 string representation of time: “YYYY-MM-DDTHH:MM:SS.sssZ”

Return type:

str

as_unixtime() float

Represent time as unixtime

(seconds since Jan 1, 1970 UTC, excluding leap seconds)

Includes fractional comopnent of seconds

datetime(utc: bool = True) datetime.datetime

Convert object to “datetime.datetime” object representing same instant in time.

Parameters:

utc (bool, optional) – Whether to make the “datetime.datetime” object represent time in the local timezone or “UTC”. Default is True

Returns:

“datetime.datetime” object representing the same instant in time as the “satkit.time” object

Return type:

datetime.datetime

Example

>>> dt = satkit.time(2023, 6, 3, 6, 19, 34).datetime(True)
>>> print(dt)
2023-06-03 06:19:34+00:00
>>>
>>> dt = satkit.time(2023, 6, 3, 6, 19, 34).datetime(False)
>>> print(dt)
2023-06-03 02:19:34
static from_date(year: int, month: int, day: int) time

Return a time object representing the start of the input day (midnight)

Parameters:
  • year (int) – Gregorian year (e.g., 2024)

  • month (int) – Gregorian month (1 = January, 2 = February, …)

  • day (int) – Day of month, beginning with 1

Returns:

Time object representing the start of the input day (midnight)

Return type:

satkit.time

static from_datetime(self, year: int, month: int, day: int, hour: int, min: int, sec: float, scale: timescale = timescale.UTC) time

Create time object from 6 input arguments representing UTC Gregorian time.

Parameters:
  • year (int) – Gregorian year

  • month (int) – Gregorian month (1 = January, 2 = February, …)

  • day (int) – Day of month, beginning with 1

  • hour (int) – Hour of day, in range [0,23]

  • min (int) – Minute of hour, in range [0,59]

  • sec (float) – floating point second of minute, in range [0,60)

  • scale (timescale, optional) – Time scale. Default is satkit.timescale.UTC

Returns:

Time object representing input UTC Gregorian time

Return type:

satkit.time

Example

>>> print(satkit.time.from_datetime(2023, 3, 5, 11, 3,45.453))
2023-03-05 11:03:45.453Z
static from_gps_week_and_second(week: int, sec: float) time

Return a time object representing input GPS week and second

Parameters:
  • week (int) – GPS week number

  • sec (float) – GPS seconds of week

  • scale (timescale, optional) – Time scale. Default is satkit.timescale.GPS

Returns:

Time object representing input GPS week and second

Return type:

satkit.time

static from_gregorian(year: int, month: int, day: int, hour: int, min: int, sec: float) time

Create time object from 6 input arguments representing UTC Gregorian time.

Parameters:
  • year (int) – Gregorian year

  • month (int) – Gregorian month (1 = January, 2 = February, …)

  • day (int) – Day of month, beginning with 1

  • hour (int) – Hour of day, in range [0,23]

  • min (int) – Minute of hour, in range [0,59]

  • sec (float) – floating point second of minute, in range [0,60)

Returns:

Time object representing input UTC Gregorian time

Return type:

satkit.time

Example

>>> print(satkit.time.from_gregorian(2023, 3, 5, 11, 3,45.453))
2023-03-05 11:03:45.453Z
static from_jd(jd: float, scale: timescale = timescale.UTC) time

Return a time object representing input Julian date and time scale

Parameters:
  • jd (float) – Julian date

  • scale (timescale, optional) – Time scale. Default is satkit.timescale.UTC

Returns:

Time object representing input Julian date and time scale

Return type:

satkit.time

static from_mjd(mjd: float, scale: timescale = timescale.UTC) time

Return a time object representing input modified Julian date and time scale

Parameters:
  • mjd (float) – Modified Julian date

  • scale (satkit.timescale, optional) – Time scale. Default is satkit.timescale.UTC

Returns:

Time object representing input modified Julian date and time scale

Return type:

satkit.time

static from_rfc3339(rfc: str) time

Create a “time” object from input RFC 3339 string

Parameters:

rfc (str) – RFC 3339 string representation of time

Notes

  • RFC 3339 is a subset of ISO 8601

  • Only allows a subset of the format: “YYYY-MM-DDTHH:MM:SS.sssZ” or “YYYY-MM-DDTHH:MM:SS.ssssssZ”

Returns:

Time object representing input RFC 3339 string

Return type:

satkit.time

Example

>>> print(satkit.time.from_rfctime("2023-03-05T11:03:45.453Z"))
2023-03-05 11:03:45.453Z
static from_string(str: time.from_string.str) time

Create a “time” object from input string

Parameters:
  • str (str) – string representation of time, in format “YYYY-MM-DD HH:MM:SS.sssZ” or if other will try

  • parse (to intelligently)

  • guarantees (but no)

Note

  • This is probably not what you want. Use with caution.

Returns:

Time object representing input string

Return type:

satkit.time

Example

>>> print(satkit.time.from_string("2023-03-05 11:03:45.453Z"))
2023-03-05 11:03:45.453Z
static from_unixtime(ut: float) time

Return a time object representing input unixtime

Parameters:

ut (float) – unixtime, UTC seconds since Jan 1, 1970 00:00:00 (leap seconds are not included)

Returns:

Time object representing input unixtime

Return type:

satkit.time

static now() time

Create a “time” object representing the instant of time at the calling of the function.

Returns:

Time object representing the current time

Return type:

satkit.time

strftime(format: str) str

Represent time as string with given format

Parameters:

format (str) – format of the string

Format Codes: * %Y - year * %m - month with leading zeros (01-12) * %d - day of month with leading zeros (01-31) * %H - hour with leading zeros (00-23) * %M - minute with leading zeros (00-59) * %S - second with leading zeros (00-59) * %f - microsecond, allowing for trailing zeros * %b - abbreviated month name (Jan, Feb, …) * %B - full month name (January, February, …) * %A - full weekday name (Sunday, Monday, …) * %w - weekday as a decimal number (0=Sunday, 1=Monday, …)

Returns:

string representation of time

Return type:

str

Example

>>> print(satkit.time(2023, 6, 3, 6, 19, 34).strptime("%Y-%m-%d %H:%M:%S"))
2023-06-03 06:19:34
static strptime(str: time.strptime.str, format: time.strptime.str) time

Create a “time” object from input string with given formatting

Parameters:
  • str (str) – string representation of time

  • format (str) – format of the string

Notes: * The format string is a subset of the strptime format string in the Python “datetime” module

Format Codes: * %Y - year * %m - month with leading zeros (01-12) * %d - day of month with leading zeros (01-31) * %H - hour with leading zeros (00-23) * %M - minute with leading zeros (00-59) * %S - second with leading zeros (00-59) * %f - microsecond, allowing for trailing zeros * %b - abbreviated month name (Jan, Feb, …) * %B - full month name (January, February, …)

Returns:

Time object representing input string

Return type:

satkit.time

Example

# Note the microsecond %f actually is represented as milliseconds in the input string >>> print(satkit.time.strptime(“2023-03-05 11:03:45.453Z”, “%Y-%m-%d %H:%M:%S.%fZ”)) 2023-03-05 11:03:45.453Z