src/AircraftTrajectories/Models/IntegratedNoiseModel/IntegratedNoiseModel.cs
/// <summary>
/// Converts the noise output into a grid of noise values
/// </summary>
/// <param name="noiseData"></param>
/// <returns></returns>
Converts the noise output into a grid of noise values
Converts the noise output into a grid of noise values
protected Grid NoiseDataToGrid(double[][] noiseData, bool calculateContours = true)
        {
            double[][] noiseDataGrid = { };
            double currentX = noiseData[0][0];
            List<double> column = new List<double>();
            int columnIndex = 0;
            for (int i = 0; i < noiseData.Length - 1; i++) {
                if (currentX != noiseData[i][0]) {
                    if (columnIndex == 0) {
                        int numberOfColumns = noiseData.Length / column.Count;
                        noiseDataGrid = new double[numberOfColumns][];
                    }
                    noiseDataGrid[columnIndex] = column.ToArray();
                    column = new List<double>();
                    currentX = noiseData[i][0];
                    columnIndex++;
                }
                column.Add(noiseData[i][3 + NoiseMetric]);
            }
            noiseDataGrid[columnIndex] = column.ToArray();
            Grid grid = new Grid(noiseDataGrid, new Point3D(noiseData[0][0], noiseData[0][1]), CellSize, calculateContours);
            grid.ReferencePoint = ReferencePoint;
            return grid;
        }
protected Grid NoiseDataToGrid ( double [ ] [ ] noiseData , bool calculateContours = true ) { double [ ] [ ] noiseDataGrid = { } ; double currentX = noiseData [ 0 ] [ 0 ] ; List < double > column = new List < double > ( ) ; int columnIndex = 0 ; for ( int i = 0 ; i < noiseData . Length - 1 ; i ++ ) { if ( currentX != noiseData [ i ] [ 0 ] ) { if ( columnIndex == 0 ) { int numberOfColumns = noiseData . Length / column . Count ; noiseDataGrid = new double [ numberOfColumns ] [ ] ; } noiseDataGrid [ columnIndex ] = column . ToArray ( ) ; column = new List < double > ( ) ; currentX = noiseData [ i ] [ 0 ] ; columnIndex ++ ; } column . Add ( noiseData [ i ] [ 3 + NoiseMetric ] ) ; } noiseDataGrid [ columnIndex ] = column . ToArray ( ) ; Grid grid = new Grid ( noiseDataGrid , new Point3D ( noiseData [ 0 ] [ 0 ] , noiseData [ 0 ] [ 1 ] ) , CellSize , calculateContours ) ; grid . ReferencePoint = ReferencePoint ; return grid ; }
Converts the noise output into a grid of noise values
Converts the noise output into a grid of noise values
// Store noise levels in a 2D grid // Check whether we encountered a new column // Check whether this was the first column // Now the total number of columns of the grid is known // Add the column to the grid
None
noiseData
double[][]
None
calculateContours
bool