FirePixelMapper extends Mapper<NullWritable, NullWritable, LongWritable, RasterStackWritable> { static long getBinIndex(Product classificationProduct, Rectangle rectangle, int numRowsGlobal) { GeoPos geoPos = new GeoPos(); classificationProduct.getSceneGeoCoding().getGeoPos(new PixelPos(rectangle.x, rectangle.y), geoPos); CrsGrid crsGrid = new CrsGrid(numRowsGlobal, "EPSG:4326"); return crsGrid.getBinIndex(geoPos.lat, geoPos.lon); }  @Override void run(Context context);  }
@Test public void testGetBinIndex() { assertEquals(4665668400L, FirePixelMapper.getBinIndex(product, new Rectangle(0, 0, 1, 1), 64800)); assertEquals(4665668400L + 2 * 129600 + 2, FirePixelMapper.getBinIndex(product, new Rectangle(2, 2, 1, 1), 64800)); assertEquals(4665668400L + 3599 * 129600 + 3599, FirePixelMapper.getBinIndex(product, new Rectangle(3599, 3599, 1, 1), 64800)); }