コード例 #1
0
ファイル: EnsembleHelper.cs プロジェクト: 759991469/RTI
        /// <summary>
        /// Add a blank Good Earth data set to
        /// the given ensemble.  This will use the number
        /// of bins and beams given to create the Good Earth
        /// 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 AddGoodEarth(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.AddGoodEarthData(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.GoodEarthID);                    // Dataset ID
        }
コード例 #2
0
ファイル: GoodEarthDataSetTest.cs プロジェクト: 759991469/RTI
        public void TestEmptyConstructor()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddGoodEarthData(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.GoodEarthID);                        // Dataset ID

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

            Assert.AreEqual(adcpData.GoodEarthData.GoodEarthData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect.");
            Assert.AreEqual(adcpData.GoodEarthData.GoodEarthData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect.");
        }
コード例 #3
0
ファイル: GoodEarthDataSetTest.cs プロジェクト: 759991469/RTI
        public void TestEncodeDecode()
        {
            // Create dataset
            DataSet.Ensemble ensemble = new DataSet.Ensemble();

            // Add Sentence to data set
            ensemble.AddGoodEarthData(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.GoodEarthID);                        // Dataset ID

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

            Assert.AreEqual(ensemble.GoodEarthData.GoodEarthData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect.");
            Assert.AreEqual(ensemble.GoodEarthData.GoodEarthData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect.");

            // Modify the array
            ensemble.GoodEarthData.GoodEarthData[0, 0] = 2;
            ensemble.GoodEarthData.GoodEarthData[0, 1] = 3;
            ensemble.GoodEarthData.GoodEarthData[0, 2] = 4;
            ensemble.GoodEarthData.GoodEarthData[0, 3] = 5;
            ensemble.GoodEarthData.GoodEarthData[1, 0] = 6;
            ensemble.GoodEarthData.GoodEarthData[1, 1] = 7;
            ensemble.GoodEarthData.GoodEarthData[1, 2] = 8;
            ensemble.GoodEarthData.GoodEarthData[1, 3] = 9;
            ensemble.GoodEarthData.GoodEarthData[2, 0] = 10;
            ensemble.GoodEarthData.GoodEarthData[2, 1] = 11;
            ensemble.GoodEarthData.GoodEarthData[2, 2] = 12;

            // Encode the data
            byte[] encode = ensemble.GoodEarthData.Encode();


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

            // Add Sentence to data set
            ens0.AddGoodEarthData(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.GoodEarthID,                          // Dataset ID
                                  encode);                                               // Encoded data

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

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

            Assert.AreEqual(2, ens0.GoodEarthData.GoodEarthData[0, 0], "0,0 Data is incorrect.");
            Assert.AreEqual(3, ens0.GoodEarthData.GoodEarthData[0, 1], "0,1 Data is incorrect.");
            Assert.AreEqual(4, ens0.GoodEarthData.GoodEarthData[0, 2], "0,2 Data is incorrect.");
            Assert.AreEqual(5, ens0.GoodEarthData.GoodEarthData[0, 3], "0,3 Data is incorrect.");
            Assert.AreEqual(6, ens0.GoodEarthData.GoodEarthData[1, 0], "1,0 Data is incorrect.");
            Assert.AreEqual(7, ens0.GoodEarthData.GoodEarthData[1, 1], "1,1 Data is incorrect.");
            Assert.AreEqual(8, ens0.GoodEarthData.GoodEarthData[1, 2], "1,2 Data is incorrect.");
            Assert.AreEqual(9, ens0.GoodEarthData.GoodEarthData[1, 3], "1,3 Data is incorrect.");
            Assert.AreEqual(10, ens0.GoodEarthData.GoodEarthData[2, 0], "2,0 Data is incorrect.");
            Assert.AreEqual(11, ens0.GoodEarthData.GoodEarthData[2, 1], "2,1 Data is incorrect.");
            Assert.AreEqual(12, ens0.GoodEarthData.GoodEarthData[2, 2], "2,2 Data is incorrect.");
        }
コード例 #4
0
ファイル: GoodEarthDataSetTest.cs プロジェクト: Bobfrat/RTI
        public void TestEmptyConstructor()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddGoodEarthData(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.GoodEarthID);                  // Dataset ID

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

            Assert.AreEqual(adcpData.GoodEarthData.GoodEarthData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect.");
            Assert.AreEqual(adcpData.GoodEarthData.GoodEarthData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect.");
        }
コード例 #5
0
ファイル: GoodEarthDataSetTest.cs プロジェクト: Bobfrat/RTI
        public void TestEncodeDecode()
        {
            // Create dataset
            DataSet.Ensemble ensemble = new DataSet.Ensemble();

            // Add Sentence to data set
            ensemble.AddGoodEarthData(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.GoodEarthID);                  // Dataset ID

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

            Assert.AreEqual(ensemble.GoodEarthData.GoodEarthData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect.");
            Assert.AreEqual(ensemble.GoodEarthData.GoodEarthData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect.");

            // Modify the array
            ensemble.GoodEarthData.GoodEarthData[0, 0] = 2;
            ensemble.GoodEarthData.GoodEarthData[0, 1] = 3;
            ensemble.GoodEarthData.GoodEarthData[0, 2] = 4;
            ensemble.GoodEarthData.GoodEarthData[0, 3] = 5;
            ensemble.GoodEarthData.GoodEarthData[1, 0] = 6;
            ensemble.GoodEarthData.GoodEarthData[1, 1] = 7;
            ensemble.GoodEarthData.GoodEarthData[1, 2] = 8;
            ensemble.GoodEarthData.GoodEarthData[1, 3] = 9;
            ensemble.GoodEarthData.GoodEarthData[2, 0] = 10;
            ensemble.GoodEarthData.GoodEarthData[2, 1] = 11;
            ensemble.GoodEarthData.GoodEarthData[2, 2] = 12;

            // Encode the data
            byte[] encode = ensemble.GoodEarthData.Encode();

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

            // Add Sentence to data set
            ens0.AddGoodEarthData(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.GoodEarthID,                    // Dataset ID
                                            encode);                                        // Encoded data

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

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

            Assert.AreEqual(2, ens0.GoodEarthData.GoodEarthData[0, 0], "0,0 Data is incorrect.");
            Assert.AreEqual(3, ens0.GoodEarthData.GoodEarthData[0, 1], "0,1 Data is incorrect.");
            Assert.AreEqual(4, ens0.GoodEarthData.GoodEarthData[0, 2], "0,2 Data is incorrect.");
            Assert.AreEqual(5, ens0.GoodEarthData.GoodEarthData[0, 3], "0,3 Data is incorrect.");
            Assert.AreEqual(6, ens0.GoodEarthData.GoodEarthData[1, 0], "1,0 Data is incorrect.");
            Assert.AreEqual(7, ens0.GoodEarthData.GoodEarthData[1, 1], "1,1 Data is incorrect.");
            Assert.AreEqual(8, ens0.GoodEarthData.GoodEarthData[1, 2], "1,2 Data is incorrect.");
            Assert.AreEqual(9, ens0.GoodEarthData.GoodEarthData[1, 3], "1,3 Data is incorrect.");
            Assert.AreEqual(10, ens0.GoodEarthData.GoodEarthData[2, 0], "2,0 Data is incorrect.");
            Assert.AreEqual(11, ens0.GoodEarthData.GoodEarthData[2, 1], "2,1 Data is incorrect.");
            Assert.AreEqual(12, ens0.GoodEarthData.GoodEarthData[2, 2], "2,2 Data is incorrect.");
        }