DateTimestamp)
''' Component of a GNSSStation ''' choices=['mm', 'cm', 'm'], help='Unit of displacement', default='m')
default=0., help='Component\'s shift in unit')
default=0., help='One sigma uncertainty of the measurement')
if not isinstance(other, self.__class__): raise AttributeError('Other has to be of instance %s' % self.__class__) comp = self.__class__() comp.shift = self.shift + other.shift comp.sigma = math.sqrt(self.sigma**2 + other.sigma**2) return comp
self.shift += other.shift self.sigma = math.sqrt(self.sigma**2 + other.sigma**2) return self
''' Representation of a GNSS station during a campaign measurement
For more information see http://kb.unavco.org/kb/assets/660/UNAVCO_Campaign_GPS_GNSS_Handbook.pdf '''
help='Four letter station code', optional=True)
choices=['static', 'rapid_static', 'kinematic'], default='static')
optional=True, help='Survey start time')
optional=True, help='Survey end time')
default=0., help='North-East component correlation')
default=0., help='East-Up component correlation')
default=0., help='North-Up component correlation')
optional=True)
optional=True)
optional=True)
try: return self.code == other.code except AttributeError: return False
components = self.components.values() ncomponents = self.ncomponents
covar = num.zeros((ncomponents, ncomponents)) for ic1, comp1 in enumerate(components): for ic2, comp2 in enumerate(components): corr = self._get_comp_correlation(comp1, comp2) covar[ic1, ic2] = corr * comp1.sigma * comp2.sigma
# This floating point operation is inaccurate: # corr * comp1.sigma * comp2.sigma != corr * comp2.sigma * comp1.sigma # # Hence this identity covar[num.tril_indices_from(covar, k=-1)] = \ covar[num.triu_indices_from(covar, k=1)]
return covar
components = self.components.values() ncomponents = self.ncomponents
corr = num.zeros((ncomponents, ncomponents)) corr[num.diag_indices_from(corr)] = num.array( [c.sigma for c in components])
for ic1, comp1 in enumerate(components): for ic2, comp2 in enumerate(components): if comp1 is comp2: continue corr[ic1, ic2] = self._get_comp_correlation(comp1, comp2)
# See comment at get_covariance_matrix corr[num.tril_indices_from(corr, k=-1)] = \ corr[num.triu_indices_from(corr, k=1)]
return corr
return num.array([c.shift for c in self.components.values()])
return num.array( [False if self.__getattribute__(name) is None else True for name in ('north', 'east', 'up')], dtype=num.bool)
def components(self): return OrderedDict( [(name, self.__getattribute__(name)) for name in ('north', 'east', 'up') if self.__getattribute__(name) is not None])
def ncomponents(self): return len(self.components)
if comp1 is comp2: return 1.
s = self
correlation_map = { (s.north, s.east): s.correlation_ne, (s.east, s.up): s.correlation_eu, (s.north, s.up): s.correlation_nu }
return correlation_map.get( (comp1, comp2), correlation_map.get((comp2, comp1), False))
GNSSStation.T(), help='List of GNSS campaign measurements')
help='Campaign name', default='Unnamed campaign')
optional=True)
optional=True)
Object.__init__(self, *args, **kwargs) self._cov_mat = None self._cor_mat = None
self._cor_mat = None self._cov_mat = None return self.stations.append(station)
try: station = self.get_station(station_code) self.stations.remove(station) self._cor_mat = None self._cov_mat = None except ValueError: logger.warn('Station {} does not exist in campaign, ' 'do nothing.'.format(station_code))
for sta in self.stations: if sta.code == station_code: return sta raise ValueError('Could not find station %s' % station_code)
return od.geographic_midpoint_locations(self.stations)
coords = self.coordinates return od.distance_accurate50m( coords[:, 0].min(), coords[:, 1].min(), coords[:, 0].max(), coords[:, 1].max()) / 2.
if self._cov_mat is None: ncomponents = self.ncomponents cov_arr = num.zeros((ncomponents, ncomponents))
idx = 0 for ista, sta in enumerate(self.stations): ncomp = sta.ncomponents cov_arr[idx:idx+ncomp, idx:idx+ncomp] = \ sta.get_covariance_matrix() idx += ncomp
self._cov_mat = cov_arr return self._cov_mat
if self._cor_mat is None: ncomponents = self.ncomponents cor_arr = num.zeros((ncomponents, ncomponents))
idx = 0 for ista, sta in enumerate(self.stations): ncomp = sta.ncomponents cor_arr[idx:idx+ncomp, idx:idx+ncomp] = \ sta.get_correlation_matrix() idx += ncomp
self._cor_mat = cor_arr return self._cor_mat
return num.concatenate( [s.get_component_mask() for s in self.stations])
self.regularize() return Object.dump(self, *args, **kwargs)
def coordinates(self): return num.array([loc.effective_latlon for loc in self.stations])
def nstations(self): return len(self.stations)
def ncomponents(self): return sum([s.ncomponents for s in self.stations]) |