public void Setup() { // Create the ensemble ensemble1 = EnsembleHelper.GenerateEnsemble(5, 4, true); ensemble1.EnsembleData.EnsembleNumber = 12; }
/// <summary> /// Screen the ensemble with the given threshold. /// </summary> /// <param name="ensemble">Ensemble to screen.</param> /// <param name="threshold">Threshold to check against.</param> /// <returns>TRUE = screening could be done.</returns> public static bool Screen(ref DataSet.Ensemble ensemble, double threshold) { // If the Earth Velocity does not exist, // then we cannot screen the data if (!ensemble.IsEarthVelocityAvail) { return(false); } // Go through each bin in the Earth Velocity Data for (int bin = 0; bin < ensemble.EarthVelocityData.NumElements; bin++) { if (Math.Abs(ensemble.EarthVelocityData.EarthVelocityData[bin, Ensemble.BEAM_VERTICAL_INDEX]) >= threshold) { //// Mark all the values bad //ensemble.EarthVelocityData.EarthVelocityData[bin, Ensemble.BEAM_EAST_INDEX] = Ensemble.BAD_VELOCITY; //ensemble.EarthVelocityData.EarthVelocityData[bin, Ensemble.BEAM_NORTH_INDEX] = Ensemble.BAD_VELOCITY; //ensemble.EarthVelocityData.EarthVelocityData[bin, Ensemble.BEAM_VERTICAL_INDEX] = Ensemble.BAD_VELOCITY; //ensemble.EarthVelocityData.EarthVelocityData[bin, Ensemble.BEAM_Q_INDEX] = Ensemble.BAD_VELOCITY; // Set all values bad EnsembleHelper.SetVelocitiesBad(ref ensemble, bin); } } return(true); }
/// <summary> /// Screen the data for any velocities above the surface. /// This will check if Range Track data exist. If it does not, /// then we do not know the surface range. It will then check that a /// Range track range is given. If all the range values are bad, /// then we do not know the surface. If they are good, take the average /// of the range. Then determine which bin is located at and surface the water. /// Then mark all the velocities at and above the surface bad. /// </summary> /// <param name="ensemble">Ensemble to screen.</param> /// <param name="prevSurface">Previous Good range.</param> /// <returns>True = Screen could be done.</returns> public static bool Screen(ref DataSet.Ensemble ensemble, double prevSurface = DataSet.Ensemble.BAD_RANGE) { if (ensemble != null) { // Ensure bottom track data exist if (ensemble.IsRangeTrackingAvail && // Needed for Range Tracking Range ensemble.IsAncillaryAvail && // Needed for Blank and Bin Size ensemble.IsEnsembleAvail // Needed for number of bins ) { // Get the bottom double surface = ensemble.RangeTrackingData.GetAverageRange(); // Ensure we found a bottom if (surface == DataSet.Ensemble.BAD_RANGE && prevSurface == DataSet.Ensemble.BAD_RANGE) { return(false); } else if (surface == DataSet.Ensemble.BAD_RANGE && prevSurface != DataSet.Ensemble.BAD_RANGE) { // PrevBottom is good, so use it surface = prevSurface; } // Get the bottom bin int bottomBin = Ensemble.GetBottomBin(ensemble, surface); // Check if the bottom bin is at or beyond // the number of bins if (bottomBin < 0 || bottomBin >= ensemble.EnsembleData.NumBins) { return(true); } // Set all the velocities bad // for the bins below the bottom. // This will also set the Good Pings bad for (int bin = bottomBin; bin < ensemble.EnsembleData.NumBins; bin++) { // Set the velocities bad EnsembleHelper.SetVelocitiesBad(ref ensemble, bin); // Set the Correlation bad EnsembleHelper.SetCorelationBad(ref ensemble, bin); // Set the Amplitude bad EnsembleHelper.SetAmplitudeBad(ref ensemble, bin); } return(true); } else { return(false); } } return(false); }
public void Setup() { // Create the ensemble // 4 Beams, 5 Bins ensemble1 = EnsembleHelper.GenerateEnsemble(5, 4, true); ensemble1.EnsembleData.EnsembleNumber = 12; ensemble1.AncillaryData.Heading = 10.2f; ensemble1.AncillaryData.TransducerDepth = 5.5f; }
public void Setup() { // Create the ensemble // 4 Beams, 5 Bins ensemble1 = EnsembleHelper.GenerateEnsemble(5, 4, true); ensemble1.EnsembleData.EnsembleNumber = 12; ensemble1.AncillaryData.Heading = 10.2f; ensemble1.AncillaryData.Pitch = 1.02f; ensemble1.AncillaryData.Roll = 2.123f; }
/// <summary> /// Store the Ship Water Track (Water Mass) to the ensemble. /// Mulitply the final result to -1 to match the sign with Bottom Track. /// </summary> /// <param name="ens">Ensemble to add the data.</param> /// <param name="ship">Ship Water Track data to add to the ensemble.</param> /// <param name="depthLayer">Depth that Water Track was collected.</param> private void StoreShipWt(ref DataSet.Ensemble ens, float[] ship, float depthLayer) { if (!ens.IsShipWaterMassAvail) { // Add the dataset to the ensemble EnsembleHelper.AddWaterMassShip(ref ens); } ens.ShipWaterMassData.VelocityTransverse = (-1) * ship[0]; // Invert the sign to match Bottom Track ens.ShipWaterMassData.VelocityLongitudinal = (-1) * ship[1]; ens.ShipWaterMassData.VelocityNormal = (-1) * ship[2]; ens.InstrumentWaterMassData.WaterMassDepthLayer = depthLayer; }
/// <summary> /// Store the Instrument Water Track (Water Mass) to the ensemble. /// Mulitply the final result to -1 to match the sign with Bottom Track. /// </summary> /// <param name="ens">Ensemble to add the data.</param> /// <param name="instrument">Instrument Water Track data to add to the ensemble.</param> /// <param name="depthLayer">Depth that Water Track was collected.</param> private void StoreInstrumentWt(ref DataSet.Ensemble ens, float[] instrument, float depthLayer) { if (!ens.IsInstrumentWaterMassAvail) { // Add the dataset to the ensemble EnsembleHelper.AddWaterMassInstrument(ref ens); } ens.InstrumentWaterMassData.VelocityX = (-1) * instrument[0]; // Invert the sign to match Bottom Track ens.InstrumentWaterMassData.VelocityY = (-1) * instrument[1]; ens.InstrumentWaterMassData.VelocityZ = (-1) * instrument[2]; ens.InstrumentWaterMassData.WaterMassDepthLayer = depthLayer; }
/// <summary> /// Store the Earth Water Track (Water Mass) to the ensemble. /// Mulitply the final result to -1 to match the sign with Bottom Track. /// </summary> /// <param name="ens">Ensemble to add the data.</param> /// <param name="earth">Earth Water Track data to add to the ensemble.</param> /// <param name="depthLayer">Depth that Water Track was collected.</param> private void StoreEarthWt(ref DataSet.Ensemble ens, float[] earth, float depthLayer) { if (!ens.IsEarthWaterMassAvail) { // Add the dataset to the ensemble EnsembleHelper.AddWaterMassEarth(ref ens); } ens.EarthWaterMassData.VelocityEast = (-1) * earth[0]; // Invert the sign to match Bottom Track ens.EarthWaterMassData.VelocityNorth = (-1) * earth[1]; ens.EarthWaterMassData.VelocityVertical = (-1) * earth[2]; ens.EarthWaterMassData.WaterMassDepthLayer = depthLayer; }
public void TestReplaceBadTransducerDepth() { // Create a new ensemble with 1 beam RTI.DataSet.Ensemble ensemble2 = EnsembleHelper.GenerateEnsemble(5, 1, true); // Change Subsystem ensemble2.EnsembleData.SubsystemConfig.SubSystem.Code = Subsystem.SUB_300KHZ_VERT_PISTON_C; // Set the Transducer Depth ensemble2.AncillaryData.TransducerDepth = 0.0f; // Range Track ensemble2.RangeTrackingData.Range[RTI.DataSet.Ensemble.BEAM_0_INDEX] = 3.123f; // Add Range Tracking bool result = RTI.ScreenData.ReplacePressureVerticalBeam.Replace(ref ensemble2); Assert.AreEqual(3.123f, ensemble2.AncillaryData.TransducerDepth, 0.001); Assert.AreEqual(true, result); }
public void Setup() { // Create the ensemble // 4 Beams, 5 Bins ensemble1 = EnsembleHelper.GenerateEnsemble(5, 4, true); ensemble1.EnsembleData.EnsembleNumber = 12; ensemble1.AncillaryData.Heading = 10.2f; ensemble1.AncillaryData.Pitch = 1.02f; ensemble1.AncillaryData.Roll = 2.123f; float beamVel = 1.00f; float beamVelInc = 0.2f; // Create the Beam Velocity Data // 4 Beams, 5 Bins for (int binNum = 0; binNum < 5; binNum++) { for (int beamNum = 0; beamNum < 4; beamNum++) { ensemble1.BeamVelocityData.BeamVelocityData[binNum, beamNum] = beamVel + beamVelInc; beamVelInc *= 2; } } }