MosaicGrid { int degreeToTileX(double lon) { final double degreePerTile = (double) 360 / numTileX; final int tileX = (int) (Math.floor(lon + 180.0) / degreePerTile); return tileX; } 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 testDegreeToTileX() throws Exception { MosaicGrid mosaicGrid = new MosaicGrid(); assertEquals(0, mosaicGrid.degreeToTileX(-180.0)); assertEquals(1, mosaicGrid.degreeToTileX(-179.0)); assertEquals(180, mosaicGrid.degreeToTileX(0.0)); assertEquals(360, mosaicGrid.degreeToTileX(180.0)); }