Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        /// <param name="ensemble">RTI ensemble.</param>
        /// <param name="xform">Coordinate transform.</param>
        public PD0(DataSet.Ensemble ensemble, CoordinateTransforms xform)
        {
            // Create the header
            // All PD0 Ensembles have a header
            Header = new Pd0Header();

            // All PD0 ensembles have a Fixed Leader
            AddDataType(new Pd0FixedLeader());

            // All PD0 ensembles have a Variable Leader
            AddDataType(new Pd0VariableLeader());

            // Set the ensemble based off the RTI ensemble given
            DecodeRtiEnsemble(ensemble, xform);
        }
Ejemplo n.º 2
0
        public CoordinateTransformsTest()
        {
            _windowResolution = new Vector2(960.0f, 540.0f);
            var window = Substitute.For <IWindow>();

            window.Width.Returns((uint)_windowResolution.X);
            window.Height.Returns((uint)_windowResolution.Y);
            var components = Substitute.For <ISystemComponents>();

            components.Window.Returns(window);
            var messenger         = Substitute.For <IFrameworkMessenger>();
            var cameraFactory     = new CameraFactory(components);
            var idGenerator       = new IdGenerator(messenger);
            var collectionFactory = new SimpleDictionaryCollectionFactory(messenger);
            var cameraManager     = new CameraManager(cameraFactory, idGenerator, collectionFactory);
            var viewportFactory   = new ViewportFactory();

            _viewportManager = new ViewportManager(viewportFactory, idGenerator, collectionFactory);
            _transforms      = new CoordinateTransforms(components, cameraManager, _viewportManager);
            _cameras         = new Cameras(cameraManager);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Decode the RTI Ensemble to a PD0 ensemble.
        /// </summary>
        /// <param name="ensemble">RTI Ensemble.</param>
        /// <param name="xform">Coordinate Transform to use.</param>
        public void DecodeRtiEnsemble(DataSet.Ensemble ensemble, CoordinateTransforms xform)
        {
            // Add Fixed Leader and Variable Leader
            FixedLeader.DecodeRtiEnsemble(ensemble.EnsembleData, ensemble.AncillaryData, ensemble.SystemSetupData, xform);
            VariableLeader.DecodeRtiEnsemble(ensemble.EnsembleData, ensemble.AncillaryData);

            // Correlation
            if (ensemble.IsCorrelationAvail)
            {
                float numCodeRepeats = 1.0f;
                if (ensemble.IsSystemSetupAvail)
                {
                    numCodeRepeats = ensemble.SystemSetupData.WpRepeatN;
                }

                this.AddDataType(new Pd0Correlation(ensemble.CorrelationData, numCodeRepeats));
            }

            // Amplitude
            if (ensemble.IsAmplitudeAvail)
            {
                this.AddDataType(new Pd0EchoIntensity(ensemble.AmplitudeData));
            }

            // Bottom Track
            if (ensemble.IsBottomTrackAvail)
            {
                this.AddDataType(new Pd0BottomTrack(ensemble.BottomTrackData, xform));

                // Add Water Track data
                switch (xform)
                {
                case RTI.PD0.CoordinateTransforms.Coord_Earth:
                    ensemble.EarthWaterMassData    = new DataSet.EarthWaterMassDataSet();
                    ensemble.IsEarthWaterMassAvail = true;
                    ensemble.EarthWaterMassData.WaterMassDepthLayer = ((this.BottomTrack.BtRefLayerNear + this.BottomTrack.BtRefLayerFar) / 2.0f) / 10.0f;      // Divide by 10 to convert DM to M

                    // Set velocities and check for bad velocities
                    if (this.BottomTrack.BtRefLayerVelocityBeam0 == PD0.BAD_VELOCITY)
                    {
                        ensemble.EarthWaterMassData.VelocityEast = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.EarthWaterMassData.VelocityEast = this.BottomTrack.BtRefLayerVelocityBeam0;
                    }

                    if (this.BottomTrack.BtRefLayerVelocityBeam1 == PD0.BAD_VELOCITY)
                    {
                        ensemble.EarthWaterMassData.VelocityNorth = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.EarthWaterMassData.VelocityNorth = this.BottomTrack.BtRefLayerVelocityBeam1;
                    }

                    if (this.BottomTrack.BtRefLayerVelocityBeam2 == PD0.BAD_VELOCITY)
                    {
                        ensemble.EarthWaterMassData.VelocityVertical = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.EarthWaterMassData.VelocityVertical = this.BottomTrack.BtRefLayerVelocityBeam2;
                    }
                    break;

                case RTI.PD0.CoordinateTransforms.Coord_Instrument:
                case RTI.PD0.CoordinateTransforms.Coord_Ship:
                case RTI.PD0.CoordinateTransforms.Coord_Beam:
                    ensemble.InstrumentWaterMassData    = new DataSet.InstrumentWaterMassDataSet();
                    ensemble.IsInstrumentWaterMassAvail = true;
                    ensemble.InstrumentWaterMassData.WaterMassDepthLayer = ((this.BottomTrack.BtRefLayerNear + this.BottomTrack.BtRefLayerFar) / 2.0f) / 10.0f;      // Divide by 10 to convert DM to M

                    // Set velocities and check for bad velocities
                    if (this.BottomTrack.BtRefLayerVelocityBeam0 == PD0.BAD_VELOCITY)
                    {
                        ensemble.InstrumentWaterMassData.VelocityX = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.InstrumentWaterMassData.VelocityX = this.BottomTrack.BtRefLayerVelocityBeam0;
                    }

                    if (this.BottomTrack.BtRefLayerVelocityBeam1 == PD0.BAD_VELOCITY)
                    {
                        ensemble.InstrumentWaterMassData.VelocityY = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.InstrumentWaterMassData.VelocityY = this.BottomTrack.BtRefLayerVelocityBeam1;
                    }

                    if (this.BottomTrack.BtRefLayerVelocityBeam2 == PD0.BAD_VELOCITY)
                    {
                        ensemble.InstrumentWaterMassData.VelocityZ = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.InstrumentWaterMassData.VelocityZ = this.BottomTrack.BtRefLayerVelocityBeam2;
                    }

                    if (this.BottomTrack.BtRefLayerVelocityBeam3 == PD0.BAD_VELOCITY)
                    {
                        ensemble.InstrumentWaterMassData.VelocityQ = BAD_VELOCITY;
                    }
                    else
                    {
                        ensemble.InstrumentWaterMassData.VelocityQ = this.BottomTrack.BtRefLayerVelocityBeam3;
                    }
                    break;

                default:
                    break;
                }
            }

            // Velocity
            switch (xform)
            {
            case CoordinateTransforms.Coord_Beam:
                if (ensemble.IsBeamVelocityAvail)
                {
                    this.AddDataType(new Pd0Velocity(ensemble.BeamVelocityData));

                    // Percent Good
                    if (ensemble.IsGoodBeamAvail)
                    {
                        this.AddDataType(new Pd0PercentGood(ensemble.GoodBeamData, ensemble.EnsembleData.ActualPingCount));
                    }
                }
                break;

            case CoordinateTransforms.Coord_Earth:
                if (ensemble.IsEarthVelocityAvail)
                {
                    this.AddDataType(new Pd0Velocity(ensemble.EarthVelocityData));

                    // Percent Good
                    if (ensemble.IsGoodEarthAvail)
                    {
                        this.AddDataType(new Pd0PercentGood(ensemble.GoodEarthData, ensemble.EnsembleData.ActualPingCount));
                    }
                }
                break;

            case CoordinateTransforms.Coord_Instrument:
                if (ensemble.IsInstrumentVelocityAvail)
                {
                    this.AddDataType(new Pd0Velocity(ensemble.InstrumentVelocityData));

                    // Percent Good
                    if (ensemble.IsGoodBeamAvail)
                    {
                        this.AddDataType(new Pd0PercentGood(ensemble.GoodBeamData, ensemble.EnsembleData.ActualPingCount));
                    }
                }
                break;

            default:
                break;
            }

            if (ensemble.IsNmeaAvail)
            {
                this.AddDataType(new Pd0NmeaData(ensemble.NmeaData));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Decode the RTI Ensemble to a PD0 ensemble.
        /// </summary>
        /// <param name="ensemble">RTI Ensemble.</param>
        /// <param name="xform">Coordinate Transform to use.</param>
        public void DecodeRtiEnsemble(DataSet.Ensemble ensemble, CoordinateTransforms xform)
        {
            // Add Fixed Leader and Variable Leader
            FixedLeader.DecodeRtiEnsemble(ensemble.EnsembleData, ensemble.AncillaryData, ensemble.SystemSetupData, xform);
            VariableLeader.DecodeRtiEnsemble(ensemble.EnsembleData, ensemble.AncillaryData);

            // Correlation
            if (ensemble.IsCorrelationAvail)
            {
                float numCodeRepeats = 1.0f;
                if (ensemble.IsSystemSetupAvail)
                {
                    numCodeRepeats = ensemble.SystemSetupData.WpRepeatN;
                }

                this.AddDataType(new Pd0Correlation(ensemble.CorrelationData, numCodeRepeats));
            }

            // Amplitude
            if (ensemble.IsAmplitudeAvail)
            {
                this.AddDataType(new Pd0EchoIntensity(ensemble.AmplitudeData));
            }

            // Bottom Track
            if (ensemble.IsBottomTrackAvail)
            {
                this.AddDataType(new Pd0BottomTrack(ensemble.BottomTrackData, xform));

                // Add Water Track data
                switch (xform)
                {
                case RTI.PD0.CoordinateTransforms.Coord_Earth:
                    if (ensemble.IsEarthWaterMassAvail)
                    {
                        // Set velocities and check for bad velocities
                        if (ensemble.EarthWaterMassData.VelocityEast == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam0 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam0 = (short)(ensemble.EarthWaterMassData.VelocityEast * 1000.0f);
                        }

                        if (ensemble.EarthWaterMassData.VelocityNorth == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam1 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam1 = (short)(ensemble.EarthWaterMassData.VelocityNorth * 1000.0f);
                        }

                        if (ensemble.EarthWaterMassData.VelocityVertical == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam2 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam2 = (short)(ensemble.EarthWaterMassData.VelocityVertical * 1000.0f);
                        }

                        if (ensemble.EarthWaterMassData.VelocityQ == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam3 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam3 = (short)(ensemble.EarthWaterMassData.VelocityQ * 1000.0f);
                        }

                        this.BottomTrack.BtRefLayerFar                = ensemble.EarthWaterMassData.BtRefLayerFar;
                        this.BottomTrack.BtRefLayerMin                = ensemble.EarthWaterMassData.BtRefLayerMin;
                        this.BottomTrack.BtRefLayerNear               = ensemble.EarthWaterMassData.BtRefLayerNear;
                        this.BottomTrack.BtRefLayerCorrBeam0          = ensemble.EarthWaterMassData.BtRefLayerCorrBeam0;
                        this.BottomTrack.BtRefLayerCorrBeam1          = ensemble.EarthWaterMassData.BtRefLayerCorrBeam1;
                        this.BottomTrack.BtRefLayerCorrBeam2          = ensemble.EarthWaterMassData.BtRefLayerCorrBeam2;
                        this.BottomTrack.BtRefLayerCorrBeam3          = ensemble.EarthWaterMassData.BtRefLayerCorrBeam3;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam0 = ensemble.EarthWaterMassData.BtRefLayerEchoIntensityBeam0;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam1 = ensemble.EarthWaterMassData.BtRefLayerEchoIntensityBeam1;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam2 = ensemble.EarthWaterMassData.BtRefLayerEchoIntensityBeam2;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam3 = ensemble.EarthWaterMassData.BtRefLayerEchoIntensityBeam3;
                        this.BottomTrack.BtRefLayerPercentGoodBeam0   = ensemble.EarthWaterMassData.BtRefLayerPercentGoodBeam0;
                        this.BottomTrack.BtRefLayerPercentGoodBeam1   = ensemble.EarthWaterMassData.BtRefLayerPercentGoodBeam1;
                        this.BottomTrack.BtRefLayerPercentGoodBeam2   = ensemble.EarthWaterMassData.BtRefLayerPercentGoodBeam2;
                        this.BottomTrack.BtRefLayerPercentGoodBeam3   = ensemble.EarthWaterMassData.BtRefLayerPercentGoodBeam3;
                    }
                    break;

                case RTI.PD0.CoordinateTransforms.Coord_Ship:
                    if (ensemble.IsShipWaterMassAvail)
                    {
                        // Set velocities and check for bad velocities
                        if (ensemble.ShipWaterMassData.VelocityTransverse == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam0 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam0 = (short)(ensemble.ShipWaterMassData.VelocityTransverse * 1000.0f);
                        }

                        if (ensemble.ShipWaterMassData.VelocityLongitudinal == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam1 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam1 = (short)(ensemble.ShipWaterMassData.VelocityLongitudinal * 1000.0f);
                        }

                        if (ensemble.ShipWaterMassData.VelocityNormal == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam2 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam2 = (short)(ensemble.ShipWaterMassData.VelocityNormal * 1000.0f);
                        }

                        if (ensemble.ShipWaterMassData.VelocityQ == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam3 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam3 = (short)(ensemble.ShipWaterMassData.VelocityQ * 1000.0f);
                        }

                        this.BottomTrack.BtRefLayerFar                = ensemble.ShipWaterMassData.BtRefLayerFar;
                        this.BottomTrack.BtRefLayerMin                = ensemble.ShipWaterMassData.BtRefLayerMin;
                        this.BottomTrack.BtRefLayerNear               = ensemble.ShipWaterMassData.BtRefLayerNear;
                        this.BottomTrack.BtRefLayerCorrBeam0          = ensemble.ShipWaterMassData.BtRefLayerCorrBeam0;
                        this.BottomTrack.BtRefLayerCorrBeam1          = ensemble.ShipWaterMassData.BtRefLayerCorrBeam1;
                        this.BottomTrack.BtRefLayerCorrBeam2          = ensemble.ShipWaterMassData.BtRefLayerCorrBeam2;
                        this.BottomTrack.BtRefLayerCorrBeam3          = ensemble.ShipWaterMassData.BtRefLayerCorrBeam3;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam0 = ensemble.ShipWaterMassData.BtRefLayerEchoIntensityBeam0;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam1 = ensemble.ShipWaterMassData.BtRefLayerEchoIntensityBeam1;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam2 = ensemble.ShipWaterMassData.BtRefLayerEchoIntensityBeam2;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam3 = ensemble.ShipWaterMassData.BtRefLayerEchoIntensityBeam3;
                        this.BottomTrack.BtRefLayerPercentGoodBeam0   = ensemble.ShipWaterMassData.BtRefLayerPercentGoodBeam0;
                        this.BottomTrack.BtRefLayerPercentGoodBeam1   = ensemble.ShipWaterMassData.BtRefLayerPercentGoodBeam1;
                        this.BottomTrack.BtRefLayerPercentGoodBeam2   = ensemble.ShipWaterMassData.BtRefLayerPercentGoodBeam2;
                        this.BottomTrack.BtRefLayerPercentGoodBeam3   = ensemble.ShipWaterMassData.BtRefLayerPercentGoodBeam3;
                    }
                    break;

                case RTI.PD0.CoordinateTransforms.Coord_Instrument:
                case RTI.PD0.CoordinateTransforms.Coord_Beam:
                    if (ensemble.IsShipWaterMassAvail)
                    {
                        // Set velocities and check for bad velocities
                        if (ensemble.InstrumentWaterMassData.VelocityX == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam0 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam0 = (short)(ensemble.InstrumentWaterMassData.VelocityX * 1000.0f);
                        }

                        if (ensemble.InstrumentWaterMassData.VelocityY == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam1 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam1 = (short)(ensemble.InstrumentWaterMassData.VelocityY * 1000.0f);
                        }

                        if (ensemble.InstrumentWaterMassData.VelocityZ == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam2 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam2 = (short)(ensemble.InstrumentWaterMassData.VelocityZ * 1000.0f);
                        }

                        if (ensemble.InstrumentWaterMassData.VelocityQ == DataSet.Ensemble.BAD_VELOCITY)
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam3 = PD0.BAD_VELOCITY;
                        }
                        else
                        {
                            this.BottomTrack.BtRefLayerVelocityBeam3 = (short)(ensemble.InstrumentWaterMassData.VelocityQ * 1000.0f);
                        }

                        this.BottomTrack.BtRefLayerFar                = ensemble.InstrumentWaterMassData.BtRefLayerFar;
                        this.BottomTrack.BtRefLayerMin                = ensemble.InstrumentWaterMassData.BtRefLayerMin;
                        this.BottomTrack.BtRefLayerNear               = ensemble.InstrumentWaterMassData.BtRefLayerNear;
                        this.BottomTrack.BtRefLayerCorrBeam0          = ensemble.InstrumentWaterMassData.BtRefLayerCorrBeam0;
                        this.BottomTrack.BtRefLayerCorrBeam1          = ensemble.InstrumentWaterMassData.BtRefLayerCorrBeam1;
                        this.BottomTrack.BtRefLayerCorrBeam2          = ensemble.InstrumentWaterMassData.BtRefLayerCorrBeam2;
                        this.BottomTrack.BtRefLayerCorrBeam3          = ensemble.InstrumentWaterMassData.BtRefLayerCorrBeam3;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam0 = ensemble.InstrumentWaterMassData.BtRefLayerEchoIntensityBeam0;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam1 = ensemble.InstrumentWaterMassData.BtRefLayerEchoIntensityBeam1;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam2 = ensemble.InstrumentWaterMassData.BtRefLayerEchoIntensityBeam2;
                        this.BottomTrack.BtRefLayerEchoIntensityBeam3 = ensemble.InstrumentWaterMassData.BtRefLayerEchoIntensityBeam3;
                        this.BottomTrack.BtRefLayerPercentGoodBeam0   = ensemble.InstrumentWaterMassData.BtRefLayerPercentGoodBeam0;
                        this.BottomTrack.BtRefLayerPercentGoodBeam1   = ensemble.InstrumentWaterMassData.BtRefLayerPercentGoodBeam1;
                        this.BottomTrack.BtRefLayerPercentGoodBeam2   = ensemble.InstrumentWaterMassData.BtRefLayerPercentGoodBeam2;
                        this.BottomTrack.BtRefLayerPercentGoodBeam3   = ensemble.InstrumentWaterMassData.BtRefLayerPercentGoodBeam3;
                    }
                    break;

                default:
                    break;
                }
            }

            // Velocity
            switch (xform)
            {
            case CoordinateTransforms.Coord_Beam:
                if (ensemble.IsBeamVelocityAvail)
                {
                    this.AddDataType(new Pd0Velocity(ensemble.BeamVelocityData));

                    // Percent Good
                    if (ensemble.IsGoodBeamAvail)
                    {
                        this.AddDataType(new Pd0PercentGood(ensemble.GoodBeamData, ensemble.EnsembleData.ActualPingCount));
                    }
                }
                break;

            case CoordinateTransforms.Coord_Earth:
                if (ensemble.IsEarthVelocityAvail)
                {
                    this.AddDataType(new Pd0Velocity(ensemble.EarthVelocityData));

                    // Percent Good
                    if (ensemble.IsGoodEarthAvail)
                    {
                        this.AddDataType(new Pd0PercentGood(ensemble.GoodEarthData, ensemble.EnsembleData.ActualPingCount));
                    }
                }
                break;

            case CoordinateTransforms.Coord_Instrument:
                if (ensemble.IsInstrumentVelocityAvail)
                {
                    this.AddDataType(new Pd0Velocity(ensemble.InstrumentVelocityData));

                    // Percent Good
                    if (ensemble.IsGoodBeamAvail)
                    {
                        this.AddDataType(new Pd0PercentGood(ensemble.GoodBeamData, ensemble.EnsembleData.ActualPingCount));
                    }
                }
                break;

            default:
                break;
            }

            if (ensemble.IsNmeaAvail)
            {
                this.AddDataType(new Pd0NmeaData(ensemble.NmeaData));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Decode the RTI Ensemble to a PD0 ensemble.
        /// </summary>
        /// <param name="ensemble">RTI Ensemble.</param>
        /// <param name="xform">Coordinate Transform to use.</param>
        public void DecodeRtiEnsemble(DataSet.Ensemble ensemble, CoordinateTransforms xform)
        {
            // Add Fixed Leader and Variable Leader
            FixedLeader.DecodeRtiEnsemble(ensemble.EnsembleData, ensemble.AncillaryData, ensemble.SystemSetupData, xform);
            VariableLeader.DecodeRtiEnsemble(ensemble.EnsembleData, ensemble.AncillaryData);

            // Correlation
            if (ensemble.IsCorrelationAvail)
            {
                float numCodeRepeats = 1.0f;
                if (ensemble.IsSystemSetupAvail)
                {
                    numCodeRepeats = ensemble.SystemSetupData.WpRepeatN;
                }

                this.AddDataType(new Pd0Correlation(ensemble.CorrelationData, numCodeRepeats));
            }

            // Amplitude
            if (ensemble.IsAmplitudeAvail)
            {
                this.AddDataType(new Pd0EchoIntensity(ensemble.AmplitudeData));
            }

            // Bottom Track
            if (ensemble.IsBottomTrackAvail)
            {
                this.AddDataType(new Pd0BottomTrack(ensemble.BottomTrackData, xform));

                // Add Water Track data
                switch (xform)
                {
                    case RTI.PD0.CoordinateTransforms.Coord_Earth:
                        ensemble.EarthWaterMassData = new DataSet.EarthWaterMassDataSet();
                        ensemble.IsEarthWaterMassAvail = true;
                        ensemble.EarthWaterMassData.WaterMassDepthLayer = ((this.BottomTrack.BtRefLayerNear + this.BottomTrack.BtRefLayerFar) / 2.0f) / 10.0f;  // Divide by 10 to convert DM to M

                        // Set velocities and check for bad velocities
                        if (this.BottomTrack.BtRefLayerVelocityBeam0 == PD0.BAD_VELOCITY)
                        {
                            ensemble.EarthWaterMassData.VelocityEast = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.EarthWaterMassData.VelocityEast = this.BottomTrack.BtRefLayerVelocityBeam0;
                        }

                        if (this.BottomTrack.BtRefLayerVelocityBeam1 == PD0.BAD_VELOCITY)
                        {
                            ensemble.EarthWaterMassData.VelocityNorth = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.EarthWaterMassData.VelocityNorth = this.BottomTrack.BtRefLayerVelocityBeam1;
                        }

                        if (this.BottomTrack.BtRefLayerVelocityBeam2 == PD0.BAD_VELOCITY)
                        {
                            ensemble.EarthWaterMassData.VelocityVertical = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.EarthWaterMassData.VelocityVertical = this.BottomTrack.BtRefLayerVelocityBeam2;
                        }
                        break;
                    case RTI.PD0.CoordinateTransforms.Coord_Instrument:
                    case RTI.PD0.CoordinateTransforms.Coord_Ship:
                    case RTI.PD0.CoordinateTransforms.Coord_Beam:
                        ensemble.InstrumentWaterMassData = new DataSet.InstrumentWaterMassDataSet();
                        ensemble.IsInstrumentWaterMassAvail = true;
                        ensemble.InstrumentWaterMassData.WaterMassDepthLayer = ((this.BottomTrack.BtRefLayerNear + this.BottomTrack.BtRefLayerFar) / 2.0f) / 10.0f;  // Divide by 10 to convert DM to M

                        // Set velocities and check for bad velocities
                        if (this.BottomTrack.BtRefLayerVelocityBeam0 == PD0.BAD_VELOCITY)
                        {
                            ensemble.InstrumentWaterMassData.VelocityX = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.InstrumentWaterMassData.VelocityX = this.BottomTrack.BtRefLayerVelocityBeam0;
                        }

                        if (this.BottomTrack.BtRefLayerVelocityBeam1 == PD0.BAD_VELOCITY)
                        {
                            ensemble.InstrumentWaterMassData.VelocityY = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.InstrumentWaterMassData.VelocityY = this.BottomTrack.BtRefLayerVelocityBeam1;
                        }

                        if (this.BottomTrack.BtRefLayerVelocityBeam2 == PD0.BAD_VELOCITY)
                        {
                            ensemble.InstrumentWaterMassData.VelocityZ = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.InstrumentWaterMassData.VelocityZ = this.BottomTrack.BtRefLayerVelocityBeam2;
                        }

                        if (this.BottomTrack.BtRefLayerVelocityBeam3 == PD0.BAD_VELOCITY)
                        {
                            ensemble.InstrumentWaterMassData.VelocityQ = BAD_VELOCITY;
                        }
                        else
                        {
                            ensemble.InstrumentWaterMassData.VelocityQ = this.BottomTrack.BtRefLayerVelocityBeam3;
                        }
                        break;
                    default:
                        break;
                }
            }

            // Velocity
            switch(xform)
            {
                case CoordinateTransforms.Coord_Beam:
                    if (ensemble.IsBeamVelocityAvail)
                    {
                        this.AddDataType(new Pd0Velocity(ensemble.BeamVelocityData));

                        // Percent Good
                        if (ensemble.IsGoodBeamAvail)
                        {
                            this.AddDataType(new Pd0PercentGood(ensemble.GoodBeamData, ensemble.EnsembleData.ActualPingCount));
                        }
                    }
                    break;
                case CoordinateTransforms.Coord_Earth:
                    if (ensemble.IsEarthVelocityAvail)
                    {
                        this.AddDataType(new Pd0Velocity(ensemble.EarthVelocityData));

                        // Percent Good
                        if (ensemble.IsGoodEarthAvail)
                        {
                            this.AddDataType(new Pd0PercentGood(ensemble.GoodEarthData, ensemble.EnsembleData.ActualPingCount));
                        }
                    }
                    break;
                case CoordinateTransforms.Coord_Instrument:
                    if (ensemble.IsInstrumentVelocityAvail)
                    {
                        this.AddDataType(new Pd0Velocity(ensemble.InstrumentVelocityData));

                        // Percent Good
                        if (ensemble.IsGoodBeamAvail)
                        {
                            this.AddDataType(new Pd0PercentGood(ensemble.GoodBeamData, ensemble.EnsembleData.ActualPingCount));
                        }
                    }
                    break;
                default:
                    break;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        /// <param name="ensemble">RTI ensemble.</param>
        /// <param name="xform">Coordinate transform.</param>
        public PD0(DataSet.Ensemble ensemble, CoordinateTransforms xform)
        {
            // Create the header
            // All PD0 Ensembles have a header
            Header = new Pd0Header();

            // All PD0 ensembles have a Fixed Leader
            AddDataType(new Pd0FixedLeader());

            // All PD0 ensembles have a Variable Leader
            AddDataType(new Pd0VariableLeader());

            // Set the ensemble based off the RTI ensemble given
            DecodeRtiEnsemble(ensemble, xform);
        }