예제 #1
0
        private void button_read_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime from = DateTime.Now;

                string[] filePathes = this.textBox_obsPath.Lines;
                if (this.textBox_obsPath.Lines.Length == 0)
                {
                    throw new ArgumentNullException("请输入文件!");
                }

                StringBuilder sb = new StringBuilder();
                if (this.checkBox_Gnsser.Checked)
                {
                    sb.AppendLine("-------- Gnsser -------------");
                    foreach (var item in filePathes)
                    {
                        sb.AppendLine(new Data.Rinex.RinexObsFileReader(item).GetHeader().ToString());
                    }
                }
                if (this.checkBox_teqc.Checked)
                {
                    string teqcPath = Path.Combine(Setting.ExeFolder, "teqc.exe");
                    Gnsser.Interoperation.Teqc.TeqcFunctionCaller caller = new Gnsser.Interoperation.Teqc.TeqcFunctionCaller(teqcPath);
                    sb.AppendLine("-------- teqc -------------");
                    foreach (var item in filePathes)
                    {
                        sb.AppendLine(caller.Run(Gnsser.Interoperation.Teqc.TeqcFunction.ViewMetadata, item)[0]);
                    }
                }
                if (this.checkBox_source.Checked)
                {
                    sb.AppendLine("-------- SOURCE -------------");
                    foreach (var item in filePathes)
                    {
                        sb.AppendLine(Gnsser.Data.Rinex.RinexObsFileHeader.ReadText(item).ToString());
                    }
                }

                TimeSpan span = DateTime.Now - from;
                string   str  = "耗时:" + span.ToString() + "\r\n";
                sb.Insert(0, str);
                this.textBox_out.Text = sb.ToString();
                Geo.Utils.FormUtil.ShowOkAndOpenDirectory(Path.GetDirectoryName(filePathes[0]));
            }
            catch (Exception ex) { MessageBox.Show("出错了! " + ex.Message); }
        }
예제 #2
0
        /// <summary>
        /// 是否符合要求
        /// </summary>
        /// <param name="inpath"></param>
        /// <returns></returns>
        public bool IsMatch(string inpath)
        {
            var fileName = Path.GetFileName(inpath);
            var reader   = new RinexObsFileReader(inpath, false);
            var header   = reader.GetHeader();

            //多路径效应,此处采用TEQC分析
            if (Option.MultipathMp1.Enabled || Option.MultipathMp2.Enabled)
            {
                #region 利用TEQC分析获取数据多路径值
                var TeqcPath = Setting.GnsserConfig.TeqcPath;
                Gnsser.Interoperation.Teqc.TeqcFunctionCaller call = new Gnsser.Interoperation.Teqc.TeqcFunctionCaller(TeqcPath, Gnsser.Interoperation.Teqc.TeqcFunction.QualityChecking);
                string result = call.Run(inpath)[0];
                //当后台cmd输出流不正常时,说明该测站O文件QC失败!
                if (!result.Contains("SUM ") || ((result.Contains("SUM ")) && result.Substring(result.IndexOf("SUM ") + 63, 4).Replace(" ", "") == "n/a"))
                {
                    //QC失败,还得靠自己算!
                }
                else
                {
                    double Mp1 = double.Parse(result.Substring(result.IndexOf("SUM ") + 63, 4).Replace(" ", ""));
                    double Mp2 = double.Parse(result.Substring(result.IndexOf("SUM ") + 69, 4).Replace(" ", ""));

                    if (this.Option.MultipathMp1.Enabled)
                    {
                        if (Mp1 > this.Option.MultipathMp1.Value)
                        {
                            return(false);
                        }
                    }
                    if (this.Option.MultipathMp2.Enabled)
                    {
                        if (Mp2 > this.Option.MultipathMp2.Value)
                        {
                            return(false);
                        }
                    }
                }

                #endregion
            }

            ObsAnalysisInfo anaInfo = new ObsAnalysisInfo(header);
            //if (this.Option.MultipathMp1.Enabled && anaInfo.HasMultipathFactor)
            //{
            //    if (anaInfo.MultipathFactors[FrequenceType.A] > this.Option.MultipathMp1.Value)
            //    {
            //        return false;
            //    }
            //}

            //if (this.Option.MultipathMp2.Enabled && anaInfo.HasMultipathFactor)
            //{
            //    if (anaInfo.MultipathFactors[FrequenceType.B] > this.Option.MultipathMp2.Value)
            //    {
            //        return false;
            //    }
            //}


            if (Option.IsEnableSatelliteTypes)
            {
                foreach (var satType in Option.SatelliteTypes)
                {
                    if (!header.SatelliteTypes.Contains(satType))
                    {
                        log.Info(fileName + " 不包含系统 " + satType);
                        return(false);
                    }
                }
            }


            if (Option.IsEnableObsCodes)
            {
                var codes = header.ObsCodes;
                foreach (var item in Option.ObsCodes)
                {
                    foreach (var list in codes.Values)
                    {
                        if (!list.Contains(item))
                        {
                            log.Info(fileName + " 不包含 " + item);
                            return(false);
                        }
                    }
                }
            }

            if (Option.IsEnableMinFrequencyCount)
            {
                var codes = header.ObsCodes;

                foreach (var item in codes)
                {
                    var count = MathedCount(item.Value, "L");
                    if (count < Option.MinFrequencyCount)
                    {
                        log.Info(fileName + " 伪距数量少于 " + Option.MinFrequencyCount);
                        return(false);
                    }

                    count = MathedCount(item.Value, new string[] { "C", "P" });
                    if (count < Option.MinFrequencyCount)
                    {
                        log.Info(fileName + " 载波数量少于 " + Option.MinFrequencyCount);
                        return(false);
                    }
                }
            }


            if (Option.IsEnableMinFileSizeMB)
            {
                FileInfo info    = new FileInfo(inpath);
                var      minByte = Option.MinFileSizeMB * 1024L * 1024L;
                if (info.Length < minByte)
                {
                    log.Info(fileName + " 文件小于 " + Option.MinFileSizeMB + " MB");
                    return(false);
                }
            }


            if (Option.IsEnableCenterRegion)
            {
                if (!Option.CenterRegion.Contains(header.ApproxXyz))
                {
                    log.Info(fileName + "  " + header.ApproxXyz + " 不在指定区域内 " + Option.CenterRegion);
                    return(false);
                }
            }

            if (Option.IsEnableExcludeSiteNames)
            {
                if (Option.ExcludeSiteNames.Contains(header.SiteName))
                {
                    log.Info(fileName + " 点名被排除了");
                    return(false);
                }
            }

            if (Option.IsEnableIncludeSiteNames)
            {
                if (!Option.IncludeSiteNames.Contains(header.SiteName))
                {
                    log.Info(fileName + " 点名被排除了");
                    return(false);
                }
            }
            if (Option.IsEnableTimePeriod)
            {
                if (!Option.TimePeriod.Contains(header.StartTime))
                {
                    log.Info(fileName + " 不在指定时段内 " + Option.TimePeriod);
                    return(false);
                }
            }
            //这个比较耗时,放在最后
            if (Option.IsEnableMinEpochCount)
            {
                var count = RinexObsFileReader.ReadGetEpochCount(inpath);
                if (count < Option.MinEpochCount)
                {
                    log.Info(fileName + " 历元数量 " + count + "  少于 " + Option.MinEpochCount);
                    return(false);
                }
            }

            if (Option.IsEnableMinRatioOfSatCount)
            {
                var ratio = RinexObsFileReader.GetRatioOfSatCount(inpath, Option.MinSatCount);
                if (ratio < Option.MinRatioOfSatCount)
                {
                    log.Info(fileName + " 最小卫星数量比率 " + ratio);
                    return(false);
                }
            }

            return(true);
        }