/** * Compute calibration LUTs for the given range line. * * @param y Index of the given range line. * @param x0 X coordinate of the upper left corner pixel of the given tile. * @param w Tile width. * @param calInfo Object of CalibrationInfo class. * @param lut LUT for calibration. */ public static void computeTileCalibrationLUTs(final int y, final int x0, final int w, final Sentinel1Calibrator.CalibrationInfo calInfo, final double azT0, final double azT1, final float[] vec0LUT, final float[] vec1LUT, final int[] vec0Pixels, int pixelIdx0, final double[] lut) { final double azTime = calInfo.firstLineTime + y * calInfo.lineTimeInterval; double muX, muY = (azTime - azT0) / (azT1 - azT0); int pixelIdx = pixelIdx0; final int maxX = x0 + w; for (int x = x0; x < maxX; x++) { if (x > vec0Pixels[pixelIdx + 1]) { pixelIdx++; } muX = (double) (x - vec0Pixels[pixelIdx]) / (double) (vec0Pixels[pixelIdx + 1] - vec0Pixels[pixelIdx]); lut[x - x0] = Maths.interpolationBiLinear( vec0LUT[pixelIdx], vec0LUT[pixelIdx + 1], vec1LUT[pixelIdx], vec1LUT[pixelIdx + 1], muX, muY); } }
protected String getHeaderFileName() { if (ZipUtils.isZip(headerFile)) { return ""; //todo } else { return headerFile.getName(); } }
private void getSensorPosition(final double time, double[] senPos) { final int numVectors = orbitStateVectors.length; final int numVectorsUsed = Math.min(orbitStateVectors.length, 5); final int d = numVectors / numVectorsUsed; final double[] timeArray = new double[numVectorsUsed]; final double[] xPosArray = new double[numVectorsUsed]; final double[] yPosArray = new double[numVectorsUsed]; final double[] zPosArray = new double[numVectorsUsed]; for (int i = 0; i < numVectorsUsed; i++) { timeArray[i] = orbitStateVectors[i * d].time_mjd; xPosArray[i] = orbitStateVectors[i * d].x_pos; // m yPosArray[i] = orbitStateVectors[i * d].y_pos; // m zPosArray[i] = orbitStateVectors[i * d].z_pos; // m } senPos[0] = Maths.lagrangeInterpolatingPolynomial(timeArray, xPosArray, time); senPos[1] = Maths.lagrangeInterpolatingPolynomial(timeArray, yPosArray, time); senPos[2] = Maths.lagrangeInterpolatingPolynomial(timeArray, zPosArray, time); }
private static double[] computePolynomialCoefficients( double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) { final int firstPixel = 0; final int midPixel = imageWidth / 2; final int lastPixel = imageWidth - 1; final double[] idxArray = {firstPixel, midPixel, lastPixel}; final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel}; final Matrix A = Maths.createVandermondeMatrix(idxArray, 2); final Matrix b = new Matrix(rangeArray, 3); final Matrix x = A.solve(b); return x.getColumnPackedCopy(); }
private static File getResidualsFile(final Product sourceProduct) { final String fileName = sourceProduct.getName() + "_residual.txt"; return new File(ResourceUtils.getReportFolder(), fileName); } }
private InputStream getERSAuxFile(final String fileName) throws IOException { final String path = "org/esa/s1tbx/auxdata/ers/"+ fileName; return ResourceUtils.getResourceAsStream(path, this.getClass()); }
public static File getStandardGraphFolder() { return ResourceUtils.getGraphFolder("Standard Graphs").toFile(); }
@Override public void run() { ResourceUtils.installGraphs(this.getClass(), "org/esa/snap/classification/graphs/"); } }
static void validateInput(final File file) throws IOException { if (ZipUtils.isZip(file)) { if(!ZipUtils.findInZip(file, "s1", ".tiff")) { throw new IOException("measurement folder is missing in product"); } } else { final File baseFolder = file.getParentFile(); final File annotationFolder = new File(baseFolder, ANNOTATION); if (!annotationFolder.exists()) { throw new IOException("annotation folder is missing in product"); } } }
private static double[] computePolynomialCoefficients( double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) { final int firstPixel = 0; final int midPixel = imageWidth / 2; final int lastPixel = imageWidth - 1; final double[] idxArray = {firstPixel, midPixel, lastPixel}; final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel}; final Matrix A = Maths.createVandermondeMatrix(idxArray, 2); final Matrix b = new Matrix(rangeArray, 3); final Matrix x = A.solve(b); return x.getColumnPackedCopy(); }
/** * Set absolute path for outputing target report file. */ private void setTargetReportFilePath() { final String fileName = sourceProduct.getName() + "_wind_field_report.xml"; windFieldReportFile = new File(ResourceUtils.getReportFolder(), fileName); }
protected VirtualDir createProductDir(final File inputFile) { if (ZipUtils.isZip(inputFile)) { return VirtualDir.create(inputFile); } else { return VirtualDir.create(inputFile.getParentFile()); } }
private static InputStream getResStream(final String resourcePath, final String mission, final String fileName, final Class resourceClass) throws IOException { final String path = resourcePath + mission.toLowerCase() + "/" + fileName; return ResourceUtils.getResourceAsStream(path, resourceClass); } }
public static File getInternalGraphFolder() { return ResourceUtils.getGraphFolder("internal").toFile(); }
static boolean isLevel2(final File file) { if (ZipUtils.isZip(file)) { return ZipUtils.findInZip(file, "s1", ".nc"); } else { final File baseFolder = file.getParentFile(); final File measurementFolder = new File(baseFolder, MEASUREMENT); return measurementFolder.exists() && checkFolder(measurementFolder, ".nc"); } }
private static double[] computePolynomialCoefficients( double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) { final int firstPixel = 0; final int midPixel = imageWidth / 2; final int lastPixel = imageWidth - 1; final double[] idxArray = {firstPixel, midPixel, lastPixel}; final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel}; final Matrix A = Maths.createVandermondeMatrix(idxArray, 2); final Matrix b = new Matrix(rangeArray, 3); final Matrix x = A.solve(b); return x.getColumnPackedCopy(); }
/** * Set absolute path for outputing target report file. */ private void setTargetReportFilePath() { final String fileName = sourceProduct.getName() + "_object_detection_report.xml"; targetReportFile = new File(ResourceUtils.getReportFolder(), fileName); }
private static double[] computePolynomialCoefficients( double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) { final int firstPixel = 0; final int midPixel = imageWidth / 2; final int lastPixel = imageWidth - 1; final double[] idxArray = {firstPixel, midPixel, lastPixel}; final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel}; final Matrix A = Maths.createVandermondeMatrix(idxArray, 2); final Matrix b = new Matrix(rangeArray, 3); final Matrix x = A.solve(b); return x.getColumnPackedCopy(); }
private static File getResidualsFile(final Product sourceProduct) { final String fileName = sourceProduct.getName() + "_residual.txt"; return new File(ResourceUtils.getReportFolder(), fileName); }