Exemplo n.º 1
0
 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))));
 }
Exemplo n.º 2
0
        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);
        }
        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");
            }
        }