コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="br">binary reader</param>
        public GRIB2Message(BinaryReader br)
        {
            GribINS = new GRIB2IndicatorSection(br);
            GribIDS = new GRIB2IdentificationSection(br);
            int sectionNum = GRIBData.ReadSectionNumber(br);

            if (sectionNum == 2)
            {
                GribLUS = new GRIB2LocalUseSection(br);
            }

            GribGDS = new GRIB2GridDefinitionSection(br);
            GribPDS = new GRIB2ProductDefinitionSection(br);
            GribDRS = new GRIB2DataRepresentationSection(br);
            GribBMS = new GRIB2BitMapSection(br);
            GribDS  = new GRIB2DataSection(br, GribGDS, GribDRS, GribBMS);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="br">binary reader</param>
        /// <param name="startSection">start section</param>
        /// <param name="startPos">start position</param>
        public GRIB2Message(BinaryReader br, int startSection, long startPos)
        {
            GribINS = new GRIB2IndicatorSection(br);
            GribIDS = new GRIB2IdentificationSection(br);
            if (startSection == 2)
            {
                br.BaseStream.Position = startPos;
                GribLUS = new GRIB2LocalUseSection(br);
                GribGDS = new GRIB2GridDefinitionSection(br);
                GribPDS = new GRIB2ProductDefinitionSection(br);
                GribDRS = new GRIB2DataRepresentationSection(br);
                GribBMS = new GRIB2BitMapSection(br);
                GribDS  = new GRIB2DataSection(br, GribGDS, GribDRS, GribBMS);
            }
            else
            {
                int sectionNum = GRIBData.ReadSectionNumber(br);
                if (sectionNum == 2)
                {
                    GribLUS = new GRIB2LocalUseSection(br);
                }

                switch (startSection)
                {
                case 3:
                    br.BaseStream.Position = startPos;
                    GribGDS = new GRIB2GridDefinitionSection(br);
                    GribPDS = new GRIB2ProductDefinitionSection(br);
                    GribDRS = new GRIB2DataRepresentationSection(br);
                    GribBMS = new GRIB2BitMapSection(br);
                    GribDS  = new GRIB2DataSection(br, GribGDS, GribDRS, GribBMS);
                    break;

                case 4:
                    GribGDS = new GRIB2GridDefinitionSection(br);
                    br.BaseStream.Position = startPos;
                    GribPDS = new GRIB2ProductDefinitionSection(br);
                    GribDRS = new GRIB2DataRepresentationSection(br);
                    GribBMS = new GRIB2BitMapSection(br);
                    GribDS  = new GRIB2DataSection(br, GribGDS, GribDRS, GribBMS);
                    break;
                }
            }
        }