예제 #1
0
        /// <summary>
        /// Add a blank Earth velocity data set to
        /// the given ensemble.  This will use the number
        /// of bins and beams given to create the Earth
        /// Velocity array.  The array will be empty.
        /// </summary>
        /// <param name="ensemble">Ensemble to add the dataset.</param>
        /// <param name="numBins">Number of bins.</param>
        /// <param name="numBeams">Number of beams.</param>
        public static void AddEarthVelocity(ref DataSet.Ensemble ensemble, int numBins, int numBeams = DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM)
        {
            // Check for null
            if (ensemble == null)
            {
                return;
            }

            // Add a blank Earth Velocity Data set
            ensemble.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,              // Type of data stored (Float or Int)
                                          numBins,                                      // Number of bins
                                          numBeams,                                     // Number of beams
                                          DataSet.Ensemble.DEFAULT_IMAG,                // Default Image
                                          DataSet.Ensemble.DEFAULT_NAME_LENGTH,         // Default Image length
                                          DataSet.Ensemble.EarthVelocityID);            // Dataset ID
        }
예제 #2
0
        public void TestEmptyConstructor()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,                  // Type of data stored (Float or Int)
                                          30,                                               // Number of bins
                                          4,                                                // Number of beams
                                          DataSet.Ensemble.DEFAULT_IMAG,                    // Default Image
                                          DataSet.Ensemble.DEFAULT_NAME_LENGTH,             // Default Image length
                                          DataSet.Ensemble.EarthVelocityID);                // Dataset ID

            Assert.IsTrue(adcpData.IsEarthVelocityAvail, "IsEarthVelocityAvail is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, adcpData.EarthVelocityData.ValueType, "DataType is incorrect.");
            Assert.AreEqual(30, adcpData.EarthVelocityData.NumElements, "Number of Elements is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.EarthVelocityData.ElementsMultiplier, "Element Multiplies are incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, adcpData.EarthVelocityData.Imag, "Imag is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, adcpData.EarthVelocityData.NameLength, "Name length is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.EarthVelocityID, adcpData.EarthVelocityData.Name, "Name is incorrect.");

            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(0), 30, "Earth Velocity Array Dimension 1 is incorrect.");
            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Earth Velocity Array Dimension 2 is incorrect.");
        }
예제 #3
0
        public void TestEmptyConstructor()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,                  // Type of data stored (Float or Int)
                                            30,                                             // Number of bins
                                            4,                                              // Number of beams
                                            DataSet.Ensemble.DEFAULT_IMAG,                  // Default Image
                                            DataSet.Ensemble.DEFAULT_NAME_LENGTH,           // Default Image length
                                            DataSet.Ensemble.EarthVelocityID);              // Dataset ID

            Assert.IsTrue(adcpData.IsEarthVelocityAvail, "IsEarthVelocityAvail is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, adcpData.EarthVelocityData.ValueType, "DataType is incorrect.");
            Assert.AreEqual(30, adcpData.EarthVelocityData.NumElements, "Number of Elements is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.EarthVelocityData.ElementsMultiplier, "Element Multiplies are incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, adcpData.EarthVelocityData.Imag, "Imag is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, adcpData.EarthVelocityData.NameLength, "Name length is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.EarthVelocityID, adcpData.EarthVelocityData.Name, "Name is incorrect.");

            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(0), 30, "Earth Velocity Array Dimension 1 is incorrect.");
            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Earth Velocity Array Dimension 2 is incorrect.");
        }
예제 #4
0
        public void TestEncodeDecode()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,                  // Type of data stored (Float or Int)
                                            30,                                             // Number of bins
                                            4,                                              // Number of beams
                                            DataSet.Ensemble.DEFAULT_IMAG,                  // Default Image
                                            DataSet.Ensemble.DEFAULT_NAME_LENGTH,           // Default Image length
                                            DataSet.Ensemble.EarthVelocityID);              // Dataset ID

            Assert.IsTrue(adcpData.IsEarthVelocityAvail, "IEarthVelocityAvail is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, adcpData.EarthVelocityData.ValueType, "DataType is incorrect.");
            Assert.AreEqual(30, adcpData.EarthVelocityData.NumElements, "Number of Elements is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.EarthVelocityData.ElementsMultiplier, "Element Multiplies are incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, adcpData.EarthVelocityData.Imag, "Imag is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, adcpData.EarthVelocityData.NameLength, "Name length is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.EarthVelocityID, adcpData.EarthVelocityData.Name, "Name is incorrect.");

            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(0), 30, "Earth Velocity Array Dimension 1 is incorrect.");
            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Earth Velocity Array Dimension 2 is incorrect.");

            // Modify the array
            adcpData.EarthVelocityData.EarthVelocityData[0, 0] = 2.3f;
            adcpData.EarthVelocityData.EarthVelocityData[0, 1] = 3.4f;
            adcpData.EarthVelocityData.EarthVelocityData[0, 2] = 4.5f;
            adcpData.EarthVelocityData.EarthVelocityData[0, 3] = 5.6f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 0] = 6.7f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 1] = 7.8f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 2] = 8.9f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 3] = 9.10f;
            adcpData.EarthVelocityData.EarthVelocityData[2, 0] = 10.11f;
            adcpData.EarthVelocityData.EarthVelocityData[2, 1] = 11.12f;
            adcpData.EarthVelocityData.EarthVelocityData[2, 2] = 12.13f;

            // Encode the data
            byte[] encode = adcpData.EarthVelocityData.Encode();

            // Create dataset
            DataSet.Ensemble ens1 = new DataSet.Ensemble();

            // Add Sentence to data set
            ens1.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,                       // Type of data stored (Float or Int)
                                            30,                                             // Number of bins
                                            DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM,        // Number of beams
                                            DataSet.Ensemble.DEFAULT_IMAG,                  // Default Image
                                            DataSet.Ensemble.DEFAULT_NAME_LENGTH,           // Default Image length
                                            DataSet.Ensemble.EarthVelocityID,                    // Dataset ID
                                            encode);                                        // Encoded data

            Assert.IsTrue(ens1.IsEarthVelocityAvail, "IsEarthVelocityAvail is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, ens1.EarthVelocityData.ValueType, "DataType is incorrect.");
            Assert.AreEqual(30, ens1.EarthVelocityData.NumElements, "Number of Elements is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, ens1.EarthVelocityData.ElementsMultiplier, "Element Multiplies are incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, ens1.EarthVelocityData.Imag, "Imag is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, ens1.EarthVelocityData.NameLength, "Name length is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.EarthVelocityID, ens1.EarthVelocityData.Name, "Name is incorrect.");

            Assert.AreEqual(ens1.EarthVelocityData.EarthVelocityData.GetLength(0), 30, "Beam Velocity Array Dimension 1 is incorrect.");
            Assert.AreEqual(ens1.EarthVelocityData.EarthVelocityData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Beam Velocity Array Dimension 2 is incorrect.");

            Assert.AreEqual(2.3f, ens1.EarthVelocityData.EarthVelocityData[0, 0], "0,0 Data is incorrect.");
            Assert.AreEqual(3.4f, ens1.EarthVelocityData.EarthVelocityData[0, 1], "0,1 Data is incorrect.");
            Assert.AreEqual(4.5f, ens1.EarthVelocityData.EarthVelocityData[0, 2], "0,2 Data is incorrect.");
            Assert.AreEqual(5.6f, ens1.EarthVelocityData.EarthVelocityData[0, 3], "0,3 Data is incorrect.");
            Assert.AreEqual(6.7f, ens1.EarthVelocityData.EarthVelocityData[1, 0], "1,0 Data is incorrect.");
            Assert.AreEqual(7.8f, ens1.EarthVelocityData.EarthVelocityData[1, 1], "1,1 Data is incorrect.");
            Assert.AreEqual(8.9f, ens1.EarthVelocityData.EarthVelocityData[1, 2], "1,2 Data is incorrect.");
            Assert.AreEqual(9.10f, ens1.EarthVelocityData.EarthVelocityData[1, 3], "1,3 Data is incorrect.");
            Assert.AreEqual(10.11f, ens1.EarthVelocityData.EarthVelocityData[2, 0], "2,0 Data is incorrect.");
            Assert.AreEqual(11.12f, ens1.EarthVelocityData.EarthVelocityData[2, 1], "2,1 Data is incorrect.");
            Assert.AreEqual(12.13f, ens1.EarthVelocityData.EarthVelocityData[2, 2], "2,2 Data is incorrect.");
        }
예제 #5
0
        public void TestEncodeDecode()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,                  // Type of data stored (Float or Int)
                                          30,                                               // Number of bins
                                          4,                                                // Number of beams
                                          DataSet.Ensemble.DEFAULT_IMAG,                    // Default Image
                                          DataSet.Ensemble.DEFAULT_NAME_LENGTH,             // Default Image length
                                          DataSet.Ensemble.EarthVelocityID);                // Dataset ID

            Assert.IsTrue(adcpData.IsEarthVelocityAvail, "IEarthVelocityAvail is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, adcpData.EarthVelocityData.ValueType, "DataType is incorrect.");
            Assert.AreEqual(30, adcpData.EarthVelocityData.NumElements, "Number of Elements is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.EarthVelocityData.ElementsMultiplier, "Element Multiplies are incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, adcpData.EarthVelocityData.Imag, "Imag is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, adcpData.EarthVelocityData.NameLength, "Name length is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.EarthVelocityID, adcpData.EarthVelocityData.Name, "Name is incorrect.");

            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(0), 30, "Earth Velocity Array Dimension 1 is incorrect.");
            Assert.AreEqual(adcpData.EarthVelocityData.EarthVelocityData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Earth Velocity Array Dimension 2 is incorrect.");

            // Modify the array
            adcpData.EarthVelocityData.EarthVelocityData[0, 0] = 2.3f;
            adcpData.EarthVelocityData.EarthVelocityData[0, 1] = 3.4f;
            adcpData.EarthVelocityData.EarthVelocityData[0, 2] = 4.5f;
            adcpData.EarthVelocityData.EarthVelocityData[0, 3] = 5.6f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 0] = 6.7f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 1] = 7.8f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 2] = 8.9f;
            adcpData.EarthVelocityData.EarthVelocityData[1, 3] = 9.10f;
            adcpData.EarthVelocityData.EarthVelocityData[2, 0] = 10.11f;
            adcpData.EarthVelocityData.EarthVelocityData[2, 1] = 11.12f;
            adcpData.EarthVelocityData.EarthVelocityData[2, 2] = 12.13f;

            // Encode the data
            byte[] encode = adcpData.EarthVelocityData.Encode();


            // Create dataset
            DataSet.Ensemble ens1 = new DataSet.Ensemble();

            // Add Sentence to data set
            ens1.AddEarthVelocityData(DataSet.Ensemble.DATATYPE_FLOAT,                      // Type of data stored (Float or Int)
                                      30,                                                   // Number of bins
                                      DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM,              // Number of beams
                                      DataSet.Ensemble.DEFAULT_IMAG,                        // Default Image
                                      DataSet.Ensemble.DEFAULT_NAME_LENGTH,                 // Default Image length
                                      DataSet.Ensemble.EarthVelocityID,                     // Dataset ID
                                      encode);                                              // Encoded data

            Assert.IsTrue(ens1.IsEarthVelocityAvail, "IsEarthVelocityAvail is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, ens1.EarthVelocityData.ValueType, "DataType is incorrect.");
            Assert.AreEqual(30, ens1.EarthVelocityData.NumElements, "Number of Elements is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, ens1.EarthVelocityData.ElementsMultiplier, "Element Multiplies are incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, ens1.EarthVelocityData.Imag, "Imag is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, ens1.EarthVelocityData.NameLength, "Name length is incorrect.");
            Assert.AreEqual(DataSet.Ensemble.EarthVelocityID, ens1.EarthVelocityData.Name, "Name is incorrect.");

            Assert.AreEqual(ens1.EarthVelocityData.EarthVelocityData.GetLength(0), 30, "Beam Velocity Array Dimension 1 is incorrect.");
            Assert.AreEqual(ens1.EarthVelocityData.EarthVelocityData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Beam Velocity Array Dimension 2 is incorrect.");

            Assert.AreEqual(2.3f, ens1.EarthVelocityData.EarthVelocityData[0, 0], "0,0 Data is incorrect.");
            Assert.AreEqual(3.4f, ens1.EarthVelocityData.EarthVelocityData[0, 1], "0,1 Data is incorrect.");
            Assert.AreEqual(4.5f, ens1.EarthVelocityData.EarthVelocityData[0, 2], "0,2 Data is incorrect.");
            Assert.AreEqual(5.6f, ens1.EarthVelocityData.EarthVelocityData[0, 3], "0,3 Data is incorrect.");
            Assert.AreEqual(6.7f, ens1.EarthVelocityData.EarthVelocityData[1, 0], "1,0 Data is incorrect.");
            Assert.AreEqual(7.8f, ens1.EarthVelocityData.EarthVelocityData[1, 1], "1,1 Data is incorrect.");
            Assert.AreEqual(8.9f, ens1.EarthVelocityData.EarthVelocityData[1, 2], "1,2 Data is incorrect.");
            Assert.AreEqual(9.10f, ens1.EarthVelocityData.EarthVelocityData[1, 3], "1,3 Data is incorrect.");
            Assert.AreEqual(10.11f, ens1.EarthVelocityData.EarthVelocityData[2, 0], "2,0 Data is incorrect.");
            Assert.AreEqual(11.12f, ens1.EarthVelocityData.EarthVelocityData[2, 1], "2,1 Data is incorrect.");
            Assert.AreEqual(12.13f, ens1.EarthVelocityData.EarthVelocityData[2, 2], "2,2 Data is incorrect.");
        }