/// <summary> /// Add a blank Good Beam data set to /// the given ensemble. This will use the number /// of bins and beams given to create the Good Beam /// 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 AddGoodBeam(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.AddGoodBeamData(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.GoodBeamID); // Dataset ID }
public void TestEmptyConstructor() { // Create dataset DataSet.Ensemble adcpData = new DataSet.Ensemble(); // Add Sentence to data set adcpData.AddGoodBeamData(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.GoodBeamID); // Dataset ID Assert.IsTrue(adcpData.IsGoodBeamAvail, "IsGoodBeamAvail is incorrect."); Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, adcpData.GoodBeamData.ValueType, "DataType is incorrect."); Assert.AreEqual(30, adcpData.GoodBeamData.NumElements, "Number of Elements is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.GoodBeamData.ElementsMultiplier, "Element Multiplies are incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, adcpData.GoodBeamData.Imag, "Imag is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, adcpData.GoodBeamData.NameLength, "Name length is incorrect."); Assert.AreEqual(DataSet.Ensemble.GoodBeamID, adcpData.GoodBeamData.Name, "Name is incorrect."); Assert.AreEqual(adcpData.GoodBeamData.GoodBeamData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect."); Assert.AreEqual(adcpData.GoodBeamData.GoodBeamData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect."); }
public void TestEmptyConstructor() { // Create dataset DataSet.Ensemble adcpData = new DataSet.Ensemble(); // Add Sentence to data set adcpData.AddGoodBeamData(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.GoodBeamID); // Dataset ID Assert.IsTrue(adcpData.IsGoodBeamAvail, "IsGoodBeamAvail is incorrect."); Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, adcpData.GoodBeamData.ValueType, "DataType is incorrect."); Assert.AreEqual(30, adcpData.GoodBeamData.NumElements, "Number of Elements is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.GoodBeamData.ElementsMultiplier, "Element Multiplies are incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, adcpData.GoodBeamData.Imag, "Imag is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, adcpData.GoodBeamData.NameLength, "Name length is incorrect."); Assert.AreEqual(DataSet.Ensemble.GoodBeamID, adcpData.GoodBeamData.Name, "Name is incorrect."); Assert.AreEqual(adcpData.GoodBeamData.GoodBeamData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect."); Assert.AreEqual(adcpData.GoodBeamData.GoodBeamData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect."); }
public void TestEncodeDecode() { // Create dataset DataSet.Ensemble ensemble = new DataSet.Ensemble(); // Add Sentence to data set ensemble.AddGoodBeamData(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.GoodBeamID); // Dataset ID Assert.IsTrue(ensemble.IsGoodBeamAvail, "IsGoodBeamAvail is incorrect."); Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, ensemble.GoodBeamData.ValueType, "DataType is incorrect."); Assert.AreEqual(30, ensemble.GoodBeamData.NumElements, "Number of Elements is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, ensemble.GoodBeamData.ElementsMultiplier, "Element Multiplies are incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, ensemble.GoodBeamData.Imag, "Imag is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, ensemble.GoodBeamData.NameLength, "Name length is incorrect."); Assert.AreEqual(DataSet.Ensemble.GoodBeamID, ensemble.GoodBeamData.Name, "Name is incorrect."); Assert.AreEqual(ensemble.GoodBeamData.GoodBeamData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect."); Assert.AreEqual(ensemble.GoodBeamData.GoodBeamData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect."); // Modify the array ensemble.GoodBeamData.GoodBeamData[0, 0] = 2; ensemble.GoodBeamData.GoodBeamData[0, 1] = 3; ensemble.GoodBeamData.GoodBeamData[0, 2] = 4; ensemble.GoodBeamData.GoodBeamData[0, 3] = 5; ensemble.GoodBeamData.GoodBeamData[1, 0] = 6; ensemble.GoodBeamData.GoodBeamData[1, 1] = 7; ensemble.GoodBeamData.GoodBeamData[1, 2] = 8; ensemble.GoodBeamData.GoodBeamData[1, 3] = 9; ensemble.GoodBeamData.GoodBeamData[2, 0] = 10; ensemble.GoodBeamData.GoodBeamData[2, 1] = 11; ensemble.GoodBeamData.GoodBeamData[2, 2] = 12; // Encode the data byte[] encode = ensemble.GoodBeamData.Encode(); // Create dataset DataSet.Ensemble ens0 = new DataSet.Ensemble(); // Add Sentence to data set ens0.AddGoodBeamData(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.GoodBeamID, // Dataset ID encode); // Encoded data Assert.IsTrue(ens0.IsGoodBeamAvail, "IsGoodBeamAvail is incorrect."); Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, ens0.GoodBeamData.ValueType, "DataType is incorrect."); Assert.AreEqual(30, ens0.GoodBeamData.NumElements, "Number of Elements is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, ens0.GoodBeamData.ElementsMultiplier, "Element Multiplies are incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, ens0.GoodBeamData.Imag, "Imag is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, ens0.GoodBeamData.NameLength, "Name length is incorrect."); Assert.AreEqual(DataSet.Ensemble.GoodBeamID, ens0.GoodBeamData.Name, "Name is incorrect."); Assert.AreEqual(ens0.GoodBeamData.GoodBeamData.GetLength(0), 30, "Beam Velocity Array Dimension 1 is incorrect."); Assert.AreEqual(ens0.GoodBeamData.GoodBeamData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Beam Velocity Array Dimension 2 is incorrect."); Assert.AreEqual(2, ens0.GoodBeamData.GoodBeamData[0, 0], "0,0 Data is incorrect."); Assert.AreEqual(3, ens0.GoodBeamData.GoodBeamData[0, 1], "0,1 Data is incorrect."); Assert.AreEqual(4, ens0.GoodBeamData.GoodBeamData[0, 2], "0,2 Data is incorrect."); Assert.AreEqual(5, ens0.GoodBeamData.GoodBeamData[0, 3], "0,3 Data is incorrect."); Assert.AreEqual(6, ens0.GoodBeamData.GoodBeamData[1, 0], "1,0 Data is incorrect."); Assert.AreEqual(7, ens0.GoodBeamData.GoodBeamData[1, 1], "1,1 Data is incorrect."); Assert.AreEqual(8, ens0.GoodBeamData.GoodBeamData[1, 2], "1,2 Data is incorrect."); Assert.AreEqual(9, ens0.GoodBeamData.GoodBeamData[1, 3], "1,3 Data is incorrect."); Assert.AreEqual(10, ens0.GoodBeamData.GoodBeamData[2, 0], "2,0 Data is incorrect."); Assert.AreEqual(11, ens0.GoodBeamData.GoodBeamData[2, 1], "2,1 Data is incorrect."); Assert.AreEqual(12, ens0.GoodBeamData.GoodBeamData[2, 2], "2,2 Data is incorrect."); }
public void TestEncodeDecode() { // Create dataset DataSet.Ensemble ensemble = new DataSet.Ensemble(); // Add Sentence to data set ensemble.AddGoodBeamData(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.GoodBeamID); // Dataset ID Assert.IsTrue(ensemble.IsGoodBeamAvail, "IsGoodBeamAvail is incorrect."); Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, ensemble.GoodBeamData.ValueType, "DataType is incorrect."); Assert.AreEqual(30, ensemble.GoodBeamData.NumElements, "Number of Elements is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, ensemble.GoodBeamData.ElementsMultiplier, "Element Multiplies are incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, ensemble.GoodBeamData.Imag, "Imag is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, ensemble.GoodBeamData.NameLength, "Name length is incorrect."); Assert.AreEqual(DataSet.Ensemble.GoodBeamID, ensemble.GoodBeamData.Name, "Name is incorrect."); Assert.AreEqual(ensemble.GoodBeamData.GoodBeamData.GetLength(0), 30, "Good Beam Array Dimension 1 is incorrect."); Assert.AreEqual(ensemble.GoodBeamData.GoodBeamData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Good Beam Array Dimension 2 is incorrect."); // Modify the array ensemble.GoodBeamData.GoodBeamData[0, 0] = 2; ensemble.GoodBeamData.GoodBeamData[0, 1] = 3; ensemble.GoodBeamData.GoodBeamData[0, 2] = 4; ensemble.GoodBeamData.GoodBeamData[0, 3] = 5; ensemble.GoodBeamData.GoodBeamData[1, 0] = 6; ensemble.GoodBeamData.GoodBeamData[1, 1] = 7; ensemble.GoodBeamData.GoodBeamData[1, 2] = 8; ensemble.GoodBeamData.GoodBeamData[1, 3] = 9; ensemble.GoodBeamData.GoodBeamData[2, 0] = 10; ensemble.GoodBeamData.GoodBeamData[2, 1] = 11; ensemble.GoodBeamData.GoodBeamData[2, 2] = 12; // Encode the data byte[] encode = ensemble.GoodBeamData.Encode(); // Create dataset DataSet.Ensemble ens0 = new DataSet.Ensemble(); // Add Sentence to data set ens0.AddGoodBeamData(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.GoodBeamID, // Dataset ID encode); // Encoded data Assert.IsTrue(ens0.IsGoodBeamAvail, "IsGoodBeamAvail is incorrect."); Assert.AreEqual(DataSet.Ensemble.DATATYPE_FLOAT, ens0.GoodBeamData.ValueType, "DataType is incorrect."); Assert.AreEqual(30, ens0.GoodBeamData.NumElements, "Number of Elements is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, ens0.GoodBeamData.ElementsMultiplier, "Element Multiplies are incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_IMAG, ens0.GoodBeamData.Imag, "Imag is incorrect."); Assert.AreEqual(DataSet.Ensemble.DEFAULT_NAME_LENGTH, ens0.GoodBeamData.NameLength, "Name length is incorrect."); Assert.AreEqual(DataSet.Ensemble.GoodBeamID, ens0.GoodBeamData.Name, "Name is incorrect."); Assert.AreEqual(ens0.GoodBeamData.GoodBeamData.GetLength(0), 30, "Beam Velocity Array Dimension 1 is incorrect."); Assert.AreEqual(ens0.GoodBeamData.GoodBeamData.GetLength(1), DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, "Beam Velocity Array Dimension 2 is incorrect."); Assert.AreEqual(2, ens0.GoodBeamData.GoodBeamData[0, 0], "0,0 Data is incorrect."); Assert.AreEqual(3, ens0.GoodBeamData.GoodBeamData[0, 1], "0,1 Data is incorrect."); Assert.AreEqual(4, ens0.GoodBeamData.GoodBeamData[0, 2], "0,2 Data is incorrect."); Assert.AreEqual(5, ens0.GoodBeamData.GoodBeamData[0, 3], "0,3 Data is incorrect."); Assert.AreEqual(6, ens0.GoodBeamData.GoodBeamData[1, 0], "1,0 Data is incorrect."); Assert.AreEqual(7, ens0.GoodBeamData.GoodBeamData[1, 1], "1,1 Data is incorrect."); Assert.AreEqual(8, ens0.GoodBeamData.GoodBeamData[1, 2], "1,2 Data is incorrect."); Assert.AreEqual(9, ens0.GoodBeamData.GoodBeamData[1, 3], "1,3 Data is incorrect."); Assert.AreEqual(10, ens0.GoodBeamData.GoodBeamData[2, 0], "2,0 Data is incorrect."); Assert.AreEqual(11, ens0.GoodBeamData.GoodBeamData[2, 1], "2,1 Data is incorrect."); Assert.AreEqual(12, ens0.GoodBeamData.GoodBeamData[2, 2], "2,2 Data is incorrect."); }