Metadata-Version: 2.1
Name: gpsdatetime
Version: 1.0.39
Summary: Python GPS date/time management package
Home-page: https://gitlab.com/jbeilin/gpsdatetime
Author: Jacques Beilin
Author-email: jacques.beilin@gmail.com
License: UNKNOWN
Download-URL: https://gitlab.com/jbeilin/gpsdatetime/-/archive/v1.0.39/gpsdatetime-v1.0.39.tar.gz
Platform: UNKNOWN
Description-Content-Type: text/markdown
License-File: LICENCE.txt

# gpsdatetime - Python GPS date/time management package

This is a python library for GNSS date/time transformations

![Alt text](https://gitlab.com/jbeilin/gpsdatetime/-/blob/master/doc/logos/ensg_l.png)

## Usage

### Initialize gpsdatetime object

```python
import gpsdatetime as gpst
```

* init from current computer date/time
```python
t = gpst.gpsdatetime()
```

* init from modified julian date 
```python
t=gpst.gpsdatetime(mjd=54605.678)
```

* init from GPS week and second of week
```python
t=gpst.gpsdatetime(wk=1400, wsec=600700)
```

* init from usual time elements
```python
t=gpst.gpsdatetime(yyyy=2016, mon=1, dd=7, hh=3, min=5, sec=5)
```

* init from SINEX time string
```python
t=gpst.gpsdatetime('16:004:46888')
```

* init from sinex date elements
```python
t=gpst.gpsdatetime(yyyy=2016, doy=004, dsec=45677)
```

* init from iso time string
```python
t=gpst.gpsdatetime('16:01:04T03:05:05Z')
```

* init from RINEX time string
```python
t=gpst.gpsdatetime('18 10  9 12 20 45.00000')
```
or
```python
t=gpst.gpsdatetime('2018 10  9 12 20 45.00000')
```

### Get attributes


| Attribute  | Description     | Unit |
| :--------------- |:---------------| -----|
|s1970  | seconds from 01-01-1970 à 0h00Z | second |
|mjd  | Modified Julian Date \newline (MJD = JD – 2400000.5) | decimal days |
|jd  | Julian Date | decimal days |
|jd50  | Julian Date from J1950 | decimal days |
|wk  | GPS week | week I4 |
|wsec  | seconds in GPS week | float [0..604800]  |
|yyyy  | year (4 digits) | year I4 [1902..2079] |
|yy  | year (2 digits) | year (I2) |
|mon  | month number | I2  [1..12]  |
|dd  | day of month | I2 [1..31] |
|hh  | hour | I2 [0..24] |
|min  | minute | I2 [0..60] |
|sec  | second | I2 [0..60] |
|doy  | day of year (DOY) | I3 [1..366] |
|wd  | day of week (DOW) | I1 [0..6] |
|dsec  | second of day | float [0..86400] |
|dy  | decimal year | float [0..366]  |
|GMST  | Greenwich Mean Sidereal Time | decimal hours |
|EQEQ  | Equation of equinoxes | decimal hours |
|GAST  | Greenwich Aparent Sidereal Time | decimal hours |


```python
y = t.yyyy
# y = 2020
```

### Print time strings 

* Return iso time string : 
```python
iso_t = t.st_iso_epoch()
# 2020-10-01T12:00:26Z 
```

or

```python
iso_t = t.st_iso_epoch(2)
# 2020-10-01T12:00:26.00Z 
```

* Return Ephem (https://pypi.org/project/ephem/) time string : 2020/10/01 12:00:26.0 
```python
s = t.st_pyephem_epoch()
```

* Return Rinex time string : 2020 10 01 12 00 26.0000000 
```python
s = t.st_rinex_epoch()
```

* Return Sinex time string : 20:010:43226
```python
s = t.st_snx_epoch()
```

* Return time stamp
```python
s = t.st_timestamp_epoch()
```

* Print all date/time elements
```python
print(t)
#Gpstime (version 2016-06-27)
#
#s1970 : 1480272707.601859
#YYYY_MM_DD : 2016/11/27  
#HH:MM:SS : 18:51:47.601858854
#GPS week : 1925
#Day of week : 0 (SUN)
#Second of week : 67907.601858854 
#Second of day : 67907.601858854  
#session : s
#Modified Julian Date : 57719.785968  
#Julian Date : 2457720.285968
#YYYY : 2016  DOY : 332
#GMST (dec. hour) : 23.337554
#GAST (dec. hour) : 23.337429
#Eq. of Equinoxes (dec. hour) : -0.000125
```

### Time calculations

* add 5 seconds (or substract 2s) to gpsdatetime object t
```python
t += 5
t -= 2
```

* test wether t is before t1 or not 
```python
if t < t1:
    print('t before t1')
```

* duration between two time objects
```python
t1 = gpst.gpsdatetime()
t2 = gpst.gpsdatetime()
Delta_t  = t2 - t1 # result in seconds
```

* set t object to current date at 0h00
```python
t.day00()
```

* set t object to current week on sunday morning 0h00
```python
t.wk00()
```

## Installation

Installation is accomplished from the command line.

```
user@desktop:~/gpsdatetime$ python3 setup.py install
``

## licence

Copyright (C) 2014-2023, Jacques Beilin / ENSG-Geomatique

Distributed under terms of the CECILL-C licence.


