示例#1
0
        /// <summary>
        /// 一个参数的产品生成
        /// </summary>
        /// <param name="vals"></param>
        private static BaseDictionary <TimePeriod, RmsedNumeral> BuildProduct(BaseDictionary <Time, RmsedNumeral> vals)
        {
            BaseDictionary <TimePeriod, RmsedNumeral> store = new BaseDictionary <TimePeriod, RmsedNumeral>();
            var times = vals.Keys;;

            times.Sort();

            TimePeriod   timePeriod = null;
            RmsedNumeral lastVal    = RmsedNumeral.Zero;

            foreach (var time in times)
            {
                var currentVal = vals[time];
                if (timePeriod == null) //初始化第一个
                {
                    timePeriod        = new TimePeriod(time, time);
                    store[timePeriod] = currentVal;
                }
                else
                {
                    if (Math.Abs(currentVal.Value - lastVal.Value) > 1e-3) //注意小数偏差
                    {                                                      //保存上一个
                        timePeriod        = new TimePeriod(time, time);    //新建下一个
                        store[timePeriod] = currentVal;
                    }
                }

                //更新
                lastVal        = currentVal;
                timePeriod.End = time;
            }

            return(store);
        }
示例#2
0
 /// <summary>
 /// 初始化
 /// </summary>
 protected override void Init()
 {
     base.Init();
     PolyfitBuilders = new BaseDictionary <int, PolyfitBuilder>()
     {
         CreateFunc = new Func <int, PolyfitBuilder>(keyOrder => new PolyfitBuilder(keyOrder))
     };
     //Geo.Utils.DoubleUtil.AutoSetKeyToDouble(out KeyToDouble, this.TheVeryFirstKey);//基类已设
 }
示例#3
0
        /// <summary>
        /// 以列表形式返回。
        /// </summary>
        /// <returns></returns>
        public BaseDictionary <TKey, List <KeyValuePair <TGroup, RmsedNumeral> > > GetSatValueList()
        {
            var list = new BaseDictionary <TKey, List <KeyValuePair <TGroup, RmsedNumeral> > >();

            foreach (var item in this.GetKeyValueList())
            {
                list.Add(item.Key, item.Value.GetKeyValueList());
            }

            return(list);
        }
示例#4
0
        private static void RemoveRmsGreaterThan(BaseDictionary <TimePeriod, RmsedNumeral> vals, double maxRms)
        {
            List <TimePeriod> toRemoved = new List <TimePeriod>();

            foreach (var item in vals.KeyValues)
            {
                if (item.Value.Rms > maxRms)
                {
                    toRemoved.Add(item.Key);
                }
            }
            vals.Remove(toRemoved);
        }
示例#5
0
        /// <summary>
        /// 获取历元信息
        /// </summary>
        /// <param name="epoch"></param>
        /// <returns></returns>
        public BaseDictionary <TKey, RmsedNumeral> GetEpochValues(Time epoch)
        {
            var result = new BaseDictionary <TKey, RmsedNumeral>();

            foreach (var kv in this.KeyValues)
            {
                foreach (var item in kv.Value.KeyValues)
                {
                    if (item.Key.Contains(epoch))
                    {
                        result[kv.Key] = item.Value;
                        break;//一个卫星获取一个数值即可
                    }
                }
            }
            return(result);
        }
示例#6
0
        /// <summary>
        /// 采用四舍五入法,获取本分组MW的小数部分[-0.5, 0.5],将所有分段的MW合并,加权平均。以第RMS最小的为基准,作差比较,确保在同一个小数区间
        /// </summary>
        /// <param name="maxRms"></param>
        /// <returns></returns>
        public BaseDictionary <TKey, RmsedNumeral> GetAverageRoundFraction(double maxRms = 0.5)
        {
            var dat = new BaseDictionary <TKey, RmsedNumeral>();

            foreach (var item in this.Data)
            {
                var list = item.Value.Values;

                RmsedNumeral ave = Geo.Utils.DoubleUtil.GetAverageRoundFraction(list, maxRms, 3);

                if (ave != null)
                {
                    dat[item.Key] = ave;
                }
            }
            return(dat);
        }
示例#7
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dic"></param>
 /// <param name="KeyToDouble"></param>
 /// <param name="InterruptSpan"></param>
 public InteruptableData(BaseDictionary <TKey, double> dic, Func <TKey, double> KeyToDouble, double InterruptSpan = 5) : base(dic, KeyToDouble, InterruptSpan)
 {
     this.Cashes = new BaseDictionary <Segment <TKey>, NumeralWindowData <TKey> >();
 }
示例#8
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="timeSpan"></param>
 public TempObjectHoulder(TimeSpan timeSpan)
 {
     this.TimeSpan = timeSpan;
     data          = new BaseDictionary <TKey, DateTime>();
 }
示例#9
0
 public override BaseDictionary <int, T> Create(string key)
 {
     this[key] = new BaseDictionary <int, T>();
     return(this[key]);
 }