LatLonToIsinGridMapper { static int computeN_v(double lat) { int N_v = (int) Math.ceil(Math.abs(Math.cos(Math.toRadians(lat))) * N_eq); if( N_v % 2 == 0 ) { return N_v; } else { return ++N_v; } } private  LatLonToIsinGridMapper();   }
@Test public void testComputeN_v() throws Exception { final double cellSizeY = 180.0 / 2004.0; double lat; double isinGridRow = 1002.0; lat = cellSizeY * isinGridRow; assertEquals(2, LatLonToIsinGridMapper.computeN_v(lat)); isinGridRow = 1001.0; lat = cellSizeY * isinGridRow; assertEquals(8, LatLonToIsinGridMapper.computeN_v(lat)); isinGridRow = 1000.0; lat = cellSizeY * isinGridRow; assertEquals(14, LatLonToIsinGridMapper.computeN_v(lat)); isinGridRow = 300.0; lat = cellSizeY * isinGridRow; assertEquals(3574, LatLonToIsinGridMapper.computeN_v(lat)); lat = 0.0; assertEquals(LatLonToIsinGridMapper.N_eq, LatLonToIsinGridMapper.computeN_v(lat)); isinGridRow = -300; lat = cellSizeY * isinGridRow; assertEquals(3574, LatLonToIsinGridMapper.computeN_v(lat)); isinGridRow = -1001.0; lat = cellSizeY * isinGridRow; assertEquals(8, LatLonToIsinGridMapper.computeN_v(lat)); isinGridRow = -1002.0; lat = cellSizeY * isinGridRow; assertEquals(2, LatLonToIsinGridMapper.computeN_v(lat)); }