public void setBands() { s2MsiReflBands = new Band[S2IdepixConstants.S2_MSI_REFLECTANCE_BAND_NAMES.length]; for (int i = 0; i < S2IdepixConstants.S2_MSI_REFLECTANCE_BAND_NAMES.length; i++) { s2MsiReflBands[i] = sourceProduct.getBand(S2IdepixConstants.S2_MSI_REFLECTANCE_BAND_NAMES[i]); } szaBand = sourceProduct.getBand(S2IdepixConstants.S2_MSI_ANNOTATION_BAND_NAMES[0]); vzaBand = sourceProduct.getBand(S2IdepixConstants.S2_MSI_ANNOTATION_BAND_NAMES[1]); saaBand = sourceProduct.getBand(S2IdepixConstants.S2_MSI_ANNOTATION_BAND_NAMES[2]); vaaBand = sourceProduct.getBand(S2IdepixConstants.S2_MSI_ANNOTATION_BAND_NAMES[3]); }
private static Band getFeatureBand(final Product product, final String idStr) throws OperatorException { for(String name : product.getBandNames()) { if(name.contains(idStr)) { return product.getBand(name); } } return null; }
private boolean hasChangedProductListBand(Product product) { if(product.getBands().length != listBands.size()) { return true; } for(String bandName : listBands) { if(product.getBand(bandName) == null) { return true; } } return false; }
List<Band> getBands(Product product) { List<String> names = getBandNames(); List<Band> bands = new ArrayList<>(names.size()); for (String name : names) { Band band = product.getBand(name); if (band == null) { return null; } bands.add(band); } return bands; }
private static String getCheckForNoDataExpression(final Product product, final String exp) { final String[] bandNames = product.getBandNames(); StringBuilder checkForNoData = new StringBuilder("(" + exp + " == NaN"); if (StringUtils.contains(bandNames, exp)) { double nodatavalue = product.getBand(exp).getNoDataValue(); checkForNoData.append(" or " + exp + " == " + nodatavalue); } checkForNoData.append(") ? NaN : "); return checkForNoData.toString(); }
private Band getComplexSrcBand(final Band iBand) { String name = iBand.getName(); if (name.startsWith("i_")) { name = name.replace("i_", "q_"); } else if (name.startsWith("q_")) { name = name.replace("q_", "i_"); } return srcProduct.getBand(name); }
private Product getProduct(final String productName, final String bandName) { for (Product prod : sourceProduct) { if (prod.getName().equals(productName)) { if (prod.getBand(bandName) != null) return prod; } } return null; }
private void updateReferenceBandTargetWidthAndHeight() { if (referenceBandNameBox.getSelectedItem() != null) { final String bandName = referenceBandNameBox.getSelectedItem().toString(); final Band band = sourceProducts[0].getBand(bandName); referenceBandTargetWidthLabel.setText("" + band.getRasterWidth()); referenceBandTargetHeightLabel.setText("" + band.getRasterHeight()); } }
private synchronized void writeTile(final SubsetInfo info, final String bandName, final Rectangle trgRect) throws IOException { final Tile sourceTile = getSourceTile(sourceProduct.getBand(bandName), trgRect); final ProductData rawSamples = sourceTile.getRawSamples(); final Band trgBand = info.product.getBand(bandName); info.productWriter.writeBandRasterData(trgBand, 0, 0, trgBand.getRasterWidth(), trgBand.getRasterHeight(), rawSamples, ProgressMonitor.NULL); }
private void copyBandWithFeatures(Product sourceProduct, String oldBandName, String newBandName) { Band sourceBand = sourceProduct.getBand(oldBandName); if (sourceBand == null) { final String msg = String.format("Source product [%s] does not contain a band with name [%s]", sourceProduct.getName(), oldBandName); throw new OperatorException(msg); } if (targetProduct.containsBand(newBandName)) { return; } ProductUtils.copyBand(oldBandName, sourceProduct, newBandName, targetProduct, true); }
private static void createUniqueBandName(final Product product, final Band band, final String origName) { int cnt = 1; band.setName(origName); while (product.getBand(band.getName()) != null) { band.setName(origName + cnt); ++cnt; } }
private static void createUniqueBandName(final Product product, final Band band, final String origName) { int cnt = 1; band.setName(origName); while (product.getBand(band.getName()) != null) { band.setName(origName + cnt); ++cnt; } }
private void updateBandPixelValues() { for (int i = 0; i < bandModel.getRowCount(); i++) { final String bandName = (String) bandModel.getValueAt(i, 0); bandModel.updateValue(getPixelString(currentProduct.getBand(bandName)), i); } }
private TileDataSource[] getSourceTiles(BoundingBox tileRegion) { TileDataSource[] sourceTiles = new TileDataSource[this.sourceBandNames.length]; Rectangle rectangleToRead = new Rectangle(tileRegion.getLeftX(), tileRegion.getTopY(), tileRegion.getWidth(), tileRegion.getHeight()); for (int i=0; i<this.sourceBandNames.length; i++) { Band band = this.sourceProduct.getBand(this.sourceBandNames[i]); sourceTiles[i] = new TileDataSourceImpl(getSourceTile(band, rectangleToRead)); } return sourceTiles; }
@Override public void initialize() throws OperatorException { Product cloudBufferProduct = createTargetProduct(classifiedProduct, classifiedProduct.getName(), classifiedProduct.getProductType()); rectCalculator = new RectangleExtender(new Rectangle(classifiedProduct.getSceneRasterWidth(), classifiedProduct.getSceneRasterHeight()), cloudBufferWidth, cloudBufferWidth); origClassifFlagBand = classifiedProduct.getBand(S2IdepixUtils.IDEPIX_CLASSIF_FLAGS); ProductUtils.copyBand(S2IdepixUtils.IDEPIX_CLASSIF_FLAGS, classifiedProduct, cloudBufferProduct, false); setTargetProduct(cloudBufferProduct); }
public void removeFactorsForCurrentTile(final Band targetBand, final Tile targetTile, final String srcBandName) throws OperatorException { final Band sourceBand = sourceProduct.getBand(targetBand.getName()); final Tile sourceTile = calibrationOp.getSourceTile(sourceBand, targetTile.getRectangle()); targetTile.setRawSamples(sourceTile.getRawSamples()); }
public void removeFactorsForCurrentTile(Band targetBand, Tile targetTile, String srcBandName) throws OperatorException { Band sourceBand = sourceProduct.getBand(targetBand.getName()); Tile sourceTile = calibrationOp.getSourceTile(sourceBand, targetTile.getRectangle()); targetTile.setRawSamples(sourceTile.getRawSamples()); } }
private void assertBandValid(String bandName) throws OperatorException { final Band band = sourceProduct.getBand(bandName); if (band == null) { throw new OperatorException(bandName + " can not be found in source product"); } if (!band.getRasterSize().equals(sourceProduct.getSceneRasterSize())) { throw new OperatorException(bandName + " is not of same size as source product"); } }
public void removeFactorsForCurrentTile(Band targetBand, Tile targetTile, String srcBandName) throws OperatorException { Band sourceBand = sourceProduct.getBand(targetBand.getName()); Tile sourceTile = calibrationOp.getSourceTile(sourceBand, targetTile.getRectangle()); targetTile.setRawSamples(sourceTile.getRawSamples()); }
public void removeFactorsForCurrentTile(Band targetBand, Tile targetTile, String srcBandName) throws OperatorException { Band sourceBand = sourceProduct.getBand(targetBand.getName()); Tile sourceTile = calibrationOp.getSourceTile(sourceBand, targetTile.getRectangle()); targetTile.setRawSamples(sourceTile.getRawSamples()); } }