/** * Determines the angular discontinuity of the given tie point values. * * @return the angular discontinuity, will always be either {@link #DISCONT_AT_180} or * {@link #DISCONT_AT_360} */ public static int getDiscontinuity(float[] tiePoints) { final Range range = Range.computeRangeFloat(tiePoints, IndexValidator.TRUE, null, ProgressMonitor.NULL); if (range.getMax() > 180.0) { return DISCONT_AT_360; } else { return DISCONT_AT_180; } }
private GeoCoding createStripeGeocode(float[] lats, float[] lons, int y, int stripeW, int stripeH) throws IOException { final Range range = Range.computeRangeFloat(lats, IndexValidator.TRUE, null, ProgressMonitor.NULL); if (range.getMin() < -90) { return null; } else { final BowtiePixelScanGeoCoding geoCoding = new BowtiePixelScanGeoCoding(lats, lons, stripeW, stripeH); _cross180 = _cross180 || geoCoding.isCrossingMeridianAt180(); return geoCoding; } }
private GeoCoding createStripeGeocode(float[] lats, float[] lons, int y, int stripeW, int stripeH, float offsetX, float offsetY, float subSamplingX, float subSamplingY) throws IOException { final Range range = Range.computeRangeFloat(lats, IndexValidator.TRUE, null, ProgressMonitor.NULL); if (range.getMin() < -90) { return null; } else { final ModisTiePointGrid latGrid = new ModisTiePointGrid("lat" + y, stripeW, stripeH, offsetX, offsetY, subSamplingX, subSamplingY, lats); final ModisTiePointGrid lonGrid = new ModisTiePointGrid("lon" + y, stripeW, stripeH, offsetX, offsetY, subSamplingX, subSamplingY, lons, TiePointGrid.DISCONT_AT_180); final TiePointGeoCoding geoCoding = new TiePointGeoCoding(latGrid, lonGrid, getDatum()); _cross180 = _cross180 || geoCoding.isCrossingMeridianAt180(); return geoCoding; } }
System.arraycopy(latFloats, y * stripeW, lats, 0, stripeW * stripeH); final Range range = Range.computeRangeFloat(lats, IndexValidator.TRUE, null, ProgressMonitor.NULL); if (range.getMin() < -90) { gcList.add(null);
result = computeRangeFloat((float[]) values, validator, range, pm); } else if (values instanceof double[]) { result = computeRangeDouble((double[]) values, validator, range, pm);
public void testComputeRangeFloat() { float[] floats = new float[]{2, -3, 4, 5, -6, 7, 8, 9}; Range range = new Range(); Range.computeRangeFloat(floats, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(-6, range.getMin(), 1e-10d); assertEquals(9, range.getMax(), 1e-10d); Range.computeRangeFloat(floats, _validator, range, ProgressMonitor.NULL); assertEquals(-6, range.getMin(), 1e-10d); assertEquals(7, range.getMax(), 1e-10d); }