Skip to content

Commit 24069db

Browse files
committed
- changed time to time0
1 parent ee866f1 commit 24069db

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

src/cssrlib/cssrlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def ssig2rsig(self, sys: sGNSS, utyp: uTYP, ssig):
449449

450450
def set_time(self, t):
451451
""" set observation time (week, tow) """
452-
self.time = t
452+
self.time0 = t
453453
week, tow = time2gpst(t)
454454
self.week = week
455455
self.tow0 = tow//86400*86400

src/cssrlib/plot.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,25 @@ def draw_circle(ax, ccrs, p, col, nc=10, alpha=0.5):
114114
transform=ccrs)
115115

116116

117-
def plot_enu(t, enu, smode=None, ztd=None, ylim=1.0, figtype=1):
117+
def plot_enu(t, enu, smode=None, ztd=None, ylim=1.0, ylim_v=None, figtype=1):
118118
""" plot ENU coordinates """
119119

120120
lbl_t = ['East [m]', 'North [m]', 'Up [m]']
121121
fmt = '%H:%M'
122122

123123
fig = plt.figure(figsize=[7, 9])
124124
fig.set_rasterized(True)
125+
idx2 = np.array([])
125126

126127
if smode is not None:
128+
idx2 = np.where(smode == 2)[0] # dgps
127129
idx4 = np.where(smode == 4)[0] # fix
128130
idx5 = np.where(smode == 5)[0] # float
129131
idx0 = np.where(smode == 0)[0] # none
130132

133+
if ylim_v is None:
134+
ylim_v = ylim
135+
131136
if figtype == 1: # ENU versus t
132137

133138
nfig = 3 if ztd is None else 4
@@ -136,14 +141,19 @@ def plot_enu(t, enu, smode=None, ztd=None, ylim=1.0, figtype=1):
136141
plt.subplot(nfig, 1, k+1)
137142
if smode is None:
138143
plt.plot(t, enu[:, k])
144+
elif len(idx2) > 0: # DGPS
145+
plt.plot(t[idx0], enu[idx0, k], 'r.', label='none')
146+
plt.plot(t[idx2], enu[idx2, k], 'y.', label='dgps')
139147
else:
140148
plt.plot(t[idx0], enu[idx0, k], 'r.', label='none')
141149
plt.plot(t[idx5], enu[idx5, k], 'y.', label='float')
142150
plt.plot(t[idx4], enu[idx4, k], 'g.', label='fix')
143151

144152
plt.ylabel(lbl_t[k])
145153
plt.grid()
146-
plt.ylim([-ylim, ylim])
154+
lim = ylim_v if k == 2 else ylim
155+
plt.ylim([-lim, lim])
156+
147157
plt.gca().xaxis.set_major_formatter(md.DateFormatter(fmt))
148158

149159
if ztd is not None:
@@ -159,18 +169,21 @@ def plot_enu(t, enu, smode=None, ztd=None, ylim=1.0, figtype=1):
159169
markersize=8, label='fix')
160170

161171
plt.ylabel('ZTD [cm]')
172+
plt.ylim([0, 40])
162173
plt.grid()
163174
plt.gca().xaxis.set_major_formatter(md.DateFormatter(fmt))
164175

165-
plt.xlabel('Time [HH:MM]')
166-
176+
plt.xlabel('Time [HH:MM]')
167177
plt.legend()
168178

169179
elif figtype == 2: # horizontal coordinates
170180
fig.add_subplot(111)
171181

172182
if smode is None:
173183
plt.plot(enu[:, 0], enu[:, 1])
184+
elif idx2 is not None: # DGPS
185+
plt.plot(enu[idx0, 0], enu[idx0, 1], 'r.', label='none')
186+
plt.plot(enu[idx2, 0], enu[idx2, 1], 'y.', label='dgps')
174187
else:
175188
plt.plot(enu[idx0, 0], enu[idx0, 1], 'r.', label='none')
176189
plt.plot(enu[idx5, 0], enu[idx5, 1], 'y.', label='float')

src/cssrlib/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import matplotlib.pyplot as plt
1010
import numpy as np
1111
from cssrlib.gnss import time2str, sys2str, ecef2pos, ecef2enu, timediff
12-
from cssrlib.gnss import gtime_t, char2sys, rSigRnx, uGNSS, uTYP, uSIG
12+
from cssrlib.gnss import gtime_t, rSigRnx
1313
from cssrlib.peph import atxdec, searchpcv
1414
from cssrlib.plot import plot_enu
1515

@@ -126,13 +126,15 @@ def prepare_signal(self, obsfile=None):
126126
def save_output(self, t, ne, ppp=None):
127127
""" output result """
128128

129-
self.t[ne] = timediff(self.nav.t, self.t0)/86400.0
129+
self.t[ne] = timediff(t, self.t0)/86400.0
130130

131131
sol = self.nav.xa[0:3] if self.nav.smode == 4 else self.nav.x[0:3]
132132
self.enu[ne, :] = ecef2enu(self.pos_ref, sol-self.xyz_ref)
133133
self.smode[ne] = self.nav.smode
134134

135-
if ppp is not None:
135+
if ppp is None:
136+
self.ztd = None
137+
else:
136138
self.ztd[ne] = self.nav.xa[ppp.IT(self.nav.na)] \
137139
if self.nav.smode == 4 else self.nav.x[ppp.IT(self.nav.na)]
138140

@@ -175,7 +177,8 @@ def plot(self, ttl='test', fig_type=1, ylim=1, ylim_v=2, gfmt='png',
175177
""" plot utility """
176178

177179
if fig_type == 1:
178-
plot_enu(self.t, self.enu, self.smode, ylim=ylim, ylim_v=ylim_v)
180+
plot_enu(self.t, self.enu, self.smode,
181+
self.ztd, ylim=ylim, ylim_v=ylim_v)
179182
elif fig_type == 2:
180183
plot_enu(self.t, self.enu, self.smode, figtype=fig_type, ylim=ylim)
181184

0 commit comments

Comments
 (0)