예제 #1
0
        /// <summary>
        /// Add a blank Instrument velocity data set to
        /// the given ensemble.  This will use the number
        /// of bins and beams given to create the Instrument
        /// 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 AddInstrumentVelocity(ref DataSet.Ensemble ensemble, int numBins, int numBeams = DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM)
        {
            // Check for null
            if (ensemble == null)
            {
                return;
            }

            // Add a blank Instrument Velocity Data set
            ensemble.AddInstrumentVelocityData(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.InstrumentVelocityID);  // Dataset ID
        }
예제 #2
0
        public void TestEmptyConstructor()
        {
            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

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

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

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

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

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

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

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

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


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

            // Add Sentence to data set
            ens1.AddInstrumentVelocityData(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.InstrumentVelocityID,           // Dataset ID
                                           encode);                                         // Encoded data

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

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

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

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

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

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

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

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

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

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

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

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

            // Add Sentence to data set
            ens1.AddInstrumentVelocityData(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.InstrumentVelocityID,          // Dataset ID
                                            encode);                                        // Encoded data

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

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

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