Ejemplo n.º 1
0
        /// <summary>
        /// 数据刚刚进入,立即执行,最优先的执行,初探
        /// </summary>
        /// <param name="current"></param>
        public override void RawRevise(RinexEpochObservation current)
        {
            //时段过滤
            if (Option.IsEnableTimePeriod)
            {
                if (!Option.TimePeriod.Contains(current.ReceiverTime))
                {
                    current.Clear(); return;
                }
            }

            //采样率时间赋值
            if (this.CurrentIndex == 0 || this.CurrentIndex == -1)
            {
                this.CurrentIndex = 1;
                InitSeconds       = current.ReceiverTime.DateTime.TimeOfDay.TotalSeconds;
                if (Option.IsEnableInterval && Option.Interval > 1 && InitSeconds % 5 != 0) // 若非0, 5秒整数倍的采样间隔,则强制采用10秒整数倍间隔
                {
                    InitSeconds = 0;
                }
            }

            //采样间隔过滤
            if (Option.IsEnableInterval)
            {
                //首先考虑采样率大于1s
                var diff = Math.Round(current.ReceiverTime.DateTime.TimeOfDay.TotalSeconds - InitSeconds) % Option.Interval;
                if (diff > 0.5 && Option.Interval > 1)//相差0.5s,认为是同一个历元
                {
                    current.Clear();
                    return;
                }

                //采样率太小,直接过滤
                if (current.ReceiverTime - PrevOkEpoch < Option.Interval)
                {
                    current.Clear();
                    return;
                }

                //10s 以上的整数必须为10倍的整数秒,如 30s采样率,只能出现 00 和 30 秒
                if (Option.Interval >= 10 && Option.Interval <= 30 && current.ReceiverTime.Seconds % Option.Interval > 1)
                {
                    current.Clear();
                    return;
                }
            }


            //移除其它系统
            if (Option.IsEnableSatelliteTypes)
            {
                current.RemoveOther(Option.SatelliteTypes);
            }


            //观测类型过滤凭借第一字母判断,此处过滤可以加快速度,避免多余计算
            if (Option.IsEnableObsTypes)
            {
                current.RemoveOthers(Option.ObsTypes);
            }

            //删除观测频率
            if (Option.IsEnableRemoveIndicatedFrequence)
            {
                current.RemoveFrequences(Option.FrequenceNumToBeRemoved);
                // log.Info("除频率:" + Geo.Utils.StringUtil.ToString(Option.FrequenceNumToBeRemoved));
            }

            //移除不能组成电离层组合的卫星
            if (Option.IsRemoveIonoFreeUnavaliable)
            {
                List <RinexSatObsData> list = new List <RinexSatObsData>();
                foreach (var sat in current)
                {
                    if (!sat.IsIonoFreeCombinationAvaliable)
                    {
                        list.Add(sat);
                    }
                }
                foreach (var item in list)
                {
                    current.Remove(item.Prn);
                }
            }

            //移除卫星中对于双频无电离层组合多余的观测值
            if (Option.IsRemoveRedundantObsForIonoFree)
            {
                foreach (var sat in current)
                {
                    sat.RemoveRedundantObsForIonoFree();
                }
            }


            //观测码数量不足的移除
            if (ObsCodesToBeRemove != null && ObsCodesToBeRemove.Count > 0)
            {
                foreach (var sat in current)
                {
                    if (!ObsCodesToBeRemove.ContainsKey(sat.Prn.SatelliteType))
                    {
                        continue;
                    }

                    var codes = this.ObsCodesToBeRemove[sat.Prn.SatelliteType];

                    foreach (var item in codes)
                    {
                        sat.Remove(item);
                    }
                }
            }

            //移除指定卫星
            if (Option.IsEnableRemoveSats && Option.SatsToBeRemoved != null && Option.SatsToBeRemoved.Count > 0)
            {
                current.Remove(Option.SatsToBeRemoved);
            }

            //卫星高度角过滤
            if (Option.SatCutOffAngle.Enabled && !XYZ.IsZeroOrEmpty(OldHeader.ApproxXyz))
            {
                //如果星历范围不包括,则不做更改
                if (EphemerisService.TimePeriod.Contains(current.ReceiverTime))
                {
                    List <RinexSatObsData> list = new List <RinexSatObsData>();
                    foreach (var item in current)
                    {
                        var   eph   = EphemerisService.Get(item.Prn, current.ReceiverTime);
                        Polar polar = null;
                        if (eph != null)
                        {
                            polar = CoordTransformer.XyzToGeoPolar(eph.XYZ, OldHeader.ApproxXyz);
                        }
                        //移除了没有星历的卫星
                        if (polar == null || polar.Elevation < Option.SatCutOffAngle.Value)
                        {
                            list.Add(item);
                        }
                    }
                    foreach (var item in list)
                    {
                        current.Remove(item.Prn);
                    }
                }
            }
            //删除指定数据为空的卫星
            if (Option.IsDeleteVacantSat)
            {
                List <SatelliteNumber> tobeDeletes = new List <SatelliteNumber>();
                foreach (var sat in current)
                {
                    foreach (var item in Option.NotVacantCodeList)
                    {
                        if (sat.TryGetValue(item) == 0)
                        {
                            tobeDeletes.Add(sat.Prn);
                        }
                    }
                }
                current.Remove(tobeDeletes);
            }

            base.RawRevise(current);

            //小时段过滤
            if (Option.IsEnableMinEpochCount)
            {
                SmallObsPeriodRemover.Revise(ref current);
            }
        }