sem_plot.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 """
4 A GNSSTk example featuring some file input and processing to
5 create a plot with matplotlib.
6 
7 Usage:
8 
9  python sem_plot.py
10 
11 ==============================================================================
12 
13  This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
14 
15  The GNSSTk is free software; you can redistribute it and/or modify
16  it under the terms of the GNU Lesser General Public License as published
17  by the Free Software Foundation; either version 3.0 of the License, or
18  any later version.
19 
20  The GNSSTk is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  GNU Lesser General Public License for more details.
24 
25  You should have received a copy of the GNU Lesser General Public
26  License along with GNSSTk; if not, write to the Free Software Foundation,
27  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
28 
29  This software was developed by Applied Research Laboratories at the
30  University of Texas at Austin.
31  Copyright 2004-2022, The Board of Regents of The University of Texas System
32 
33 ==============================================================================
34 
35 ==============================================================================
36 
37  This software was developed by Applied Research Laboratories at the
38  University of Texas at Austin, under contract to an agency or agencies
39  within the U.S. Department of Defense. The U.S. Government retains all
40  rights to use, duplicate, distribute, disclose, or release this software.
41 
42  Pursuant to DoD Directive 523024
43 
44  DISTRIBUTION STATEMENT A: This software has been approved for public
45  release, distribution is unlimited.
46 
47 ==============================================================================
48 """
49 
50 import gnsstk
51 import matplotlib.pyplot as plt
52 
53 
54 def main():
55  # Read in data, strict=True makes dataSets a list rather than a generator:
56  header, dataSets = gnsstk.readSEM( gnsstk.data.full_path('sem_data.txt'), strict=True)
57 
58  # Write the data back to a different file (their contents should match):
59  gnsstk.writeSEM( gnsstk.data.full_path('sem_data.txt.new'), header, dataSets)
60 
61  # Read the orbit out of the data:
62  orbit = dataSets[0].toAlmOrbit() # alm orbit of first data point
63 
64  austin = gnsstk.Position(30, 97, 0, gnsstk.Position.Geodetic) # Austin, TX
65 
66  starttime = gnsstk.CommonTime() # iterator time to start at
67  starttime.setTimeSystem(gnsstk.TimeSystem('GPS'))
68  endtime = gnsstk.CommonTime() # end time, 1 day later (see below)
69  endtime.setTimeSystem(gnsstk.TimeSystem('GPS'))
70  endtime.addDays(1)
71 
72  X = []
73  Y = []
74 
75  # Step through a day, adding plot points:
76  for t in gnsstk.times(starttime, endtime, seconds=1000):
77  xvt = orbit.svXvt(t)
78  location = gnsstk.Position(xvt.x)
79  elevation = austin.elevation(location)
80  X.append(t.getDays())
81  Y.append(elevation)
82 
83  # Make the plot
84  fig = plt.figure()
85  fig.suptitle('Elevation of a GPS satellite throughout the day',
86  fontsize=14, fontweight='bold')
87  ax = fig.add_subplot(111)
88  ax.set_xlabel('Time (days)')
89  ax.set_ylabel('Elevation (degrees)')
90  plt.plot(X, Y, 'r')
91  plt.show()
92 
93 
94 if __name__ == '__main__':
95  main()
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
sem_plot.main
def main()
Definition: sem_plot.py:54
gnsstk::Position
Definition: Position.hpp:136


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