/// <summary> /// 从O文件夹创建 /// </summary> /// <param name="oDir"></param> /// <returns></returns> public static CrdFile CreateFromODir(string oDir) { CrdFile file = new CrdFile() { Comments = new List <string>(), DateString = DateTime.Now.ToString(), Datum = "IGS00", Epoch = Time.Parse("2000-01-01 00:00:00"), Items = new List <CrdItem>(), Label = "IGS00 COORDINATES BASED ON SINEX O Files" }; file.Items = new List <CrdItem>(); string[] files = Directory.GetFiles(oDir, Setting.RinexOFileFilter); int num = 1; foreach (var item in files) { Data.Rinex.RinexObsFileHeader h = new Data.Rinex.RinexObsFileReader(item).GetHeader(); //判断是否已经存在。 string makerName = StringUtil.FillZero(h.MarkerName.ToUpper(), 4).Substring(0, 4); if (file.Items.Find(m => m.StationName == makerName) != null) { continue; } string code = h.SiteInfo.MarkerNumber; file.Items.Add(new CrdItem(num++, makerName, code, h.ApproxXyz)); } return(file); }
protected override void Execute(string inPath, string outPath) { //先整体探测一遍。 Gnsser.Data.Rinex.RinexObsFileReader reader = new Data.Rinex.RinexObsFileReader(inPath); var oldHeader = reader.GetHeader(); var processer = new SatConsecutiveAnalyst(oldHeader.Interval); foreach (var item in reader) { var obs = Domain.EpochInformation.Parse(item, item.Header.SatelliteTypes); processer.Revise(ref obs); } var smallParts = processer.SatSequentialPeriod.GetFilteredPeriods(MinSuccessiveCount * oldHeader.Interval, true); //写入到流 Gnsser.Data.Rinex.RinexObsFileWriter writer = new Data.Rinex.RinexObsFileWriter(outPath, this.CurrentParam.OutputVersion); EpochInfoToRinex EpochInfoToRinex = new Domain.EpochInfoToRinex(3.02, false); // Gnsser.Data.Rinex.RinexObsFileHeader newHeader = null; int maxBufferEpoch = 200; int i = 0; reader.Reset(); foreach (var item in reader) { var epochInfo = Domain.EpochInformation.Parse(item, item.Header.SatelliteTypes); FilterSat(smallParts, epochInfo); var epochObs = EpochInfoToRinex.Build(epochInfo); if (newHeader == null) { newHeader = epochObs.Header; writer.WriteHeader(newHeader); } writer.WriteEpochObservation(epochObs); // throw new Exception("需要实现 EpochInformation 向 RinexEpcohObs 的转换"); if (i > maxBufferEpoch) { writer.Writer.Flush(); } i++; } writer.Writer.Close(); //cycleSlipProcesser.SatPeriodInfoManager.SaveSatPeriodText(outPath + "_BreakingChart.txt"); //File.WriteAllText(outPath + "__BreakingPeriod.txt", cycleSlipProcesser.SatPeriodInfoManager.ToFormatedString(), Encoding.UTF8); }
private void button_getLonLatFromObsFile_Click(object sender, EventArgs e) { if (openFileDialog_obs.ShowDialog() == DialogResult.OK) { RinexObsFileHeader h = new Data.Rinex.RinexObsFileReader(openFileDialog_obs.FileName).GetHeader(); this.textBox_stationCoord.Text = CoordTransformer.XyzToGeoCoord(h.ApproxXyz, Ellipsoid.WGS84).ToString(); Init(); this.sathelper.StationPos = StationPos; } }
protected override void Execute(string inPath, string outPath) { Gnsser.Data.Rinex.RinexObsFileReader reader = new Data.Rinex.RinexObsFileReader(inPath); var header = reader.GetHeader(); var processer = new SatConsecutionAnalyst(40, 0, header.Interval); foreach (var item in reader) { var obs = Domain.EpochInformation.Parse(item, item.Header.SatelliteTypes); processer.Revise(ref obs); } processer.SatSequentialPeriod.SaveSatPeriodText(outPath + "_BreakingChart.txt"); File.WriteAllText(outPath + "__BreakingPeriod.txt", processer.SatSequentialPeriod.ToFormatedString(), Encoding.UTF8); }
/// <summary> /// 具体的执行. /// </summary> /// <param name="fileInPath"></param> /// <param name="fileOutPath"></param> protected override void Execute(string fileInPath, string fileOutPath) { Gnsser.Data.Rinex.RinexObsFileReader reader = new Data.Rinex.RinexObsFileReader(fileInPath); var oldHeader = reader.GetHeader(); var processer = new SatCycleSlipAnalyst(new List <SatelliteType>() { SatelliteType.G }, oldHeader.Interval); //写入到流 EpochInfoToRinex EpochInfoToRinex = new Domain.EpochInfoToRinex(this.CurrentParam.OutputVersion, false); Gnsser.Data.Rinex.RinexObsFileWriter writer = new Data.Rinex.RinexObsFileWriter(fileOutPath, this.CurrentParam.OutputVersion); Gnsser.Data.Rinex.RinexObsFileHeader newHeader = null; int maxBufferEpoch = 200; int i = 0; foreach (var item in reader) { //标记 var obs = Domain.EpochInformation.Parse(item, item.Header.SatelliteTypes); processer.Revise(ref obs); //写入文件 var epochObs = EpochInfoToRinex.Build(obs); if (newHeader == null) { newHeader = epochObs.Header; writer.WriteHeader(newHeader); } writer.WriteEpochObservation(EpochInfoToRinex.Build(obs)); if (i > maxBufferEpoch) { writer.Writer.Flush(); } } writer.Writer.Close(); processer.SatSequentialPeriod.SaveSatPeriodText(fileOutPath + "_CycleSlip.txt"); File.WriteAllText(fileOutPath + "__cycleSlipPeriod.txt", processer.SatSequentialPeriod.ToFormatedString(), Encoding.UTF8); }
protected override void Execute(string fileInPath, string fileOutPath) { Gnsser.Data.Rinex.RinexObsFileReader reader = new Data.Rinex.RinexObsFileReader(fileInPath); var header = reader.GetHeader(); var Analyst = new SatCycleSlipAnalyst(new List <SatelliteType>() { SatelliteType.G, SatelliteType.C, SatelliteType.R }, header.Interval); foreach (var item in reader) { var obs = Domain.EpochInformation.Parse(item, item.Header.SatelliteTypes); Analyst.Revise(ref obs); } Analyst.SatSequentialPeriod.SaveSatPeriodText(fileOutPath + "_cycleSlipChart.txt"); File.WriteAllText(fileOutPath + "__cycleSlipPeriod.txt", Analyst.SatSequentialPeriod.ToFormatedString(), Encoding.UTF8); }
/// <summary> /// 从 包含 O 文件的文件夹中读取、解析,并创建 StaFile 对象。 /// </summary> /// <param name="oDir"></param> /// <returns></returns> public static StaFile CreateFromODir(string oDir) { StaFile file = new StaFile(); file.Items = new List <StaInfoItem>(); string[] files = Directory.GetFiles(oDir, Setting.RinexOFileFilter); foreach (var path in files) { Data.Rinex.RinexObsFileHeader h = new Data.Rinex.RinexObsFileReader(path).GetHeader(); string name = h.MarkerName.Length > 4 ? h.MarkerName.Substring(0, 4).ToUpper() : h.MarkerName.ToUpper(); //是否已经添加同名测站 if (file.Items.Find(m => m.MakerName == name) != null) { continue; } StaInfoItem sta = new StaInfoItem(name, h.SiteInfo, path); file.Items.Add(sta); } return(file); }
/// <summary> /// 从观测文件夹中读取。 /// </summary> /// <param name="oDir"></param> /// <returns></returns> public static VelFile CreateFromODir(string oDir) { VelFile file = new VelFile() { Comments = new List <string>(), DateString = DateTime.Now + "", Datum = "IGS00", Epoch = Time.Parse("2000-01-01 00:00:00"), Items = new List <VelItem>(), Label = "NUVEL1A-NNR VELOCITIES " }; file.Items = new List <VelItem>(); string[] files = Directory.GetFiles(oDir, Setting.RinexOFileFilter); int num = 1; foreach (var item in files) { Data.Rinex.RinexObsFileHeader h = new Data.Rinex.RinexObsFileReader(item).GetHeader(); //判断是否已经存在。 string makerName = StringUtil.FillZero(h.MarkerName.ToUpper(), 4).Substring(0, 4); if (file.Items.Find(m => m.StationName == makerName) != null) { continue; } string code = h.SiteInfo.MarkerNumber; file.Items.Add(new VelItem() { Code = code, Flag = "", Num = num++, Plate = "", StationName = makerName, Vxyz = new XYZ() }); } return(file); }
/// <summary> /// 从包含O文件的文件夹中提取。 /// </summary> /// <param name="oDir"></param> /// <returns></returns> public static AbbFile CreateFromODir(string oDir) { AbbFile file = new AbbFile(); file.Items = new List <AbbItem>(); string[] files = Directory.GetFiles(oDir, Setting.RinexOFileFilter); foreach (var item in files) { Data.Rinex.RinexObsFileHeader h = new Data.Rinex.RinexObsFileReader(item).GetHeader(); //判断是否已经存在。 string makerName = StringUtil.FillZero(h.SiteInfo.SiteName.ToUpper(), 4).Substring(0, 4); if (file.Items.Find(m => m.MakerName == makerName) != null) { continue; } AbbItem sta = new AbbItem(makerName, h.SiteInfo.MarkerNumber, file.Items); file.Items.Add(sta); } return(file); }
/// <summary> /// open one OpenFileDialog to select rinex O files, and create one anyinfo point layer; /// </summary> /// <param name="t"></param> /// <returns></returns> public static Layer OpenAndShowOFileOnMap(string title) { Layer layer = null; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = Setting.RinexOFileFilter; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string[] files = openFileDialog.FileNames; List <AnyInfo.Geometries.Point> lonlats = new List <AnyInfo.Geometries.Point>(); Geo.IO.InputFileManager inputFileManager = new Geo.IO.InputFileManager(Setting.TempDirectory); foreach (var item in files) { var local = inputFileManager.GetLocalFilePath(item, "*.*O;*.rnx", "*.*"); Data.Rinex.RinexObsFileHeader header = new Data.Rinex.RinexObsFileReader(local).GetHeader(); if (header.ApproxXyz == null) { continue; } Geo.Coordinates.GeoCoord lonlat = Geo.Coordinates.CoordTransformer.XyzToGeoCoord(header.ApproxXyz); lonlats.Add(new AnyInfo.Geometries.Point(lonlat, Path.GetFileNameWithoutExtension(item).Substring(0, 4)) { Name = header.MarkerName }); header = null;//释放资源。 } layer = LayerFactory.CreatePointLayer(lonlats, title); } return(layer); }
private void button_run_Click(object sender, EventArgs e) { string dirPath = this.textBox_dir.Text; string selectedDir = this.textBox_selectedPath.Text; string antstr = this.textBox_ant.Text; char[] splitChars = new char[] { ' ', ',', ';', '\n', '\r' }; string[] ants = antstr.Split(splitChars, StringSplitOptions.RemoveEmptyEntries); string[] files = Directory.GetFiles(dirPath, "*.*O"); if (!Directory.Exists(selectedDir)) { Directory.CreateDirectory(selectedDir); } int maxSatCount = int.Parse(this.textBox_satCount.Text); string[] includedSites = this.textBox_sitesIncluded.Text.Split(splitChars, StringSplitOptions.RemoveEmptyEntries); string[] includeReceiver = this.textBox_receivers.Lines; this.progressBarComponent1.InitProcess(files.Length); List <string> paths = new List <string>(); foreach (var item in files) { this.progressBarComponent1.PerformProcessStep(); bool selected = false; string fileName = Path.GetFileNameWithoutExtension(item).ToUpper(); this.progressBarComponent1.ShowInfo("正在处理:" + item); if (this.checkBox_ant.Checked) { if (Gnsser.Data.Rinex.ObsFileFormater.UpperAntTypeName(item, ants)) { selected = true; } } if (!selected && checkBox_satCount.Checked) { //历元卫星数量大于 Gnsser.Data.Rinex.RinexObsFile o = (Data.Rinex.RinexObsFile) new Data.Rinex.RinexObsFileReader(item).ReadObsFile(); foreach (var sec in o) { if (sec.Count > maxSatCount) { selected = true; } } } if (!selected && checkBox_siteIncluded.Checked) { if (includedSites.FirstOrDefault <String>(m => fileName.Contains(m.ToUpper())) != null) { selected = true; } } if (!selected && checkBox_receiverInclude.Checked) { Data.Rinex.RinexObsFileHeader h = new Data.Rinex.RinexObsFileReader(item).GetHeader(); if (includeReceiver.FirstOrDefault <String>(m => m.Trim() != "" && h.SiteInfo.ReceiverType.ToUpper().Contains(m.ToUpper())) != null) { selected = true; } } if (selected) { if (checkBox_remove.Checked) { File.Move(item, Path.Combine(selectedDir, Path.GetFileName(item))); } else { File.Copy(item, Path.Combine(selectedDir, Path.GetFileName(item))); } } } Geo.Utils.FormUtil.ShowIfOpenDirMessageBox(Path.GetDirectoryName(selectedDir)); }