Пример #1
0
        /// <summary>
        /// 读取数据
        /// </summary>
        private void ReadFile()
        {
            string lastChar  = Geo.Utils.StringUtil.GetLastChar(ObsPath);
            string lastChar3 = Geo.Utils.StringUtil.GetLastChar(ObsPath, 3);
            string lastChar5 = Geo.Utils.StringUtil.GetLastChar(ObsPath, 5);

            if (String.Equals(lastChar, "o", StringComparison.CurrentCultureIgnoreCase) || String.Equals(lastChar3, "rnx", StringComparison.CurrentCultureIgnoreCase))
            {
                obsFileReader = new RinexObsFileReader(ObsPath);
                ObsFile       = obsFileReader.ReadObsFile();
            }

            if (String.Equals(lastChar, "z", StringComparison.CurrentCultureIgnoreCase) ||
                String.Equals(lastChar3, "crx", StringComparison.CurrentCultureIgnoreCase) ||
                String.Equals(lastChar5, "crx.gz", StringComparison.CurrentCultureIgnoreCase)
                )
            {
                Geo.IO.InputFileManager inputFileManager = new Geo.IO.InputFileManager(Setting.TempDirectory);
                this.ObsPath  = inputFileManager.GetLocalFilePath(ObsPath, "*.*o;*.rnx", "*.*");
                obsFileReader = new RinexObsFileReader(ObsPath);
                ObsFile       = obsFileReader.ReadObsFile();
            }

            if (String.Equals(lastChar, "s", StringComparison.CurrentCultureIgnoreCase))
            {
                ObsFile = new TableObsFileReader(ObsPath).Read();
            }
            if (ObsFile == null)
            {
                Geo.Utils.FormUtil.ShowWarningMessageBox("不支持输入文件格式!");
                return;
            }

            this.bindingSource_obsInfo.DataSource = ObsFile;
            var prns = ObsFile.GetPrns();

            prns.Sort();
            this.bindingSource_sat.DataSource = prns;

            this.attributeBox1.DataGridView.DataSource = Geo.Utils.ObjectUtil.GetAttributes(ObsFile.Header, false);

            string msg = "";

            msg += "首次观测时间:" + ObsFile.Header.StartTime + "\r\n";
            msg += "最后观测时间:" + ObsFile.Header.EndTime + "\r\n";
            msg += "采样间隔:" + ObsFile.Header.Interval + " 秒" + "\r\n";

            this.textBox_show.Text = msg;
        }
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns></returns>
        public override bool Do()
        {
            var reader = GetParamFileReader();

            foreach (var item in reader)
            {
                StartTime = System.DateTime.Now;

                CurrentParam = (TParam)item;
                var inPath  = item.InputPath;
                var outPath = item.OutputPath;
                //输出检查和设置
                CheckOrSetOutputDirectory(outPath);
                // InputFileManager.LocalTempDirectory = OupputDirecory;
                //输入检查和设置
                var FilePathes = InputFileManager.GetLocalFilePathes(inPath, WorkFileExtension, InputFileExtension);

                //执行计算
                if (CurrentParam.IsParallel)
                {
                    ParallelProcess(item, FilePathes, outPath);
                }
                else
                {
                    SerialProcess(item, FilePathes, outPath);
                }

                var           span       = DateTime.Now - StartTime;
                var           avrPerFile = span.TotalSeconds / FilePathes.Count;
                StringBuilder sb         = new StringBuilder();
                sb.AppendLine("操作 " + this.GetType() + "的参数 " + item + " 执行完成!耗时: " + span.ToString());
                sb.Append("并行度:\t" + item.ParallelProcessCount + "\t文件数:\t" + FilePathes.Count);
                sb.AppendLine("\t总时耗(m):\t" + span.TotalMinutes.ToString("0.0000") + "\t单文件时耗(s):\t " + avrPerFile.ToString("0.000"));
                sb.AppendLine("\t占用内存:\t" + Geo.Utils.ProcessUtil.GetProcessUsedMemoryString());
                //  log.Info(msg);
                log.Fatal(sb.ToString());
            }

            //if (Geo.Utils.FormUtil.ShowYesNoMessageBox(msg + "\r\n是否打开输出目录?") == System.Windows.Forms.DialogResult.Yes)
            //{
            //    Geo.Utils.FileUtil.OpenFileOrDirectory(this.OutputDirectory);
            //}

            return(true);
        }
Пример #3
0
        /// <summary>
        /// 读取数据
        /// </summary>
        private List <RinexObsFileHeader> ReadFileHeaders(string[] filePathes)
        {
            List <RinexObsFileHeader> headers = new List <RinexObsFileHeader>();

            foreach (var obsPath in filePathes)
            {
                RinexObsFileHeader header = null;
                RinexObsFileReader obsFileReader;
                string             lastChar  = Geo.Utils.StringUtil.GetLastChar(obsPath);
                string             lastChar3 = Geo.Utils.StringUtil.GetLastChar(obsPath, 3);
                string             lastChar5 = Geo.Utils.StringUtil.GetLastChar(obsPath, 5);
                if (String.Equals(lastChar, "o", StringComparison.CurrentCultureIgnoreCase) || String.Equals(lastChar3, "rnx", StringComparison.CurrentCultureIgnoreCase))
                {
                    obsFileReader = new RinexObsFileReader(obsPath);
                    header        = obsFileReader.GetHeader();
                }

                if (String.Equals(lastChar, "z", StringComparison.CurrentCultureIgnoreCase) ||
                    String.Equals(lastChar3, "crx", StringComparison.CurrentCultureIgnoreCase) ||
                    String.Equals(lastChar5, "crx.gz", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    Geo.IO.InputFileManager inputFileManager = new Geo.IO.InputFileManager(Setting.TempDirectory);
                    var obsPathes = inputFileManager.GetLocalFilePath(obsPath, "*.*o;*.rnx", "*.*");

                    obsFileReader = new RinexObsFileReader(obsPathes);
                    header        = obsFileReader.GetHeader();
                }
                if (header == null)
                {
                    log.Error("不支持输入文件格式!" + obsPath);
                }
                else
                {
                    headers.Add(header);
                    log.Info("成功读入:" + obsPath);
                }
            }
            return(headers);
        }
Пример #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="OutputDirectory"></param>
 public MultiSiteObsStreamer(string OutputDirectory)
 {
     this.OutputDirectory = OutputDirectory;
     InputFileManager     = new Geo.IO.InputFileManager();
 }