예제 #1
0
        public static bool Is1A5(byte[] bytes, string fileExtension)
        {
            UInt16 satelliteId = ToLocalEndian.ToUInt16FromBig(new byte[] { bytes[0], bytes[1] });

            if (satelliteId != 113 && satelliteId != 114)
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        private static D1A5Header CreateFileHeader(FileStream fs, BinaryReader br, int offset, int endOffset)
        {
            D1A5Header hInfo = new D1A5Header();

            fs.Seek(offset, SeekOrigin.Begin);
            hInfo.SatelliteIdentify    = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.DataBeginYear        = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.DataBeginMilliSecond = ToLocalEndian.ToUInt32FromBig(br.ReadBytes(4));
            hInfo.DataBeginDayNums     = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.DataEndYear          = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.DataEndMilliSecond   = ToLocalEndian.ToUInt32FromBig(br.ReadBytes(4));
            hInfo.DataEndDayNums       = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.RecordCount          = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.LastRecord           = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.ErrorFrameCount      = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.BitErrorRatio        = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            fs.Seek(2, SeekOrigin.Current);
            hInfo.ErrorTimeOrder     = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.LostRecordCount    = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.SlopeAnalyseResult = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            fs.Seek(164, SeekOrigin.Current);
            hInfo.TrackNumber            = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.EpochTrackTime         = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.Time                   = GetTime(hInfo.EpochTrackTime);
            hInfo.OrbitSemiMajorAxis     = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.OrbitEccentricity      = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.OrbitInclination       = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.LongitudeAscendingNode = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.PerigeeAngle           = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.MeanAnomaly            = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.AscDescendTag          = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.ResurceType            = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            hInfo.OrbitNumber            = ToLocalEndian.ToUInt16FromBig(br.ReadBytes(2));
            fs.Seek(2, SeekOrigin.Current);
            hInfo.OrbitCycle = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            //角度信息
            hInfo.Angles = GetAngles(br.ReadBytes(24));
            fs.Seek(20, SeekOrigin.Current);
            float[] lats, lons;
            GetPosition(br.ReadBytes(32), out lats, out lons);
            hInfo.Lats = lats;
            hInfo.Lons = lons;
            fs.Seek(4, SeekOrigin.Current);
            hInfo.DataBeginSecond = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.DataEndSecond   = ToLocalEndian.ToDouble64FromBig(br.ReadBytes(8));
            hInfo.SatelliteName   = hInfo.SatelliteIdentify == 113 ? "FY1C" : "FY1D";
            hInfo.OrbitBeginTime  = DateTime.Parse(hInfo.DataBeginYear.ToString() + "-01-01").AddDays(hInfo.DataBeginDayNums - 1).AddMilliseconds(hInfo.DataBeginMilliSecond);
            return(hInfo);
        }