Exemple #1
0
        internal Grib1WaveSpectra2DDirFreq(System.IO.Stream raf)
        {
            SupportClass.Skip(raf, 4);

            byte[] ver = GribNumbers.ReadBytes(raf, 4);
            System.Text.Encoding enc = System.Text.Encoding.ASCII;
            version = enc.GetString(ver);

            SupportClass.Skip(raf, 2);

            directionNumber     = raf.ReadByte();
            frequencyNumber     = raf.ReadByte();
            numberOfDirections  = raf.ReadByte();
            numberOfFrequencies = raf.ReadByte();
            dirScaleFactor      = GribNumbers.int4(raf);
            freqScaleFactor     = GribNumbers.int4(raf);

            SupportClass.Skip(raf, 37);

            directions  = new double[numberOfDirections];
            frequencies = new double[numberOfFrequencies];

            for (int i = 0; i < numberOfDirections; i++)
            {
                int val = GribNumbers.int4(raf);
                directions[i] = (double)val / (double)dirScaleFactor;
            }

            for (int i = 0; i < numberOfFrequencies; i++)
            {
                int val = GribNumbers.int4(raf);
                frequencies[i] = (double)val / (double)freqScaleFactor;
            }
        }