MosaicGrid { int degreeToTileY(double lat) { final double degreePerTile = (double) 180 / numTileY; final int tileY = (int) (Math.floor((lat - 90.0) * -1 / degreePerTile)); return tileY; } MosaicGrid();   MosaicGrid(int macroTileSize, int numTileY, int tileSize, boolean withIntersectionCheck, int maxReducers, int maxMacroTileCountX, String regionWkt); static MosaicGrid create(Configuration conf); void saveToConfiguration(Configuration conf); int getMacroTileSize(); int getTileSize(); double getPixelSize(); int getNumTileX(); int getNumTileY(); int getNumMacroTileX(); int getNumMacroTileY(); Rectangle computeBounds(Geometry roiGeometry); Rectangle alignToTileGrid(Rectangle rectangle); Geometry computeProductGeometry(Product product); TileIndexWritable[] getTileIndices(List<Point> tilePointIndices); Rectangle getTileRectangle(int tileX, int tileY); Rectangle getMacroTileRectangle(int tileX, int tileY); CrsGeoCoding createMacroCRS(Point macroTile); int getPartition(int macroTileX, int macroTileY); int getNumReducers();  }
@Test public void testDegreeToTileY() throws Exception { MosaicGrid mosaicGrid = new MosaicGrid(); assertEquals(0, mosaicGrid.degreeToTileY(90.0), 1e-5); assertEquals(1, mosaicGrid.degreeToTileY(89.0), 1e-5); assertEquals(90, mosaicGrid.degreeToTileY(0.0), 1e-5); assertEquals(180, mosaicGrid.degreeToTileY(-90.0), 1e-5); }