final double lowerBoundSlantRange = Maths.computePolynomialValue(lowerBound, srgrCoeff); if (slantRange < lowerBoundSlantRange) { return -1.0; final double upperBoundSlantRange = Maths.computePolynomialValue(upperBound, srgrCoeff); if (slantRange > upperBoundSlantRange) { return -1.0; midSlantRange = Maths.computePolynomialValue(mid, srgrCoeff); final double a = midSlantRange - slantRange; if ((a > 0 && a < 0.1) || (a <= 0.0D && 0.0D - a < 0.1)) {
/** * Compute slant range for given pixel. * * @param x The x coordinate of the pixel in the source image. * @param y The y coordinate of the pixel in the source image. * @param srgrConvParam The SRGR coefficients. * @return The slant range (in meters). */ private double computeSlantRange(int x, int y, AbstractMetadata.SRGRCoefficientList srgrConvParam, final TiePointInterpolator slantRangeTPGInterp) { if (srgrFlag) { // for ground detected product, compute slant range from SRGR coefficients return Maths.computePolynomialValue( x * rangeSpacing + srgrConvParam.ground_range_origin, srgrConvParam.coefficients); } else { // for slant range product, compute slant range from slant range time final double time = slantRangeTPGInterp.getPixelDouble(x, y, TiePointInterpolator.InterpMode.QUADRATIC) / Constants.oneBillion; //convert ns to s return time * Constants.halfLightSpeed; // in m } }
/** * Compute noise for the whole range lines corresponding to the noise records for all polarizations. */ private void computeNoiseForRangeLines() { Set<Map.Entry<String, NoiseRecord[]>> set = noiseRecord.entrySet(); for (Map.Entry<String, NoiseRecord[]> elem : set) { final String pol = elem.getKey(); final NoiseRecord[] record = elem.getValue(); final int numOfNoiseRecords = record.length; double[][] noise = new double[numOfNoiseRecords][sourceImageWidth]; int[] index = new int[numOfNoiseRecords]; for (int i = 0; i < numOfNoiseRecords; ++i) { index[i] = (int) ((record[i].timeUTC - firstLineUTC) / lineTimeInterval + 0.5); for (int j = 0; j < sourceImageWidth; ++j) { final double slantRgTime = slantRangeTime.getPixelDouble(j, index[i]) / 1.0e9; // ns to s if (slantRgTime >= record[i].validityRangeMin && slantRgTime <= record[i].validityRangeMax) { noise[i][j] = Maths.computePolynomialValue( slantRgTime - record[i].referencePoint, record[i].coefficient); } else { noise[i][j] = 0.0; } } } rangeLineIndex.put(pol, index); rangeLineNoise.put(pol, noise); } }
for (int i = 0; i <= m; i++) { sltRgTime[i] = firstPixelTime + (lastPixelTime - firstPixelTime) * i / m; groundRange[i] = Maths.computePolynomialValue(sltRgTime[i] - referencePoint, s2gCoef);