Reprojector { void processPart(Iterator<? extends TemporalBin> temporalBins) throws Exception { final int x1 = rasterRegion.x; final int x2 = x1 + rasterRegion.width - 1; final int y1 = rasterRegion.y; final int y2 = y1 + rasterRegion.height - 1; final int gridWidth = planetaryGrid.getNumRows() * 2; final int gridHeight = planetaryGrid.getNumRows(); final List<TemporalBin> binRow = new ArrayList<TemporalBin>(); int yUltimate = -1; while (temporalBins.hasNext()) { TemporalBin temporalBin = temporalBins.next(); long temporalBinIndex = temporalBin.getIndex(); int y = planetaryGrid.getRowIndex(temporalBinIndex); if (y != yUltimate) { if (yUltimate >= y1 && yUltimate <= y2) { processRowsWithoutBins(x1, x2, yGlobalUltimate + 1, yUltimate - 1); processRowWithBins(yUltimate, binRow, gridWidth, gridHeight); yGlobalUltimate = yUltimate; } binRow.clear(); yUltimate = y; } binRow.add(temporalBin); } if (yUltimate >= y1 && yUltimate <= y2) { processRowsWithoutBins(x1, x2, yGlobalUltimate + 1, yUltimate - 1); processRowWithBins(yUltimate, binRow, gridWidth, gridHeight); yGlobalUltimate = yUltimate; } } Reprojector(PlanetaryGrid planetaryGrid, TemporalBinRenderer temporalBinRenderer); static void reproject(PlanetaryGrid planetaryGrid,
                                 TemporalBinSource temporalBinSource,
                                 TemporalBinRenderer temporalBinRenderer); static Rectangle computeRasterSubRegion(PlanetaryGrid planetaryGrid, Geometry roiGeometry); static double getRasterPixelSize(PlanetaryGrid planetaryGrid);  }
@Test public void testProcessRowWithBins_CompleteEquator() throws Exception { List<TemporalBin> binRow = Arrays.asList(createTBin(11), createTBin(12), createTBin(13), createTBin(14), createTBin(15), createTBin(16), createTBin(17), createTBin(18), createTBin(19), createTBin(20), createTBin(21), createTBin(22) ); int y = 2; reprojector.processPart(binRow.iterator()); int[] nobsData = raster.nobsData; assertEquals(11, nobsData[y * width + 0]); assertEquals(12, nobsData[y * width + 1]); assertEquals(13, nobsData[y * width + 2]); assertEquals(14, nobsData[y * width + 3]); assertEquals(15, nobsData[y * width + 4]); assertEquals(16, nobsData[y * width + 5]); assertEquals(17, nobsData[y * width + 6]); assertEquals(18, nobsData[y * width + 7]); assertEquals(19, nobsData[y * width + 8]); assertEquals(20, nobsData[y * width + 9]); assertEquals(21, nobsData[y * width + 10]); assertEquals(22, nobsData[y * width + 11]); }
@Test public void testProcessRowWithBins_IncompleteEquator() throws Exception { List<TemporalBin> binRow = Arrays.asList( createTBin(12), createTBin(13), createTBin(16), createTBin(18), createTBin(19), createTBin(20), createTBin(21) ); int y = 2; reprojector.processPart(binRow.iterator()); int[] nobsData = raster.nobsData; assertEquals(NAN, nobsData[y * width + 0]); assertEquals(12, nobsData[y * width + 1]); assertEquals(13, nobsData[y * width + 2]); assertEquals(NAN, nobsData[y * width + 3]); assertEquals(NAN, nobsData[y * width + 4]); assertEquals(16, nobsData[y * width + 5]); assertEquals(NAN, nobsData[y * width + 6]); assertEquals(18, nobsData[y * width + 7]); assertEquals(19, nobsData[y * width + 8]); assertEquals(20, nobsData[y * width + 9]); assertEquals(21, nobsData[y * width + 10]); assertEquals(NAN, nobsData[y * width + 11]); }
@Test public void testProcessRowWithBins_CompletePolar() throws Exception { List<TemporalBin> binRow = Arrays.asList(createTBin(0), createTBin(1), createTBin(2)); int y = 0; reprojector.processPart(binRow.iterator()); int[] nobsData = raster.nobsData; assertEquals(0, nobsData[y * width + 0]); assertEquals(0, nobsData[y * width + 1]); assertEquals(0, nobsData[y * width + 2]); assertEquals(0, nobsData[y * width + 3]); assertEquals(1, nobsData[y * width + 4]); assertEquals(1, nobsData[y * width + 5]); assertEquals(1, nobsData[y * width + 6]); assertEquals(1, nobsData[y * width + 7]); assertEquals(2, nobsData[y * width + 8]); assertEquals(2, nobsData[y * width + 9]); assertEquals(2, nobsData[y * width + 10]); assertEquals(2, nobsData[y * width + 11]); }
@Test public void testProcessRowWithBins_IncompletePolar() throws Exception { List<TemporalBin> binRow = Arrays.asList(createTBin(0), createTBin(2)); int y = 0; reprojector.processPart(binRow.iterator()); int[] nobsData = raster.nobsData; assertEquals(0, nobsData[y * width + 0]); assertEquals(0, nobsData[y * width + 1]); assertEquals(0, nobsData[y * width + 2]); assertEquals(0, nobsData[y * width + 3]); assertEquals(NAN, nobsData[y * width + 4]); assertEquals(NAN, nobsData[y * width + 5]); assertEquals(NAN, nobsData[y * width + 6]); assertEquals(NAN, nobsData[y * width + 7]); assertEquals(2, nobsData[y * width + 8]); assertEquals(2, nobsData[y * width + 9]); assertEquals(2, nobsData[y * width + 10]); assertEquals(2, nobsData[y * width + 11]); }