/// <summary> /// 两个文件合并,本方法只适合计算站点不重复,且不相关的情况。 /// 信息只是简单的叠加。只有两个文件都有的信息块才会被合并。 /// </summary> /// <param name="fileB"></param> /// <param name="eraseNonCoord"> 是否清理非坐标的值和对应矩阵</param> public static SinexFile Merge(SinexFile fileA, SinexFile fileB, bool eraseNonCoord = true) { if (eraseNonCoord) { fileA.CleanNonCoordSolutionValue(); fileB.CleanNonCoordSolutionValue(); } SinexFile newFile = EmergeBasic(fileA, fileB); //合并解算结果,不更新标准差 SinexMerger.MergeSolutionValue(newFile.SolutionEstimateBlock, fileA.SolutionEstimateBlock, fileB.SolutionEstimateBlock); SinexMerger.MergeSolutionValue(newFile.SolutionAprioriBlock, fileA.SolutionAprioriBlock, fileB.SolutionAprioriBlock); //统计数据的合并, 需要做一些叠加工作。 SinexStatistic statisticA = fileA.GetStatistic(); SinexStatistic statisticB = fileB.GetStatistic(); if (fileA.SolutionStattisticsBlock != null && fileB.SolutionStattisticsBlock != null) { newFile.SolutionStattisticsBlock.Items = fileA.GetStatistic().Merge(fileB.GetStatistic()).GetSolutionStatistics(); } SinexStatistic statisticNew = newFile.GetStatistic(); double varFactorA = statisticNew.VarianceOfUnitWeight / statisticA.VarianceOfUnitWeight; double varFactorB = statisticNew.VarianceOfUnitWeight / statisticB.VarianceOfUnitWeight; //合并矩阵,协方差矩阵,前面已经判断并重新布置matrix了,此处只管合并。 MergeSolutionMatrix(newFile.SolutionMatrixEstimateCova, fileA.SolutionMatrixEstimateCova, varFactorA, fileB.SolutionMatrixEstimateCova, varFactorB, newFile.SolutionEstimateBlock); MergeSolutionMatrix(newFile.SolutionMatrixAprioriCova, fileA.SolutionMatrixAprioriCova, varFactorA, fileB.SolutionMatrixAprioriCova, varFactorB, newFile.SolutionAprioriBlock); return(newFile); }
/// <summary> /// 清理非坐标的值和对应矩阵,对文件进行瘦身。 /// </summary> public void CleanNonCoordSolutionValue() { if (SolutionEstimateBlock != null && !this.IsOnlyEstimateCoordValue) { SinexMerger.CleanNonCoordSolutionValue(SolutionEstimateBlock, SolutionMatrixEstimateCova); } if (SolutionAprioriBlock != null && !this.IsOnlyAprioriCoordValue) { SinexMerger.CleanNonCoordSolutionValue(SolutionAprioriBlock, SolutionMatrixAprioriCova); } }
/// <summary> /// 合并两个文件的基础信息,如测站名、接收机、天线等信息。 /// 协方差、平差结果等需要计算后添加进来。 /// 只有两个文件都有的信息块才会被合并。 /// </summary> /// <param name="fileA"></param> /// <param name="fileB"></param> /// <returns></returns> public static SinexFile EmergeBasic(SinexFile fileA, SinexFile fileB) { //创建 Sinex 结果文件 SinexFile result = new SinexFile("Gnsser"); SinexMerger.MergeBlock(result.SiteIdBlock, fileA.SiteIdBlock, fileB.SiteIdBlock); SinexMerger.MergeBlock(result.SiteReceiverBlock, fileA.SiteReceiverBlock, fileB.SiteReceiverBlock); SinexMerger.MergeBlock(result.SiteAntennaBlock, fileA.SiteAntennaBlock, fileB.SiteAntennaBlock); SinexMerger.MergeBlock(result.SiteEccentricityBlock, fileA.SiteEccentricityBlock, fileB.SiteEccentricityBlock); SinexMerger.MergeBlock(result.SatelliteIdBlock, fileA.SatelliteIdBlock, fileB.SatelliteIdBlock); SinexMerger.MergeBlock(result.SatellitePhaseCenterBlock, fileA.SatellitePhaseCenterBlock, fileB.SatellitePhaseCenterBlock); SinexMerger.MergeBlock(result.InputHistoryBlock, fileA.InputHistoryBlock, fileB.InputHistoryBlock); SinexMerger.MergeBlock(result.InputFilesBlock, fileA.InputFilesBlock, fileB.InputFilesBlock); SinexMerger.MergeBlock(result.FileCommentBlock, fileA.FileCommentBlock, fileB.FileCommentBlock); SinexMerger.MergeBlock(result.FileAcknowledgementBlock, fileA.FileAcknowledgementBlock, fileB.FileAcknowledgementBlock); SinexMerger.MergeBlock(result.InputHistoryBlock, fileA.InputHistoryBlock, fileB.InputHistoryBlock); SinexMerger.MergeBlock(result.SiteGpsPhaseCenterBlock, fileA.SiteGpsPhaseCenterBlock, fileB.SiteGpsPhaseCenterBlock); SinexMerger.MergeBlock(result.SolutionEpochBlock, fileA.SolutionEpochBlock, fileB.SolutionEpochBlock); return(result); }