private void initBandsMap(Product product) { final Band[] bands = product.getBands(); bandMap = new HashMap<>(bands.length); for (Band band : bands) { if (!(band instanceof VirtualBand || band instanceof FilterBand)) { bandMap.put(band, bandMap.size()); } } }
static boolean isValidPixelExpressionUsed(Product product) { if (product != null) { for (final Band band : product.getBands()) { final String expression = band.getValidPixelExpression(); if (expression != null && !expression.trim().isEmpty()) { return true; } } } return false; }
private static int getNumBands(Product product) { final Band[] bands = product.getBands(); final List<Band> bandList = new ArrayList<>(bands.length); for (Band band : bands) { if (shouldWriteNode(band)) { bandList.add(band); } } return bandList.size(); }
GeoTiffBandWriter(final TiffIFD ifd, final ImageOutputStream ios, final Product product) { this.ifd = ifd; this.ios = ios; tempProduct = product; final Band[] bands = tempProduct.getBands(); bandsList = new ArrayList<Band>(bands.length); for (Band band : bands) { if(Utils.shouldWriteNode(band)) { bandsList.add(band); } } }
private static int getNumBands(Product product) { final Band[] bands = product.getBands(); final List<Band> bandList = new ArrayList<Band>(bands.length); for (Band band : bands) { if (Utils.shouldWriteNode(band)) { bandList.add(band); } } return bandList.size(); }
public PixelGeoCodingSetupDialog(final Window parent, final String title, final String helpID, final Product product) { super(parent, title, ModalDialog.ID_OK_CANCEL_HELP, helpID); _product = product; final Band[] bands = product.getBands(); _bandNames = new String[bands.length]; for (int i = 0; i < bands.length; i++) { _bandNames[i] = bands[i].getName(); } }
void removeAllVariableConfigBands(Product contextProduct) { Band[] bands = contextProduct.getBands(); for (Band band : bands) { if(band instanceof VariableConfigBand) { contextProduct.removeBand(band); } } }
public static List<Band> getSpectralBands(Product product) { List<Band> bands = new ArrayList<>(); for (Band band : product.getBands()) { if (band.getSpectralWavelength() > 0.0 || band.getSpectralBandIndex() >= 0) { bands.add(band); } } Collections.sort(bands, new SpectralBandComparator()); return bands; }
@Override public void preEncode(ProfileWriteContext ctx, Product p) throws IOException { // In order to inform the writer that it shall write the geophysical values of log scaled bands // we set this property here. ctx.setProperty(Constants.CONVERT_LOGSCALED_BANDS_PROPERTY, true); defineRasterDataNodes(ctx, p.getBands()); }
@Override public void preEncode(ProfileWriteContext ctx, Product p) throws IOException { NFileWriteable ncFile = ctx.getNetcdfFileWriteable(); final Band[] bands = p.getBands(); for (Band band : bands) { CfFlagCodingPart.writeFlagCoding(band, ncFile); writeFlagCoding(band, ncFile); } }
private void setSourceImages() { for (Band destBand : tsProduct.getBands()) { final Band raster = getSourceBand(destBand.getName()); if (raster != null) { destBand.setSourceImage(raster.getSourceImage()); } } }
@Override protected void configureTargetSamples(SampleConfigurer sampleConfigurer) { // define samples corresponding to spectral bands, using the spectral band index as sample index for (final Band band : getTargetProduct().getBands()) { // pitfall: using targetProduct field here throws NPE final int spectralBandIndex = band.getSpectralBandIndex(); if (spectralBandIndex != -1) { sampleConfigurer.defineSample(spectralBandIndex, band.getName()); } } }
protected void writeGeoCoding(final int indent) { if (product.isUsingSingleGeoCoding()) { writeGeoCoding(product.getGeoCoding(), indent, -1); } else { final Band[] bands = product.getBands(); for (int i = 0; i < bands.length; i++) { final Band band = bands[i]; writeGeoCoding(band.getGeoCoding(), indent, i); } } }
@Override public void preEncode(ProfileWriteContext ctx, Product p) throws IOException { NFileWriteable writeable = ctx.getNetcdfFileWriteable(); for (Band band : p.getBands()) { IndexCoding indexCoding = band.getIndexCoding(); if (indexCoding != null) { String variableName = ReaderUtils.getVariableName(band); NVariable variable = writeable.findVariable(variableName); writeIndexCoding(indexCoding, variable); } } }
private void handleMaskRemoved(ProductNodeEvent event) { final Mask mask = (Mask) event.getSourceNode(); final Band[] bands = getBands(); for (Band band : bands) { band.getOverlayMaskGroup().remove(mask); } final TiePointGrid[] tiePointGrids = getTiePointGrids(); for (TiePointGrid tiePointGrid : tiePointGrids) { tiePointGrid.getOverlayMaskGroup().remove(mask); } }
@Override public void decode(ProfileReadContext ctx, Product p) throws IOException { final Band[] bands = p.getBands(); for (Band band : bands) { String variableName = ReaderUtils.getVariableName(ctx.getNetcdfFile(), band); final FlagCoding flagCoding = readFlagCoding(ctx, variableName); if (flagCoding != null) { p.getFlagCodingGroup().add(flagCoding); band.setSampleCoding(flagCoding); } } }
private void writeAllBands(final Product product) throws IOException { final int width = product.getSceneRasterWidth(); final int height = product.getSceneRasterHeight(); final Band[] bands = product.getBands(); for (Band band : bands) { _productWriter.writeBandRasterData(band, 0, 0, width, height, band.getData(), ProgressMonitor.NULL); } }
@Override public void initialize() throws OperatorException { targetProduct = new Product(sourceProduct.getName() + "_MulConst", sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); Band[] bands = sourceProduct.getBands(); for (Band sourceBand : bands) { targetProduct.addBand(sourceBand.getName(), sourceBand.getDataType()); } }
@Override public void initialize() throws OperatorException { targetProduct = new Product(sourceProduct1.getName() + "_Add", sourceProduct1.getProductType(), sourceProduct1.getSceneRasterWidth(), sourceProduct1.getSceneRasterHeight()); Band[] bands = sourceProduct1.getBands(); for (Band sourceBand : bands) { targetProduct.addBand(sourceBand.getName(), sourceBand.getDataType()); } }
private void testBands(Product product) { final Band[] bands = product.getBands(); assertEquals(4, bands.length); assertEquals("lat", bands[0].getName()); assertEquals("lon", bands[1].getName()); assertEquals("radiance_1", bands[2].getName()); assertEquals("radiance_2", bands[3].getName()); assertEquals(ProductData.TYPE_FLOAT32, bands[0].getDataType()); assertEquals(ProductData.TYPE_FLOAT32, bands[1].getDataType()); assertEquals(ProductData.TYPE_FLOAT32, bands[2].getDataType()); assertEquals(ProductData.TYPE_FLOAT32, bands[3].getDataType()); }