protected Observation createObservation(int x, int y) { final SamplePointer pointer = getPointer(); final Point2D.Float superSamplingPoint = pointer.getSuperSamplingPoint(); final PixelPos pixelPos = new PixelPos(x + superSamplingPoint.x, y + superSamplingPoint.y); final GeoPos geoPos = getGeoPos(pixelPos); if (!acceptGeoPos(geoPos)) { return null; } double mjd = 0.0; if (productHasTime) { ProductData.UTC scanLineTime = ProductUtils.getScanLineTime(product, y + 0.5); mjd = scanLineTime.getMJD(); if (dataPeriod != null && dataPeriod.getObservationMembership(geoPos.lon, mjd) != DataPeriod.Membership.CURRENT_PERIOD) { return null; } } if(maxDistanceOnEarth > 0) { PixelPos currentRefPP = new PixelPos(x + 0.5f, y + 0.5f); if(!currentRefPP.equals(lastRefPP)) { lastRefPP = currentRefPP; lastRefGP = getGeoPos(lastRefPP); } double distance = MathUtils.sphereDistanceDeg(earthRadius, geoPos.getLon(), geoPos.getLat(), lastRefGP.getLon(), lastRefGP.getLat()); if(distance > maxDistanceOnEarth) { return null; } } final float[] samples = pointer.createSamples(); return new ObservationImpl(geoPos.lat, geoPos.lon, mjd, samples); }