SEAGrid implements PlanetaryGrid { public static int computeRowCount(double res) { int numRows = 1 + (int) Math.floor(0.5 * (2 * Math.PI * RE) / res); if (numRows % 2 == 0) { return numRows; } else { return numRows + 1; } } SEAGrid();  SEAGrid(int numRows); static int computeRowCount(double res); @Override int getNumRows(); @Override int getNumCols(int row); @Override long getNumBins(); @Override long getFirstBinIndex(int row); @Override double getCenterLat(int row); @Override long getBinIndex(double lat, double lon); @Override int getRowIndex(long binIndex); @Override double[] getCenterLatLon(long binIndex); double getCenterLon(int row, int col); int getColIndex(double lon, int row); int getRowIndex(double lat); static final int DEFAULT_NUM_ROWS; static double RE; }
@Test public void testComputeRowCount() { assertEquals(2160, SEAGrid.computeRowCount(9.28)); assertEquals(2160 * 2, SEAGrid.computeRowCount(9.28 / 2)); assertEquals(2160 / 2, SEAGrid.computeRowCount(9.28 * 2)); assertEquals(66792, SEAGrid.computeRowCount(0.300)); assertEquals(50094, SEAGrid.computeRowCount(0.400)); }