/** * Tests the "Multiply" operation. * * @throws IOException */ @Test public void testMultiply() throws IOException { final GridCoverage2D shortCoverage = EXAMPLES.get(5); final GridCoverage2D floatCoverage = EXAMPLES.get(4); final GridCoverage2D result = doOp("Multiply", shortCoverage, floatCoverage); final RenderedImage image = result.getRenderedImage(); final RenderedImage extrema = ExtremaDescriptor.create(image, null, 1, 1, false, 1, null); double[][] minMax = (double[][]) extrema.getProperty("Extrema"); assertEquals(minMax[0][0], 0.0, DELTA); assertEquals(minMax[1][0], 6.5272192E7, DELTA); }
private void extremaOp(TiffMeta surface, GridCoverage2D gridCoverage2D) { double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; RenderedImage img = gridCoverage2D.getRenderedImage(); RenderedOp extremaOp = ExtremaDescriptor.create(img, null, 10, 10, false, 1, null); double[] allMins = (double[]) extremaOp.getProperty("minimum"); min = Doubles.min(allMins); double[] allMaxs = (double[]) extremaOp.getProperty("maximum"); max = Doubles.max(allMaxs); surface.setMaxVal(max); surface.setMinVal(min); }