final double average; if (computeAverages) { average = Math.rint(grid.getCellMean(dim) / scale); averages[dim] = average * scale; } else {
nx = Math.toIntExact(Math.round((xf - x0) / Δx + 1)); ny = Math.toIntExact(Math.round((yf - y0) / Δy + 1)); grid = new DatumShiftGridFile.Float<>(3, Units.DEGREE, Units.METRE, false, x0, y0, Δx, Δy, nx, ny, PARAMETERS, file);
nx = JDK8.toIntExact(Math.round((xf - x0) / Δx + 1)); ny = JDK8.toIntExact(Math.round((yf - y0) / Δy + 1)); grid = new DatumShiftGridFile.Float<>(3, Units.DEGREE, Units.METRE, false, x0, y0, Δx, Δy, nx, ny, PARAMETERS, file);
final DatumShiftGridFile.Float<Angle,Angle> grid = new DatumShiftGridFile.Float<>(2, unit, unit, true, -xmin, ymin, -dx, dy, width, height, PARAMETERS, file); @SuppressWarnings("MismatchedReadAndWriteOfArray") final float[] tx = grid.offsets[0];
dim = 1; // Dimension of latitudes. grid = new DatumShiftGridFile.Float<>(2, Units.DEGREE, Units.DEGREE, true, x0, y0, Δx, Δy, nx, ny, PARAMETERS, file, longitudeShifts); grid.accuracy = SECOND_PRECISION / DEGREES_TO_SECONDS;
dim = 1; // Dimension of latitudes. grid = new DatumShiftGridFile.Float<>(2, Units.DEGREE, Units.DEGREE, true, x0, y0, Δx, Δy, nx, ny, PARAMETERS, file, longitudeShifts); grid.accuracy = SECOND_PRECISION / DEGREES_TO_SECONDS;
final DatumShiftGridFile.Float<Angle,Angle> grid = new DatumShiftGridFile.Float<>(2, unit, unit, true, -xmin, ymin, -dx, dy, width, height, PARAMETERS, file); @SuppressWarnings("MismatchedReadAndWriteOfArray") final float[] tx = grid.offsets[0];
final double average; if (computeAverages) { average = Math.rint(grid.getCellMean(dim) / scale); averages[dim] = average * scale; } else {
/** * Tests a small grid file with interpolations in geocentric coordinates as {@code float} values. * * <p>This method is part of a chain. * The next method is {@link #testGridAsShorts(DatumShiftGridFile)}.</p> * * @return the loaded grid with values as {@code float}. * @throws URISyntaxException if the URL to the test file can not be converted to a path. * @throws IOException if an error occurred while loading the grid. * @throws FactoryException if an error occurred while computing the grid. * @throws TransformException if an error occurred while computing the envelope. */ @TestStep private static DatumShiftGridFile<Angle,Length> testGridAsFloats() throws URISyntaxException, IOException, FactoryException, TransformException { final Path file = getResource(TEST_FILE); final DatumShiftGridFile.Float<Angle,Length> grid; try (BufferedReader in = Files.newBufferedReader(file)) { grid = FranceGeocentricInterpolation.load(in, file); } assertEquals("cellPrecision", 0.005, grid.getCellPrecision(), STRICT); assertEquals("getCellMean", 168.2587, grid.getCellMean(0), 0.0001); assertEquals("getCellMean", 58.7163, grid.getCellMean(1), 0.0001); assertEquals("getCellMean", -320.1801, grid.getCellMean(2), 0.0001); verifyGrid(grid); return grid; }
/** * Returns a new grid with the same geometry than this grid but different data arrays. */ @Override protected final DatumShiftGridFile<C,T> setData(final Object[] other) { return new Float<>(this, (float[][]) other); }
/** * Returns a new grid with the same geometry than this grid but different data arrays. */ @Override protected final DatumShiftGridFile<C,T> setData(final Object[] other) { return new Float<>(this, (float[][]) other); }