-
Notifications
You must be signed in to change notification settings - Fork 42
/
example1.py
163 lines (137 loc) · 5.08 KB
/
example1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#
# example file for ppp-tools
# https://github.com/aewallin/ppp-tools
#
import datetime
import os
import matplotlib.pyplot as plt
import time
import matplotlib
matplotlib.rcParams['axes.formatter.useoffset'] = False
import ppp_rtklib
import ppp_glab
import ppp_nrcan
import station
import ppp_common
import distutils.spawn # to find executables for ppp-engines.
print "checking for executables needed:"
gLab_EXISTS = distutils.spawn.find_executable("gLAB_linux")
rtklib_EXISTS = distutils.spawn.find_executable("rnx2rtkp")
nrcan_EXISTS = distutils.spawn.find_executable("gpsppp")
CRX2RNX_EXISTS = distutils.spawn.find_executable("CRX2RNX")
print "gLab \t ",gLab_EXISTS
print "rnx2rtkp \t ",rtklib_EXISTS
print "nrcan \t ",nrcan_EXISTS
print "CRX2RNX \t ",CRX2RNX_EXISTS
print "-------------------------"
# define stations
station1 = station.ptb
station2 = station.mikes
products = "rapid" # IGS product type
# define day for analysis:
dt = datetime.datetime.utcnow()-datetime.timedelta(days=5) # 5 days back from now
current_dir = os.getcwd()
print "Example PPP-run between 2 stations for 1 day:"
print "Station1: ", station1.name
print "Station2: ", station2.name
print "Day: ", dt
print "Will now run ppp-engines."
print "-------------------------"
t0 = time.time()
# run gLAB PPP
ppp_glab.run(station1, dt, prefixdir=current_dir)
ppp_glab.run(station2, dt, prefixdir=current_dir)
# run RTKLIB
ppp_rtklib.run(station1, dt, prefixdir=current_dir)
ppp_rtklib.run(station2, dt, prefixdir=current_dir)
# run nrcan
ppp_nrcan.run(station1, dt, prefixdir=current_dir)
ppp_nrcan.run(station2, dt, prefixdir=current_dir)
runtime = time.time()-t0
print "ppp run in ", runtime, " seconds"
# read results from result-files
s1_glab = ppp_common.read_result_file(station1, dt, products, "glab", current_dir)
s1_rtklib = ppp_common.read_result_file(station1, dt, products, "rtklib", current_dir)
s1_nrcan = ppp_common.read_result_file(station1, dt, products, "nrcan", current_dir)
s2_glab = ppp_common.read_result_file(station2, dt, products, "glab", current_dir)
s2_rtklib = ppp_common.read_result_file(station2, dt, products, "rtklib", current_dir)
s2_nrcan = ppp_common.read_result_file(station2, dt, products, "nrcan", current_dir)
# plot lat/lon/heigh/ztd results
plt.figure()
plt.subplot(2,2,1)
plt.title(station1.name)
plt.plot( s1_glab.epoch(), s1_glab.lat(), label='glab')
plt.plot( s1_rtklib.epoch(), s1_rtklib.lat(), label='rtklib')
plt.plot( s1_nrcan.epoch(), s1_nrcan.lat(), label='nrcan')
plt.legend(loc='best')
plt.ylabel('lat / degrees')
plt.grid()
plt.legend(loc='best')
plt.subplot(2,2,2)
plt.plot( s1_glab.epoch(), s1_glab.lon(), label='glab')
plt.plot( s1_rtklib.epoch(), s1_rtklib.lon(), label='rtklib')
plt.plot( s1_nrcan.epoch(), s1_nrcan.lon(), label='nrcan')
plt.ylabel('lon / degrees')
plt.grid()
plt.legend(loc='best')
plt.subplot(2,2,3)
plt.plot( s1_glab.epoch(), s1_glab.height(), label='glab')
plt.plot( s1_rtklib.epoch(), s1_rtklib.height(), label='rtklib')
plt.plot( s1_nrcan.epoch(), s1_nrcan.height(), label='nrcan')
plt.ylabel('height / m')
plt.grid()
plt.legend(loc='best')
plt.subplot(2,2,4)
plt.plot( s1_glab.epoch(), s1_glab.clock(), label='glab')
plt.plot( s1_rtklib.epoch(), s1_rtklib.clock(), label='rtklib')
plt.plot( s1_nrcan.epoch(), s1_nrcan.clock(), label='nrcan')
plt.ylabel('clock / ns')
plt.ylim((473,476))
plt.grid()
plt.legend(loc='best')
plt.figure()
plt.subplot(2,2,1)
plt.title(station2.name)
plt.plot( s2_glab.epoch(), s2_glab.lat(), label='glab')
plt.plot( s2_rtklib.epoch(), s2_rtklib.lat(), label='rtklib')
plt.plot( s2_nrcan.epoch(), s2_nrcan.lat(), label='nrcan')
plt.legend(loc='best')
plt.ylabel('lat / degrees')
plt.grid()
plt.legend(loc='best')
plt.subplot(2,2,2)
plt.plot( s2_glab.epoch(), s2_glab.lon(), label='glab')
plt.plot( s2_rtklib.epoch(), s2_rtklib.lon(), label='rtklib')
plt.plot( s2_nrcan.epoch(), s2_nrcan.lon(), label='nrcan')
plt.ylabel('lon / degrees')
plt.grid()
plt.legend(loc='best')
plt.subplot(2,2,3)
plt.plot( s2_glab.epoch(), s2_glab.height(), label='glab')
plt.plot( s2_rtklib.epoch(), s2_rtklib.height(), label='rtklib')
plt.plot( s2_nrcan.epoch(), s2_nrcan.height(), label='nrcan')
plt.ylabel('height / m')
plt.grid()
plt.legend(loc='best')
plt.subplot(2,2,4)
plt.plot( s2_glab.epoch(), s2_glab.clock(), label='glab')
plt.plot( s2_rtklib.epoch(), s2_rtklib.clock(), label='rtklib')
plt.plot( s2_nrcan.epoch(), s2_nrcan.clock(), label='nrcan')
plt.ylabel('clock / ns')
#plt.ylim((473,476))
plt.grid()
plt.legend(loc='best')
# compute double difference
(t_glab,d_glab) = ppp_common.diff_stations(current_dir, station1, station2, dt, products, "glab")
(t_rtklib,d_rtklib) = ppp_common.diff_stations(current_dir, station1, station2, dt, products, "rtklib")
(t_nrcan,d_nrcan) = ppp_common.diff_stations(current_dir, station1, station2, dt, products, "nrcan")
plt.figure()
plt.title("%s - %s receiver clock, double difference"%(station1.name, station2.name))
plt.plot(t_glab,d_glab, label="glab")
plt.plot(t_rtklib,d_rtklib, label="rtklib")
plt.plot(t_nrcan,d_nrcan, label="nrcan")
plt.ylim((463,473))
plt.legend(loc="best")
plt.grid()
plt.ylabel("%s - %s / ns" %(station1.name, station2.name))
plt.show()