A Python class that allows for convenient conversion between different date and time formats/units
Project description
# `time_converter` [![build status](https://gitlab.physik.uni-kiel.de/ET/time_converter/badges/master/build.svg)](https://gitlab.physik.uni-kiel.de/ET/time_converter/commits/master) [![coverage report](https://gitlab.physik.uni-kiel.de/ET/time_converter/badges/master/coverage.svg)](http://et.page.physik.uni-kiel.de/time_converter/coverage/)
A Python class that allows for convenient conversion between different date and time formats and units.
The library supports both general-purpose Earth-based time units (such as Python's `datetime` type, Day-of-year or
POSIX time) as well as time units useful for working with data from the Mars Science Laboratory and Chang'e 4 space
missions. It can be easily extended to support additional units.
## Usage
```python
from time_converter import Time
Time(2019.5, 'decimalyear').to('dt')
# > datetime.datetime(2019, 7, 2, 12, 0)
```
you can also supply list-like objects as input, the output will be a `numpy` array.
```python
Time([2018.0, 2018.1], 'decimalyear').to('dt')
# > array([datetime.datetime(2019, 1, 1, 0, 0),
# datetime.datetime(2019, 2, 6, 11, 59, 59, 999997)], dtype=object)
```
## Supported units
### Earth-based time units
| Unit | Example | Name | Abbreviated Name |
|-------------------------------|---------------------------------------|---------------|------------------|
| Python datetime (UTC) | `datetime.datetime(2019, 1, 1, 0, 0)` | `datetime` | `dt` |
| DoY Tuple (year, day of year) | `(2019, 1.0)` | `doy` | |
| Decimal year | `2019.0` | `decimalyear` | `dy` |
| POSIX time | `1546300800` | `posix` | |
### Mars Science Laboratory
The MSL spacecraft clock (`sclk`) measures the number of seconds since January 1 2000, 11:58:55.816 UTC. However, due to
drifting of the clock, some corrections need to be applied based on
[files supplied by NASA](https://naif.jpl.nasa.gov/pub/naif/pds/data/msl-m-spice-6-v1.0/mslsp_1000/data/sclk/sclkinfo.txt),
which this tool uses to do the conversion between `sclk` and other units.
| Unit | Example | Name |
|----------------------|----------------------|--------|
| MSL mission sol | `2276.8306983767375` | `sol` |
| MSL spacecraft clock | `599570768.5720837` | `sclk` |
A Python class that allows for convenient conversion between different date and time formats and units.
The library supports both general-purpose Earth-based time units (such as Python's `datetime` type, Day-of-year or
POSIX time) as well as time units useful for working with data from the Mars Science Laboratory and Chang'e 4 space
missions. It can be easily extended to support additional units.
## Usage
```python
from time_converter import Time
Time(2019.5, 'decimalyear').to('dt')
# > datetime.datetime(2019, 7, 2, 12, 0)
```
you can also supply list-like objects as input, the output will be a `numpy` array.
```python
Time([2018.0, 2018.1], 'decimalyear').to('dt')
# > array([datetime.datetime(2019, 1, 1, 0, 0),
# datetime.datetime(2019, 2, 6, 11, 59, 59, 999997)], dtype=object)
```
## Supported units
### Earth-based time units
| Unit | Example | Name | Abbreviated Name |
|-------------------------------|---------------------------------------|---------------|------------------|
| Python datetime (UTC) | `datetime.datetime(2019, 1, 1, 0, 0)` | `datetime` | `dt` |
| DoY Tuple (year, day of year) | `(2019, 1.0)` | `doy` | |
| Decimal year | `2019.0` | `decimalyear` | `dy` |
| POSIX time | `1546300800` | `posix` | |
### Mars Science Laboratory
The MSL spacecraft clock (`sclk`) measures the number of seconds since January 1 2000, 11:58:55.816 UTC. However, due to
drifting of the clock, some corrections need to be applied based on
[files supplied by NASA](https://naif.jpl.nasa.gov/pub/naif/pds/data/msl-m-spice-6-v1.0/mslsp_1000/data/sclk/sclkinfo.txt),
which this tool uses to do the conversion between `sclk` and other units.
| Unit | Example | Name |
|----------------------|----------------------|--------|
| MSL mission sol | `2276.8306983767375` | `sol` |
| MSL spacecraft clock | `599570768.5720837` | `sclk` |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
time_converter-1.0.0.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for time_converter-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c6e3cbc9ea5f86afe60a40ba1372d5077aac310ff281e39013a553315fbd420 |
|
MD5 | ef76ebf4d6266a505cfd12e5d3be52fd |
|
BLAKE2b-256 | e8bf53b923ab8aa0bcfcdb49471aa5640158bd9eab972ec1411ef1ecb84b0cd7 |