/// <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);
            }
Exemple #2
0
            /// <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);
            }