public static string SatelliteCountryCode(this SatelliteSystem system) { switch (system) { case SatelliteSystem.Gps: return("G"); case SatelliteSystem.Glo: return("R"); case SatelliteSystem.Gal: return("E"); case SatelliteSystem.Qzss: return("J"); case SatelliteSystem.Bds: return("C"); case SatelliteSystem.Irnss: return("I"); case SatelliteSystem.Sbas: return("S"); default: throw new ArgumentOutOfRangeException("system", system, null); } }
public static string SatellitePrnString(SatelliteSystem system, int satNum) { switch (system) { case SatelliteSystem.Gps: return(Enum.GetName(typeof(GpsSatellite), satNum)); case SatelliteSystem.Glo: return(Enum.GetName(typeof(GloSatellite), satNum)); case SatelliteSystem.Gal: return(Enum.GetName(typeof(GalSatellite), satNum)); case SatelliteSystem.Qzss: return(Enum.GetName(typeof(QzssSatellite), satNum)); case SatelliteSystem.Bds: return(Enum.GetName(typeof(BdsSatellite), satNum)); case SatelliteSystem.Irnss: return(Enum.GetName(typeof(IrnssSatellite), satNum)); case SatelliteSystem.Sbas: return(Enum.GetName(typeof(SbasSatellite), satNum)); default: throw new ArgumentOutOfRangeException("system", system, null); } }
public IEnumerable <IonoCorrections> GetCorrections(SatelliteSystem satSys, IonoCorrectionsEnum corType, char timeMark, int satId) { return(IonoCorrections.Where(t => t.SatId.HasValue && t.SatId.Value == satId && t.SatelliteSystem == satSys && t.HasCorrection(corType) && Char.ToLowerInvariant(t.TimeMark).Equals(Char.ToLowerInvariant(timeMark)))); }
protected override SatelliteObs <T> ParseImpl <T>(ReadOnlyCollection <ObservationCode> obsCode, SatelliteSystem satelliteSystem, string prn) { var intPrn = (int)Enum.Parse(typeof(T), prn, true); var satPrn = (T)Enum.Parse(typeof(T), prn, true); return(_filter.IsGnssDataFit(satelliteSystem, intPrn) ? new SatelliteObs <T>(obsCode, satPrn) : null); }
private static void CheckObservations(IDictionary <SatelliteSystem, GnssObservation> metaData, SatelliteSystem satelliteSystem, ObservationCode[] expectedObs) { Assert.IsTrue(metaData.ContainsKey(satelliteSystem)); var obs = metaData[satelliteSystem]; CollectionAssert.AreEqual(expectedObs, obs.Observations); }
protected virtual SatelliteObs <T> ParseImpl <T>([NotNull] ReadOnlyCollection <ObservationCode> obsCode, SatelliteSystem satelliteSystem, [NotNull] string prn) { if (prn[1] == ' ') { prn = prn.Replace(' ', '0'); } var gpsPrn = (T)Enum.Parse(typeof(T), prn, true); return(new SatelliteObs <T>(obsCode, gpsPrn)); }
internal IEnumerable <SatelliteObs> GetSatellitesObs(SatelliteSystem satelliteSystem) { foreach (var satObservation in _satObsrvations) { if (satObservation is SatelliteObs <GpsSatellite> && SatelliteSystem.Gps.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <GpsSatellite>); continue; } if (satObservation is SatelliteObs <GloSatellite> && SatelliteSystem.Glo.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <GloSatellite>); continue; } if (satObservation is SatelliteObs <BdsSatellite> && SatelliteSystem.Bds.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <BdsSatellite>); continue; } if (satObservation is SatelliteObs <GalSatellite> && SatelliteSystem.Gal.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <GalSatellite>); continue; } if (satObservation is SatelliteObs <QzssSatellite> && SatelliteSystem.Qzss.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <QzssSatellite>); continue; } if (satObservation is SatelliteObs <IrnssSatellite> && SatelliteSystem.Irnss.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <IrnssSatellite>); } if (satObservation is SatelliteObs <SbasSatellite> && SatelliteSystem.Sbas.IsSet(satelliteSystem)) { yield return(satObservation as SatelliteObs <SbasSatellite>); } } }
public IonoCorrections(SatelliteSystem satelliteSystem, IEnumerable <double> corrections, IonoCorrectionsEnum startIndex, char?timeMark, int?satId) { _satelliteSystem = satelliteSystem; _timeMark = timeMark; _satId = satId; var index = 0; foreach (var correction in corrections) { Debug.Assert(Enum.IsDefined(typeof(IonoCorrectionsEnum), startIndex + index), "Enum.IsDefined(typeof(IonoCorrectionsEnum),startIndex + index)"); _ionoCorrections.Add(startIndex + index, correction); index++; } }
public SortedList <ObsEpochRecord, ICollection <SatelliteObs> > GetSatellitesObservations( SatelliteSystem satelliteSystem) { var temp = new SortedList <ObsEpochRecord, ICollection <SatelliteObs> >(); foreach (var observationRecord in _obsRecords) { var data = observationRecord.Value as ObservationDataRecord; if (data != null) { var epoch = observationRecord.Key; var satObsCollection = new List <SatelliteObs>(); satObsCollection.AddRange(data.GetSatellitesObs(satelliteSystem)); temp.Add(epoch, satObsCollection); } } return(temp); }
public bool IsGnssDataFit(SatelliteSystem satelliteSystem, int prn) { //check whole gnss system if (_excludedGnsssSystems.HasValue) { if (_excludedGnsssSystems.Value.IsSet(satelliteSystem)) { return(false); } } //check separate satellites if (_excludedSatellites != null) { if (!_excludedSatellites.ContainsKey(satelliteSystem)) { return(true); } var prns = _excludedSatellites[satelliteSystem]; return(!prns.Contains(prn)); } return(true); }
public IEnumerable <IonoCorrections> GetCorrections(SatelliteSystem satSys, IonoCorrectionsEnum corType, int timeMark, int satId) { return(GetCorrections(satSys, corType, CharToHourMap.HourToChar[timeMark], satId)); }
private void ParseIonoCorrectionsImpl([NotNull] Match matchResult, SatelliteSystem satelliteSystem) { var ionoCor = IonoCorrections.SingleOrDefault(t => t.SatelliteSystem == satelliteSystem); if (ionoCor == null) { ionoCor = new IonoCorrections(satelliteSystem); IonoCorrections.Add(ionoCor); } Debug.Assert(ionoCor != null, "ionoCor != null"); var index = 0; var corr = new double[4]; foreach (Capture capture in matchResult.Groups["ioncorr"].Captures) { var temp = capture.Value.Replace('D', 'E'); corr[index] = Double.Parse(temp, CultureInfo.InvariantCulture); index++; } char ab; switch (satelliteSystem) { case SatelliteSystem.Gps: case SatelliteSystem.Irnss: case SatelliteSystem.Qzss: ab = Char.ToLower(matchResult.Groups["AB"].Value[0]); if (ab == 'a') { ionoCor.AddCorrections((int)IonoCorrectionsEnum.Alpha0, corr); } else if (ab == 'b') { ionoCor.AddCorrections((int)IonoCorrectionsEnum.Beta0, corr); } break; case SatelliteSystem.Gal: ionoCor.AddCorrections((int)IonoCorrectionsEnum.Alpha0, corr); break; case SatelliteSystem.Bds: var timeMark = matchResult.Groups["timemark"].Success ? (char?)matchResult.Groups["timemark"].Value[0] : null; var satId = matchResult.Groups["id"].Success ? (int?)matchResult.Groups["id"].Value[0] : null; ab = Char.ToLowerInvariant(matchResult.Groups["AB"].Value[0]); if (ab == 'a') { ionoCor.AddCorrections((int)IonoCorrectionsEnum.Alpha0, corr, satId, timeMark); } else if (ab == 'b') { ionoCor.AddCorrections((int)IonoCorrectionsEnum.Beta0, corr, satId, timeMark); } break; default: throw new ArgumentOutOfRangeException("satelliteSystem"); } }
public IonoCorrections(SatelliteSystem satelliteSystem) { _satelliteSystem = satelliteSystem; }
public void TestValidObsHeader() { var header = new RinexObsHeader(); var headerLines = File.ReadAllLines("valid_header.rnx"); foreach (var headerLine in headerLines) { header.ParseHeaderLine(headerLine); } var obsHeader = header.ObsHeaderData; Assert.AreEqual("3.02", obsHeader.Version); Assert.AreEqual(SatelliteSystem.Mixed, obsHeader.SatelliteSystem); Assert.AreEqual("CNES", obsHeader.HeaderProgramInfo.AgencyInfo); Assert.AreEqual("GR10 V3.22", obsHeader.HeaderProgramInfo.Name); Assert.AreEqual(new DateTime(2016, 03, 27, 23, 59, 44), obsHeader.HeaderProgramInfo.FileCreationDateTime); Assert.AreEqual("CIBG", obsHeader.MarkerName); Assert.AreEqual("GEODETIC", obsHeader.MarkerType); Assert.AreEqual("23101M005", obsHeader.MarkerNumber); Assert.AreEqual("REGINA", obsHeader.Observer); Assert.AreEqual("CNES", obsHeader.Agency); Assert.AreEqual("1700870", obsHeader.RcvInfo.Number); Assert.AreEqual("LEICA GR10", obsHeader.RcvInfo.RcvType); Assert.AreEqual("3.22/6.521", obsHeader.RcvInfo.Version); Assert.AreEqual("725039", obsHeader.AntInfo.Number); Assert.AreEqual("LEIAR25.R4 LEIT", obsHeader.AntInfo.Type); Assert.AreEqual(-1837002.6304, obsHeader.X); Assert.AreEqual(6065627.3599, obsHeader.Y); Assert.AreEqual(-716183.2716, obsHeader.Z); Assert.AreEqual(0.0, obsHeader.AntInfo.DeltaH); Assert.AreEqual(0.0, obsHeader.AntInfo.DeltaE); Assert.AreEqual(0.0, obsHeader.AntInfo.DeltaN); var gpsMetadata = obsHeader.ObsMetaData[SatelliteSystem.Gps]; ObservationCode[] gpsObs = TestUtils.FormObsCodes("C1C L1C D1C S1C C2S L2S D2S S2S C2W L2W D2W S2W C5Q L5Q D5Q S5Q"); CollectionAssert.AreEqual(gpsObs, gpsMetadata.Observations); var gloMetadata = obsHeader.ObsMetaData[SatelliteSystem.Glo]; var gloObs = TestUtils.FormObsCodes("C1C L1C D1C S1C C2P L2P D2P S2P "); CollectionAssert.AreEqual(gloObs, gloMetadata.Observations); var galMetadata = obsHeader.ObsMetaData[SatelliteSystem.Gal]; var galObs = TestUtils.FormObsCodes("C1C L1C D1C S1C C5Q L5Q D5Q S5Q C7Q L7Q D7Q S7Q C8Q L8Q D8Q S8Q"); CollectionAssert.AreEqual(galObs, galMetadata.Observations); var bdsMetadata = obsHeader.ObsMetaData[SatelliteSystem.Bds]; var bdsObs = TestUtils.FormObsCodes("C1I L1I D1I S1I C7I L7I D7I S7I"); CollectionAssert.AreEqual(bdsObs, bdsMetadata.Observations); var qzssMetadata = obsHeader.ObsMetaData[SatelliteSystem.Qzss]; var qzssObs = TestUtils.FormObsCodes("C1C L1C D1C S1C C2S L2S D2S S2S C5Q L5Q D5Q S5Q"); CollectionAssert.AreEqual(qzssObs, qzssMetadata.Observations); var sbasMetadata = obsHeader.ObsMetaData[SatelliteSystem.Sbas]; var sbasObs = TestUtils.FormObsCodes("C1C L1C D1C S1C"); CollectionAssert.AreEqual(sbasObs, sbasMetadata.Observations); Assert.AreEqual("DBHZ", obsHeader.SignalStrengthUnit); Assert.AreEqual(30.0, obsHeader.Interval); Assert.AreEqual(new DateTime(2016, 03, 28), obsHeader.FirstObs); Assert.AreEqual(new DateTime(2016, 03, 28, 23, 59, 30), obsHeader.LastObs); Assert.AreEqual(0, obsHeader.ApplyRcvClockOffset ? 1 : 0); Assert.IsTrue(obsHeader.PhaseShiftDict[SatelliteSystem.Gps].Count == 2); SatelliteSystem s = SatelliteSystem.Gps; Assert.AreEqual(ObservationCode.L2S, obsHeader.PhaseShiftDict[s][0].ObservationCode); Assert.AreEqual(ObservationCode.L2S, obsHeader.PhaseShiftDict[s][0].ObservationCode); Assert.AreEqual(-0.25, obsHeader.PhaseShiftDict[s][0].CorrectionCycles); Assert.AreEqual(ObservationCode.L2X, obsHeader.PhaseShiftDict[s][1].ObservationCode); Assert.AreEqual(-0.25, obsHeader.PhaseShiftDict[s][1].CorrectionCycles); s = SatelliteSystem.Glo; Assert.IsTrue(obsHeader.PhaseShiftDict[s].Count == 1); Assert.AreEqual(ObservationCode.L2P, obsHeader.PhaseShiftDict[s][0].ObservationCode); Assert.AreEqual(0.25, obsHeader.PhaseShiftDict[s][0].CorrectionCycles); s = SatelliteSystem.Gal; Assert.IsTrue(obsHeader.PhaseShiftDict[s].Count == 1); Assert.AreEqual(ObservationCode.L8Q, obsHeader.PhaseShiftDict[s][0].ObservationCode); Assert.AreEqual(-0.25, obsHeader.PhaseShiftDict[s][0].CorrectionCycles); var gloSatFrq = new Dictionary <GloSatellite, int> { { GloSatellite.R01, 1 }, { GloSatellite.R02, -4 }, { GloSatellite.R03, 5 }, { GloSatellite.R04, 6 }, { GloSatellite.R05, 1 }, { GloSatellite.R06, -4 }, { GloSatellite.R07, 5 }, { GloSatellite.R08, 6 }, { GloSatellite.R09, -6 }, { GloSatellite.R10, -7 }, { GloSatellite.R11, 0 }, { GloSatellite.R12, -1 }, { GloSatellite.R13, -2 }, { GloSatellite.R14, -7 }, { GloSatellite.R15, 0 }, { GloSatellite.R16, -1 }, { GloSatellite.R17, 4 }, { GloSatellite.R18, -3 }, { GloSatellite.R19, 3 }, { GloSatellite.R20, 2 }, { GloSatellite.R21, 4 }, { GloSatellite.R22, -3 }, { GloSatellite.R23, 3 }, { GloSatellite.R24, 2 } }; CollectionAssert.AreEqual(gloSatFrq.Values, obsHeader.GloSlotFreqDict.Values); CollectionAssert.AreEqual(gloSatFrq.Keys, obsHeader.GloSlotFreqDict.Keys); /* * 17 17 1851 3 LEAP SECONDS */ Assert.AreEqual(-71.940, obsHeader.GloPhaseBiasCor[ObservationCode.C1C]); Assert.AreEqual(-71.940, obsHeader.GloPhaseBiasCor[ObservationCode.C1P]); Assert.AreEqual(-71.940, obsHeader.GloPhaseBiasCor[ObservationCode.C2C]); Assert.AreEqual(-71.940, obsHeader.GloPhaseBiasCor[ObservationCode.C2P]); Assert.AreEqual(17, obsHeader.LeapSeconds_.CurrentNumOfLeapSeconds); Assert.AreEqual(17, obsHeader.LeapSeconds_.FutureNumOfLeapSeconds); Assert.AreEqual(1851, obsHeader.LeapSeconds_.Week); Assert.AreEqual(3, obsHeader.LeapSeconds_.Day); }
public static bool IsSet(this SatelliteSystem satSystems, SatelliteSystem singleSatSystem) { return((singleSatSystem & satSystems) == singleSatSystem); }
private void ParseIonoCorrectionsImpl([NotNull] Match matchResult, SatelliteSystem satelliteSystem) { var corrections = new List <double>(4); foreach (Capture capture in matchResult.Groups["ioncorr"].Captures) { var temp = capture.Value.Replace('D', 'E'); try { var corVal = Double.Parse(temp, CultureInfo.InvariantCulture); corrections.Add(corVal); } // Handle this case //GAL 2.3500D+01 -3.5156D-02 1.4008D-02 IONOSPHERIC CORR // missing 4th value catch (FormatException) { corrections.Add(0.0); } } char ab; IonoCorrections ionoCor = null; switch (satelliteSystem) { case SatelliteSystem.Gps: case SatelliteSystem.Irnss: case SatelliteSystem.Qzss: ab = Char.ToLower(matchResult.Groups["AB"].Value[0]); if (ab == 'a') { ionoCor = new IonoCorrections(satelliteSystem, corrections, IonoCorrectionsEnum.Alpha0, ' ', null); } else if (ab == 'b') { ionoCor = new IonoCorrections(satelliteSystem, corrections, IonoCorrectionsEnum.Beta0, ' ', null); } break; case SatelliteSystem.Gal: ionoCor = new IonoCorrections(satelliteSystem, corrections, IonoCorrectionsEnum.Ai0, ' ', null); break; case SatelliteSystem.Bds: var timeMark = matchResult.Groups["timemark"].Success ? (char?)matchResult.Groups["timemark"].Value[0] : null; var satId = matchResult.Groups["id"].Success ? (int?)Int32.Parse(matchResult.Groups["id"].Value, CultureInfo.InvariantCulture) : null; ab = Char.ToLowerInvariant(matchResult.Groups["AB"].Value[0]); if (ab == 'a') { ionoCor = new IonoCorrections(satelliteSystem, corrections, IonoCorrectionsEnum.Alpha0, timeMark, satId); } else if (ab == 'b') { ionoCor = new IonoCorrections(satelliteSystem, corrections, IonoCorrectionsEnum.Beta0, timeMark, satId); } break; default: throw new ArgumentOutOfRangeException("satelliteSystem"); } Debug.Assert(ionoCor != null, "ionoCor != null"); IonoCorrections.Add(ionoCor); }
public IEnumerable <IonoCorrections> GetCorrections(SatelliteSystem satSys) { return(_ionoCorrections.Where(t => t.SatelliteSystem == satSys)); }
public IEnumerable <IonoCorrections> GetCorrections(SatelliteSystem satSys, IonoCorrectionsEnum corType) { return(_ionoCorrections.Where(t => t.SatelliteSystem == satSys && t.HasCorrection(corType))); }
public IEnumerable <IonoCorrections> GetBetaCorrections(SatelliteSystem satSys) { return(GetCorrections(satSys, IonoCorrectionsEnum.Beta0)); }