example1.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 """
4 A GNSSTk example with some simple time classes and functions.
5 
6 This is a port of the older C++ example1.cpp.
7 
8 Usage:
9  python example1.py
10 
11 """
12 
13 
14 import gnsstk
15 
16 
17 def main():
18  # In the GNSSTk there are multiple classes to manage time, depending
19  # on the specific operation that we want to carry out. This modular
20  # approach eases handling the many different time systems used in the
21  # modern Global Navigation Satellite Systems.
22 
23  # Note, however, that in the GNSSTk the unifying class to do time
24  # Computations is the 'CommonTime' class.
25 
26  # Read current time from system clock
27  systime = gnsstk.SystemTime()
28 
29  # Convert to 'CommonTime', the standard way to handle time at GNSSTk
30  comtime = systime.toCommonTime()
31 
32  # This is the typical way to handle civil time
33  civtime = gnsstk.CivilTime(comtime)
34 
35  # The YDSTime class is very useful for common GNSS tasks
36  ydstime = gnsstk.YDSTime(comtime)
37 
38  # This is a typical class to handle time in GPS system
39  gpstime = gnsstk.GPSWeekSecond(comtime)
40 
41  # Class to handle Modified Julian Date
42  mjd = gnsstk.MJD(comtime)
43 
44  print "Hello world!"
45  print " The current civil time is", civtime
46  print " The current year is", ydstime.year
47  print " The current day of year is", ydstime.doy
48  print " The current second of day is", ydstime.sod
49  print " The current full GPS week is", gpstime.week
50  print " The current short GPS week is", gpstime.getModWeek()
51  print " The current day of GPS week is", gpstime.getDayOfWeek()
52  print " The current second of GPS week is", gpstime.sow
53  print " The current Modified Julian Date is", mjd
54 
55 
56 if __name__ == '__main__':
57  main()
gnsstk::YDSTime
Definition: YDSTime.hpp:58
example1.main
def main()
Definition: example1.py:17
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::SystemTime
Definition: SystemTime.hpp:54
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::MJD
Definition: MJD.hpp:54


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39