コード例 #1
0
        public override object Create(Stream fileStream, BinaryReader binaryReader, int offset, int endOffset)
        {
            GeographLocationInfoFor1BD gInfo = new GeographLocationInfoFor1BD();

            fileStream.Seek(offset - 1, SeekOrigin.Begin);
            gInfo.ReferenceEllipse = ToLocalEndian_Core.ReadString(binaryReader.ReadChars(8));
            if (_isBigEndian)
            {
                gInfo.EarthLocationGap = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)) / 10f;
            }
            else
            {
                gInfo.EarthLocationGap = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)) / 10f;
            }
            base.Create(fileStream, binaryReader, offset, endOffset);
            return(gInfo);
        }
コード例 #2
0
        public override object Create(Stream fileStream, BinaryReader binaryReader, int offset, int endOffset)
        {
            CommonInfoFor1BD commInfo = new CommonInfoFor1BD();

            fileStream.Seek(offset, SeekOrigin.Begin);
            if (_isBigEndian)
            {
                commInfo.FileGenPlace       = ToLocalEndian_Core.ReadString(binaryReader.ReadChars(3));
                commInfo.ASCIIBank          = binaryReader.ReadChar();
                commInfo.Version            = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.VersionYear        = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.VersionDay         = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.LogicalRecordLen   = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.RecordBlockLen     = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.HeaderRecordCount  = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.FillFlag17_22      = new UInt16[] { ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)), ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)), ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)) };
                commInfo.DatasetName        = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(42));
                commInfo.HandleBlockFlag    = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(8));
                commInfo.SatelliteIdentify  = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.SensorIdentify     = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.DataType           = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.TIPCode            = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.BeginDayFrom1950   = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4));
                commInfo.DataBeginYear      = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.DataBeginDayOfYear = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.DataBeginUTC       = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4));
                commInfo.EndDayFrom1950     = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4));
                commInfo.DataEndYear        = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.DataEndDayOfYear   = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                commInfo.DataEndUTC         = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4));
                binaryReader.ReadBytes(21924);
                UInt16 is3A_int = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2));
                string is3A_str = Convert.ToString(is3A_int, 2).PadLeft(16, '0');
                commInfo.Current3A       = is3A_str[0] == '0' ? true : false;
                commInfo.CurrentRise     = is3A_str[15] == '0' ? true : false;
                commInfo.SatelliteName   = commInfo.SatelliteIdentify == 3 ? "NOAA16" : commInfo.SatelliteIdentify == 11 ? "NOAA17" : (commInfo.SatelliteIdentify == 13 || commInfo.SatelliteIdentify == 7) ? "NOAA18" : "";
                commInfo.SensorName      = commInfo.SensorIdentify == 0 ? "AVHRR" : "";
                commInfo.FullRecordCount = new FileInfo((fileStream as FileStream).Name).Length / _cstRecordBlockLen - 1;
                commInfo.OrbitBeginTime  = DateTime.Parse(commInfo.DataBeginYear.ToString() + "-01-01").AddDays(commInfo.DataBeginDayOfYear - 1).AddMilliseconds(commInfo.DataBeginUTC);
            }
            else
            {
                commInfo.FileGenPlace      = ToLocalEndian_Core.ReadString(binaryReader.ReadChars(3));
                commInfo.ASCIIBank         = binaryReader.ReadChar();
                commInfo.Version           = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.VersionYear       = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.VersionDay        = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.LogicalRecordLen  = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.RecordBlockLen    = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.HeaderRecordCount = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.FillFlag17_22     = new UInt16[] { ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)),
                                                            ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)),
                                                            ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)) };
                commInfo.DatasetName        = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(42));
                commInfo.HandleBlockFlag    = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(8));
                commInfo.SatelliteIdentify  = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.SensorIdentify     = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.DataType           = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.TIPCode            = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.BeginDayFrom1950   = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4));
                commInfo.DataBeginYear      = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.DataBeginDayOfYear = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.DataBeginUTC       = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4));
                commInfo.EndDayFrom1950     = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4));
                commInfo.DataEndYear        = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.DataEndDayOfYear   = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                commInfo.DataEndUTC         = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4));
                binaryReader.ReadBytes(21924);
                UInt16 is3A_int = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2));
                string is3A_str = Convert.ToString(is3A_int, 2).PadLeft(16, '0');
                commInfo.Current3A       = is3A_str[0] == '0' ? true : false;
                commInfo.CurrentRise     = is3A_str[15] == '0' ? true : false;
                commInfo.SatelliteName   = commInfo.SatelliteIdentify == 3 ? "NOAA16" : commInfo.SatelliteIdentify == 11 ? "NOAA17" : (commInfo.SatelliteIdentify == 13 || commInfo.SatelliteIdentify == 7) ? "NOAA18" : "";
                commInfo.SensorName      = commInfo.SensorIdentify == 0 ? "AVHRR" : "";
                commInfo.FullRecordCount = new FileInfo((fileStream as FileStream).Name).Length / _cstRecordBlockLen - 1;
                commInfo.OrbitBeginTime  = DateTime.Parse(commInfo.DataBeginYear.ToString() + "-01-01").AddDays(commInfo.DataBeginDayOfYear - 1).AddMilliseconds(commInfo.DataBeginUTC);
            }
            base.Create(fileStream, binaryReader, offset, endOffset);
            return(commInfo);
        }