private static void copyLine2Of2(final float[] srcLine, final ProductData destBuffer, final int currentLineIndex, final int sourceStepX) { final int destLength = destBuffer.getNumElems(); final int srcLength = srcLine.length / 2; for (int x = currentLineIndex, i = 0; x < destLength && i < srcLength; ++x, i += sourceStepX) { destBuffer.setElemDoubleAt(x, srcLine[(i << 1) + 1]); } }
private static void copyLine1Of2(final float[] srcLine, final ProductData destBuffer, final int currentLineIndex, final int sourceStepX) { final int destLength = destBuffer.getNumElems(); final int srcLength = srcLine.length / 2; for (int x = currentLineIndex, i = 0; x < destLength && i < srcLength; ++x, i += sourceStepX) { destBuffer.setElemDoubleAt(x, srcLine[i << 1]); } }
private static void checkBufferSize(int sourceWidth, int sourceHeight, ProductData sourceBuffer) { final int expectedBufferSize = (sourceWidth * sourceHeight); final int actualBufferSize = sourceBuffer.getNumElems(); Guardian.assertEquals("sourceWidth * sourceHeight", actualBufferSize, expectedBufferSize); /*I18N*/ }
private static void copyLine1Of2(final short[] srcLine, final ProductData destBuffer, final int currentLineIndex, final int sourceStepX) { final int destLength = destBuffer.getNumElems(); final int srcLength = srcLine.length / 2; for (int x = currentLineIndex, i = 0; x < destLength && i < srcLength; ++x, i += sourceStepX) { destBuffer.setElemDoubleAt(x, srcLine[i << 1]); } }
private static void copyLine2Of2(final short[] srcLine, final ProductData destBuffer, final int currentLineIndex, final int sourceStepX) { final int destLength = destBuffer.getNumElems(); final int srcLength = srcLine.length / 2; for (int x = currentLineIndex, i = 0; x < destLength && i < srcLength; ++x, i += sourceStepX) { destBuffer.setElemDoubleAt(x, srcLine[(i << 1) + 1]); } }
private static void checkBufferSize(int sourceWidth, int sourceHeight, ProductData sourceBuffer) { final int expectedBufferSize = sourceWidth * sourceHeight; final int actualBufferSize = sourceBuffer.getNumElems(); Guardian.assertEquals("sourceWidth * sourceHeight", actualBufferSize, expectedBufferSize); /*I18N*/ }
private static void checkBufferSize(int sourceWidth, int sourceHeight, ProductData sourceBuffer) { int expectedBufferSize = sourceWidth * sourceHeight; int actualBufferSize = sourceBuffer.getNumElems(); Guardian.assertEquals("sourceWidth * sourceHeight", actualBufferSize, expectedBufferSize); /*I18N*/ }
private static void copyTwoOfTwo(final ProductData tmpBuffer, final ProductData destBuffer) { final int numElems = destBuffer.getNumElems(); for (int x = 0, i = 1; x < numElems; ++x, i += 2) { destBuffer.setElemFloatAt(x, tmpBuffer.getElemFloatAt(i)); } } }
private static void copyOneOfTwo(final ProductData tmpBuffer, final ProductData destBuffer) { final int numElems = destBuffer.getNumElems(); for (int x = 0, i = 0; x < numElems; ++x, i += 2) { destBuffer.setElemFloatAt(x, tmpBuffer.getElemFloatAt(i)); } }
private static void addMetadataAttributes(MetadataAttribute attribute, ProductData data, List<MetadataTableElement> metadataTableElementList) { final String name = attribute.getName(); final String unit = attribute.getUnit(); final String description = attribute.getDescription(); for (int j = 0; j < data.getNumElems(); j++) { String elemName = String.format("%s.%d", name, j + 1); metadataTableElementList.add(new MetadataTableArrayElemLeaf(elemName, unit, description, data, j)); } } }
final int n = bandsRawSamples[0].getNumElems();
@Override public void run() { for (int i = 0; i < numOfSourceBands; i++) { bandsRawSamples[i] = getSourceTile(sourceProduct.getBand(sourceBandNames[i]), rectangle).getRawSamples(); } final int n = bandsRawSamples[0].getNumElems(); Arrays.fill(tileMinPCA, Double.MAX_VALUE); for (int i = 0; i < numPCA; i++) { for (int k = 0; k < n; k++) { double vPCA = 0.0; for (int j = 0; j < numOfSourceBands; j++) { vPCA += bandsRawSamples[j].getElemDoubleAt(k) * eigenVectorMatrices[j][i]; } if (vPCA < tileMinPCA[i]) tileMinPCA[i] = vPCA; } } synchronized (minPCA) { computePCAMin(tileMinPCA); } } };
final int n = bandsRawSamples[0].getNumElems();
private synchronized void readDataForRank3Variable(final String bandName, int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, int sourceStepX, int sourceStepY, Variable var, int destWidth, int destHeight, ProductData destBuffer) { final int swath = getSwathNumber(bandName); final int[] shape0 = var.getShape(); shape0[2] = 1; // shape0[0] is height of "outer" grid. // shape0[1] is width of "outer" grid. // shape0[2] is height of the column in each cell in the "outer" grid. final int[] origin = {sourceOffsetY, sourceOffsetX, swath}; final int outerYEnd = (sourceOffsetY + (sourceHeight - 1) * sourceStepY); final int outerXEnd = (sourceOffsetX + (sourceWidth - 1) * sourceStepX); final int[] shape = {outerYEnd - origin[0] + 1, outerXEnd - origin[1] + 1, 1}; try { final Array srcArray = var.read(origin, shape); final int length = destBuffer.getNumElems(); for(int i=0; i< length; ++i) { destBuffer.setElemFloatAt(i, srcArray.getFloat(i)); } } catch (IOException e) { SystemUtils.LOG.severe("Sentinel1OCNReader.readDataForRank3Variable: IOException when reading variable " + var.getFullName()); } catch (InvalidRangeException e) { SystemUtils.LOG.severe("Sentinel1OCNReader.readDataForRank3Variable: InvalidRangeException when reading variable " + var.getFullName()); } }
final int n = rawSamples1.getNumElems(); double v, v2; for (int i = 0; i < n; i++) {
final TileIndex trgIndex = new TileIndex(targetTile); final TileIndex srcIndex = new TileIndex(sourceTile); int maxIndex = srcData.getNumElems();
int destPos = 0; final ProductData tmpBuffer = ProductData.createInstance(new float[destBuffer.getNumElems() * 2]); final int tmpWidth = destWidth * 2;
final long flagMask; final long flagValue; if (flagData.getNumElems() == 2) { flagMask = flagData.getElemUIntAt(0); flagValue = flagData.getElemUIntAt(1);