Пример #1
0
 /// <summary> Constructor.</summary>
 /// <param name="header">
 /// </param>
 /// <param name="pds">
 /// </param>
 /// <param name="gdsKey">
 /// </param>
 /// <param name="offset">
 /// </param>
 /// <param name="size">endRecordOffset in file
 /// </param>
 internal Grib1Product(System.String header, Grib1ProductDefinitionSection pds, System.String gdsKey, long offset, long size)
 {
     this.header     = header;
     this.gdsKey     = gdsKey;
     this.pds        = pds;
     dataOffset      = offset;
     endRecordOffset = size;
 }
Пример #2
0
 internal Grib1Record(System.String hdr, Grib1IndicatorSection aIndicatorSection, Grib1ProductDefinitionSection aProductDefinitionSection, Grib1GridDefinitionSection aGridDefinitionSection, long offset, long recOffset, long startOfRecordOffset)
 {
     Header                   = hdr;
     IndicatorSection         = aIndicatorSection;
     ProductDefinitionSection = aProductDefinitionSection;
     GridDefinitionSection    = aGridDefinitionSection;
     DataOffset               = offset;
     endRecordOffset          = recOffset;
     RecordOffset             = startOfRecordOffset;
 }
Пример #3
0
        /// <summary> Constructs a <tt>Grib1Grid</tt> object from a pds.
        ///
        /// </summary>
        /// <param name="pds">Grib1ProductDefinitionSection to formulate grib
        ///
        /// </param>
        internal Grib1Grid(Grib1ProductDefinitionSection pds) : base()
        {
            int generatingProcess = pds.Process_Id;
            int gridNumber        = pds.Grid_Id;

            // checksum = 1000 + grid number
            checksum = "1000" + System.Convert.ToString(gridNumber);

            switch (gridNumber)
            {
            case 21:
            case 22:
            case 23:
            case 24:
            {
                type = 0;                         // Latitude/Longitude
                name = getName(type);

                // (Nx - number of points along x-axis)
                nx = 37;

                // (Ny - number of points along y-axis)
                ny = 37;

                // (resolution and component flags).  See Table 7
                resolution = 0x88;

                // (Dx - Longitudinal Direction Increment )
                dx = 5.0;

                // (Dy - Latitudinal Direction Increment )
                dy = 2.5;

                // (Scanning mode)  See Table 8
                scan = 64;

                if (gridNumber == 21)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = 0.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = 0.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 90.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 180.0;
                }
                else if (gridNumber == 22)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = 0.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = -180.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 90.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 0.0;
                }
                else if (gridNumber == 23)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = -90.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = 0.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 0.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 180.0;
                }
                else if (gridNumber == 24)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = -90.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = -180.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 0.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 0.0;
                }
            }
            break;


            case 25:
            case 26:
            {
                type = 0;                         // Latitude/Longitude
                name = getName(type);

                // (Nx - number of points along x-axis)
                nx = 72;

                // (Ny - number of points along y-axis)
                ny = 19;

                // (resolution and component flags).  See Table 7
                resolution = 0x88;

                // (Dx - Longitudinal Direction Increment )
                dx = 5.0;

                // (Dy - Latitudinal Direction Increment )
                dy = 5.0;

                // (Scanning mode)  See Table 8
                scan = 64;

                if (gridNumber == 25)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = 0.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = 0.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 90.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 355.0;
                }
                else if (gridNumber == 26)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = -90.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = 0.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 0.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 355.0;
                }
            }
            break;


            case 61:
            case 62:
            case 63:
            case 64:
            {
                type = 0;                         // Latitude/Longitude
                name = getName(type);

                // (Nx - number of points along x-axis)
                nx = 91;

                // (Ny - number of points along y-axis)
                ny = 46;

                // (resolution and component flags).  See Table 7
                resolution = 0x88;

                // (Dx - Longitudinal Direction Increment )
                dx = 2.0;

                // (Dy - Latitudinal Direction Increment )
                dy = 2.0;

                // (Scanning mode)  See Table 8
                scan = 64;

                if (gridNumber == 61)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = 0.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = 0.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 90.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 180.0;
                }
                else if (gridNumber == 62)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = 0.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = -180.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 90.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 0.0;
                }
                else if (gridNumber == 63)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = -90.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = 0.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 0.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 180.0;
                }
                else if (gridNumber == 64)
                {
                    // (La1 - latitude of first grid point)
                    lat1 = -90.0;

                    // (Lo1 - longitude of first grid point)
                    lon1 = -180.0;

                    // (La2 - latitude of last grid point)
                    lat2 = 0.0;

                    // (Lo2 - longitude of last grid point)
                    lon2 = 0.0;
                }

                break;
            }

            default:
                System.Console.Out.WriteLine("Grid " + gridNumber + " not configured yet");
                break;
            }
        } // end Grib1Grid