public void Check_Pure_Gal_Observations_File_With_StoreMode()
        {
            var parser = new RinexObsParser("pure_gal.16o", ParseType.StoreData);

            parser.Parse();

            Assert.IsTrue(parser.RinexType == RinexType.Obs);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.SatelliteSystem == SatelliteSystem.Gal);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.GnssTimeSystem == GnssTimeSystem.Gal);
            Assert.IsTrue(parser.ObservationRecords.Count == 26);

            var metaData = parser.ObsHeader.ObsHeaderData.ObsMetaData;

            CheckObservations(metaData, SatelliteSystem.Gal, new[]
            {
                ObservationCode.C1C, ObservationCode.L1C, ObservationCode.D1C,
                ObservationCode.S1C, ObservationCode.C5Q, ObservationCode.L5Q,
                ObservationCode.D5Q, ObservationCode.S5Q, ObservationCode.C7Q,
                ObservationCode.L7Q, ObservationCode.D7Q, ObservationCode.S7Q,
                ObservationCode.C8Q, ObservationCode.L8Q, ObservationCode.D8Q,
                ObservationCode.S8Q
            });

            var sysPhaseShift = parser.ObsHeader.ObsHeaderData.PhaseShiftDict;

            Assert.IsTrue(sysPhaseShift.ContainsKey(SatelliteSystem.Gal));

            var temp = sysPhaseShift[SatelliteSystem.Gal].SingleOrDefault(t => t.ObservationCode == ObservationCode.L8Q);

            Assert.IsTrue(temp != null);
            Assert.IsTrue(temp.ObservationCode == ObservationCode.L8Q);
            Assert.IsTrue(Math.Abs(temp.CorrectionCycles - -0.25) <= Double.Epsilon);

            var galSatData = parser.GetSatellitesObservations <GalSatellite>();

            CollectionAssert.AllItemsAreNotNull(galSatData.Values as ICollection);
            CollectionAssert.AllItemsAreInstancesOfType(galSatData.Values.SelectMany(t => t).ToArray(),
                                                        typeof(SatelliteObs <GalSatellite>));

            var observedSatellites = parser.GetObservedSatellites();

            Assert.IsTrue(observedSatellites.ContainsKey(SatelliteSystem.Gal));
            IEnumerable <int> galPrns = observedSatellites[SatelliteSystem.Gal];

            CollectionAssert.AreEqual(galPrns.SatellitePrn <GalSatellite>().ToList(),
                                      new[] { GalSatellite.E12, GalSatellite.E19, GalSatellite.E20 });

            Assert.IsTrue(galSatData.Count == 26);
            foreach (var satData in galSatData.Values)
            {
                Assert.IsTrue(satData.Count == 3);
            }
        }
        public void Check_Pure_Bds_Observations_File_With_StoreMode()
        {
            var parser = new RinexObsParser("pure_bds.16o", ParseType.StoreData);

            parser.Parse();
            Assert.IsTrue(parser.RinexType == RinexType.Obs);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.SatelliteSystem == SatelliteSystem.Bds);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.GnssTimeSystem == GnssTimeSystem.Bdt);
            Assert.IsTrue(parser.ObservationRecords.Count == 26);

            var metaData = parser.ObsHeader.ObsHeaderData.ObsMetaData;

            CheckObservations(metaData, SatelliteSystem.Bds, new[]
            {
                ObservationCode.C1I, ObservationCode.L1I, ObservationCode.D1I,
                ObservationCode.S1I, ObservationCode.C7I, ObservationCode.L7I,
                ObservationCode.D7I, ObservationCode.S7I
            });

            var bdsSatData = parser.GetSatellitesObservations <BdsSatellite>();

            CollectionAssert.AllItemsAreNotNull(bdsSatData.Values as ICollection);
            CollectionAssert.AllItemsAreInstancesOfType(bdsSatData.Values.SelectMany(t => t).ToArray(),
                                                        typeof(SatelliteObs <BdsSatellite>));

            var observedSatellites = parser.GetObservedSatellites();

            Assert.IsTrue(observedSatellites.ContainsKey(SatelliteSystem.Bds));
            var galPrns = observedSatellites[SatelliteSystem.Bds];

            CollectionAssert.AreEqual(galPrns.SatellitePrn <BdsSatellite>().ToList(),
                                      new[]
            {
                BdsSatellite.C01, BdsSatellite.C02, BdsSatellite.C03, BdsSatellite.C05, BdsSatellite.C07,
                BdsSatellite.C08, BdsSatellite.C10, BdsSatellite.C12,
            });

            Assert.IsTrue(bdsSatData.Count == 26);
            foreach (var satData in bdsSatData.Values)
            {
                Assert.IsTrue(satData.Count == 8);
            }
        }
        public void Check_Pure_Qzss_Observations_File_With_StoreMode()
        {
            var parser = new RinexObsParser("pure_qzss.16o", ParseType.StoreData);

            parser.Parse();

            Assert.IsTrue(parser.RinexType == RinexType.Obs);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.SatelliteSystem == SatelliteSystem.Qzss);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.GnssTimeSystem == GnssTimeSystem.Qzs);
            Assert.IsTrue(parser.ObservationRecords.Count == 26);

            var metaData = parser.ObsHeader.ObsHeaderData.ObsMetaData;

            CheckObservations(metaData, SatelliteSystem.Qzss, new[]
            {
                ObservationCode.C1C, ObservationCode.L1C, ObservationCode.D1C,
                ObservationCode.S1C, ObservationCode.C2S, ObservationCode.L2S,
                ObservationCode.D2S, ObservationCode.S2S, ObservationCode.C5Q,
                ObservationCode.L5Q, ObservationCode.D5Q, ObservationCode.S5Q
            });

            var qzssSatData = parser.GetSatellitesObservations <QzssSatellite>();

            CollectionAssert.AllItemsAreNotNull(qzssSatData.Values as ICollection);
            CollectionAssert.AllItemsAreInstancesOfType(qzssSatData.Values.SelectMany(t => t).ToArray(),
                                                        typeof(SatelliteObs <QzssSatellite>));


            var observedSatellites = parser.GetObservedSatellites();

            Assert.IsTrue(observedSatellites.ContainsKey(SatelliteSystem.Qzss));
            var galPrns = observedSatellites[SatelliteSystem.Qzss];

            CollectionAssert.AreEqual(galPrns.SatellitePrn <QzssSatellite>().ToList(), new[] { QzssSatellite.J01 });

            Assert.IsTrue(qzssSatData.Count == 26);
            foreach (var satData in qzssSatData.Values)
            {
                Assert.IsTrue(satData.Count == 1);
            }
        }
        public void Check_Pure_Gps_Observations_File_With_StoreMode()
        {
            var parser = new RinexObsParser("pure_gps.16o", ParseType.StoreData);

            parser.Parse();
            Assert.IsTrue(parser.RinexType == RinexType.Obs);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.SatelliteSystem == SatelliteSystem.Gps);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.GnssTimeSystem == GnssTimeSystem.Gps);
            Assert.IsTrue(parser.ObservationRecords.Count == 19);

            var metaData = parser.ObsHeader.ObsHeaderData.ObsMetaData;

            CheckObservations(metaData, SatelliteSystem.Gps, new[]
            {
                ObservationCode.C1C, ObservationCode.L1C, ObservationCode.D1C,
                ObservationCode.S1C, ObservationCode.C2S, ObservationCode.L2S,
                ObservationCode.D2S, ObservationCode.S2S, ObservationCode.C2W,
                ObservationCode.L2W, ObservationCode.D2W, ObservationCode.S2W,
                ObservationCode.C5Q, ObservationCode.L5Q, ObservationCode.D5Q,
                ObservationCode.S5Q
            });

            var sysPhaseShift = parser.ObsHeader.ObsHeaderData.PhaseShiftDict;

            Assert.IsTrue(sysPhaseShift.ContainsKey(SatelliteSystem.Gps));

            var temp = sysPhaseShift[SatelliteSystem.Gps].SingleOrDefault(t => t.ObservationCode == ObservationCode.L2S);

            Assert.IsTrue(temp != null);
            Assert.IsTrue(temp.ObservationCode == ObservationCode.L2S);
            Assert.IsTrue(Math.Abs(temp.CorrectionCycles - -0.25) <= Double.Epsilon);

            temp = sysPhaseShift[SatelliteSystem.Gps].SingleOrDefault(t => t.ObservationCode == ObservationCode.L2X);
            Assert.IsTrue(temp != null);
            Assert.IsTrue(temp.ObservationCode == ObservationCode.L2X);
            Assert.IsTrue(Math.Abs(temp.CorrectionCycles - -0.25) <= Double.Epsilon);


            var gpsObsData = parser.GetSatellitesObservations <GpsSatellite>();

            CollectionAssert.AllItemsAreNotNull(gpsObsData.Values as ICollection);
            CollectionAssert.AllItemsAreInstancesOfType(gpsObsData.Values.SelectMany(t => t).ToArray(),
                                                        typeof(SatelliteObs <GpsSatellite>));

            var observedSatellites = parser.GetObservedSatellites();

            Assert.IsTrue(observedSatellites.ContainsKey(SatelliteSystem.Gps));
            var galPrns = observedSatellites[SatelliteSystem.Gps];

            CollectionAssert.AreEqual(galPrns.SatellitePrn <GpsSatellite>().ToList(),
                                      new[]
            {
                GpsSatellite.G05, GpsSatellite.G12, GpsSatellite.G14, GpsSatellite.G15, GpsSatellite.G18,
                GpsSatellite.G20, GpsSatellite.G21, GpsSatellite.G24, GpsSatellite.G25, GpsSatellite.G29,
                GpsSatellite.G31, GpsSatellite.G32
            });


            Assert.IsTrue(gpsObsData.Count == 19);
            foreach (var satData in gpsObsData.Values)
            {
                Assert.IsTrue(satData.Count == 12);
            }
        }
        public void Check_Pure_Glo_Observations_File_With_StoreMode()
        {
            var parser = new RinexObsParser("pure_glo.16o", ParseType.StoreData);

            parser.Parse();
            Assert.IsTrue(parser.RinexType == RinexType.Obs);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.SatelliteSystem == SatelliteSystem.Glo);
            Assert.IsTrue(parser.ObsHeader.ObsHeaderData.GnssTimeSystem == GnssTimeSystem.Glo);
            Assert.IsTrue(parser.ObservationRecords.Count == 19);

            var metaData = parser.ObsHeader.ObsHeaderData.ObsMetaData;

            CheckObservations(metaData, SatelliteSystem.Glo, new[]
            {
                ObservationCode.C1C, ObservationCode.L1C, ObservationCode.D1C,
                ObservationCode.S1C, ObservationCode.C2P, ObservationCode.L2P,
                ObservationCode.D2P, ObservationCode.S2P
            });

            var phaseCorrections = parser.ObsHeader.ObsHeaderData.GloPhaseBiasCor;

            Assert.IsTrue(phaseCorrections.ContainsKey(ObservationCode.C1C));
            Assert.IsTrue(Math.Abs(phaseCorrections[ObservationCode.C1C] - -71.940) < Double.Epsilon);

            Assert.IsTrue(phaseCorrections.ContainsKey(ObservationCode.C1P));
            Assert.IsTrue(Math.Abs(phaseCorrections[ObservationCode.C1P] - -71.940) < Double.Epsilon);

            Assert.IsTrue(phaseCorrections.ContainsKey(ObservationCode.C2C));
            Assert.IsTrue(Math.Abs(phaseCorrections[ObservationCode.C2C] - -71.940) < Double.Epsilon);

            Assert.IsTrue(phaseCorrections.ContainsKey(ObservationCode.C2P));
            Assert.IsTrue(Math.Abs(phaseCorrections[ObservationCode.C2P] - -71.940) < Double.Epsilon);

            var slotFrqKeys   = parser.ObsHeader.ObsHeaderData.GloSlotFreqDict.Keys;
            var slotFrqValues = parser.ObsHeader.ObsHeaderData.GloSlotFreqDict.Values;

            var expected = new List <GloSatellite>();
            var temp     = Enum.GetValues(typeof(GloSatellite));

            for (var i = 0; i < 24; i++)
            {
                expected.Add((GloSatellite)temp.GetValue(i));
            }

            CollectionAssert.AreEqual(expected, slotFrqKeys);
            CollectionAssert.AreEqual(
                new[] { 1, -4, 5, 6, 1, -4, 5, 6, -6, -7, 0, -1, -2, -7, 0, -1, 4, -3, 3, 2, 4, -3, 3, 2 }, slotFrqValues);

            var gloSatData = parser.GetSatellitesObservations <GloSatellite>();

            CollectionAssert.AllItemsAreNotNull(gloSatData.Values as ICollection);
            CollectionAssert.AllItemsAreInstancesOfType(gloSatData.Values.SelectMany(t => t).ToArray(),
                                                        typeof(SatelliteObs <GloSatellite>));


            var observedSatellites = parser.GetObservedSatellites();

            Assert.IsTrue(observedSatellites.ContainsKey(SatelliteSystem.Glo));
            var galPrns = observedSatellites[SatelliteSystem.Glo];

            CollectionAssert.AreEqual(galPrns.SatellitePrn <GloSatellite>().ToList(),
                                      new[]
            {
                GloSatellite.R01, GloSatellite.R08, GloSatellite.R10, GloSatellite.R11, GloSatellite.R13,
                GloSatellite.R22, GloSatellite.R23, GloSatellite.R24
            });


            Assert.IsTrue(gloSatData.Count == 19);
            foreach (var satData in gloSatData.Values)
            {
                Assert.IsTrue(satData.Count == 8 || satData.Count == 7);
            }
        }