Example #1
0
        /// <summary>
        /// 从 Sinex 文件中提取 XYZ 坐标。
        /// </summary>
        /// <param name="Site"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public static List <XYZ> GetEstXYZ(string[] Site, string path = "D:\\Test\\igs13p17212.SNX")
        {
            SinexFile     pubSinexFile = SinexReader.Read(path);
            List <string> pubSiteCode  = pubSinexFile.GetSiteCods();

            double[]   pubAllEst = pubSinexFile.GetEstimateVector();
            int        m         = Site.Length;
            List <XYZ> pubXYZ    = new List <XYZ>();

            for (int i = 0; i < m; i++)
            {
                string item = Site[i];
                for (int j = 0; j < pubSiteCode.Count; j++)
                {
                    if (pubSiteCode[j].ToUpper() == item.ToUpper())
                    {
                        XYZ xyz = new XYZ();
                        xyz.Site = item;
                        xyz.X    = pubAllEst[3 * j + 0];
                        xyz.Y    = pubAllEst[3 * j + 1];
                        xyz.Z    = pubAllEst[3 * j + 2];
                        pubXYZ.Add(xyz);
                    }
                }
            }
            return(pubXYZ);
        }
Example #2
0
        private void button_extractcoords_Click(object sender, EventArgs e)
        {
            sinexfile = SinexReader.Read(textBox_sinexFile.Text);
            List <string> sites = sinexfile.GetSiteCods();

            double[] CoordArray = sinexfile.GetEstimateVector();
            sitecood = new Dictionary <string, xyzblh>();
            for (int i = 0; i < sites.Count; i++)
            {
                string   tmpsite   = sites[i];
                XYZ      tmpxyz    = new XYZ(CoordArray[3 * i + 0], CoordArray[3 * i + 1], CoordArray[3 * i + 2]);
                GeoCoord tmplonlat = CoordTransformer.XyzToGeoCoord(tmpxyz, Ellipsoid.WGS84);
                if (!sitecood.Keys.Contains(tmpsite))
                {
                    sitecood.Add(tmpsite, new xyzblh());
                    sitecood[tmpsite].truexyz = tmpxyz;
                    sitecood[tmpsite].lon     = tmplonlat.Lon;
                    sitecood[tmpsite].lat     = tmplonlat.Lat;
                }
            }

            SavePath = this.textBox_uotputpath.Text + "\\sinexcoord" + ".txt";
            //"C:\\Users\\lilinyang\\Desktop\\sinexcoord" + ".txt";
            FileInfo     aFile = new FileInfo(SavePath);
            StreamWriter SW    = aFile.CreateText();

            System.Globalization.NumberFormatInfo GN = new System.Globalization.CultureInfo("zh-CN", false).NumberFormat;
            GN.NumberDecimalDigits = 6;
            foreach (var item in sitecood)
            {
                SW.Write(item.Key.ToString());
                SW.Write(" ");
                SW.Write(item.Value.truexyz.X.ToString());
                SW.Write(" ");
                SW.Write(item.Value.truexyz.Y.ToString());
                SW.Write(" ");
                SW.Write(item.Value.truexyz.Z.ToString());
                SW.Write(" ");
                SW.Write(item.Value.lon.ToString());
                SW.Write(" ");
                SW.Write(item.Value.lat.ToString());
                SW.Write("\n");
            }
            SW.Close();
        }
Example #3
0
        /// <summary>
        /// 获取矩阵l,为观测值减去先验值,是一个列向量。
        /// </summary>
        /// <param name="fileA"></param>
        /// <param name="fileB"></param>
        /// <returns></returns>
        public static double[][] GetObsMinusApriori(SinexFile fileA, SinexFile fileB)
        {
            int paraCountA = fileA.EstimateParamCount;
            int row        = paraCountA + fileB.EstimateParamCount;

            double[][] array = MatrixUtil.Create(row, 1);

            double[] estiamtedA = fileA.GetEstimateVector();
            double[] aprioriA   = fileA.GetAprioriVector();
            double[] estiamtedB = fileB.GetEstimateVector();
            double[] aprioriB   = fileB.GetAprioriVector();

            for (int i = 0; i < paraCountA; i++)
            {
                array[i][0] = estiamtedA[i] - aprioriA[i];
            }

            for (int i = paraCountA; i < paraCountA + estiamtedB.Length; i++)
            {
                array[i][0] = estiamtedB[i - paraCountA] - aprioriB[i - paraCountA];
            }

            return(array);
        }