Пример #1
0
 internal static IEnumerable<PgmCellCoords> findCellAndSurroundingNodesCoords(PgmCellCoords pgmCellCoords, double latIncrement, double lonIncrement)
 {
     IEnumerable<double> horizontalNodes = Enumerable.Range(-1, 4)
                                                     .Select(step => pgmCellCoords.Lon + step * lonIncrement);
     IEnumerable<double> verticalNodes = Enumerable.Range(-1, 4)
                                                   .Select(step => pgmCellCoords.Lat + step * latIncrement);
     return verticalNodes.SelectMany(lat => horizontalNodes.Select(lon => normalizeCoords(lat, lon)))
                         .ToList();
 }
 internal void ExtractingValuesFromSimpleSegmentsWorksCorrectly(
     PgmCellCoords coords,
     double latIncrement,
     double lonIncrement,
     IEnumerable<PgmCellCoords> expected)
 {
     var actual = PgmElevationProvider.findCellAndSurroundingNodesCoords(coords, latIncrement, lonIncrement);
     AssertDeep.Equal(actual, expected);
 }
Пример #3
0
 private BivariatePolynomial getInterpolationForCellSurface(PgmCellCoords pgmCellCoords)
 {
     var nodesCoordinates = findCellAndSurroundingNodesCoords(pgmCellCoords,
                                                              dataDescription.LatitudeIncrementDegrees,
                                                              dataDescription.LongitudeIncrementDegrees);
     var nodesUndulations = nodesCoordinates.Select(coor => _discreteSurface.GetUndulation(coor.Lat, coor.Lon));
     var formattedUndulations = nodesUndulations.Select((c, i) => new {Index = i, value = c})
                                                .GroupBy(p => p.Index / 4)
                                                .Select(c => c.Select(v => v.value)
                                                              .ToList())
                                                .ToList();
     return BicubicCalculator.GetSpline(values: formattedUndulations, step: dataDescription.LatitudeIncrementDegrees);
 }
 internal void NormalizationWorksCorrectlyForNormalizedData(PgmCellCoords inputCoords, PgmCellCoords expectedCoords)
 {
     var actual = PgmElevationProvider.normalizeCoords(inputCoords.Lat, inputCoords.Lon);
     AssertDeep.Equal(actual, expectedCoords, config => config.DoublePrecision = 1e-5);
 }