private Band addBand(Product product, BandReader bandReader, int channelIndex) { final Band band = product.addBand(bandReader.getBandName(), bandReader.getDataType()); band.setScalingFactor(bandReader.getScalingFactor()); band.setUnit(bandReader.getBandUnit()); band.setDescription(bandReader.getBandDescription()); band.setSpectralBandIndex(channelIndex + 1); band.setValidPixelExpression(band.getName() + " != NaN"); bandReaderMap.put(band, bandReader); return band; }
protected Band createBand(BandReader bandReader, int channel) { final Band band = new Band(bandReader.getBandName(), bandReader .getDataType(), avhrrFile.getProductWidth(), avhrrFile .getProductHeight()); band.setScalingFactor(bandReader.getScalingFactor()); band.setUnit(bandReader.getBandUnit()); band.setDescription(bandReader.getBandDescription()); band.setSpectralBandIndex(channel); band.setSpectralBandwidth(CH_BANDWIDTHS[channel]); band.setSpectralWavelength(CH_WAVELENGTHS[channel]); band.setValidPixelExpression(CH_VALID_MASK_EXPRESSIONS[channel]); band.setNoDataValue(NO_DATA_VALUE); band.setNoDataValueUsed(true); bandReaders.put(band, bandReader); return band; }
private void handleIndexCoding(Band sourceBand, Band targetBand, boolean renameComponents, String renamePattern) { if(sourceBand.getIndexCoding() != null) { targetBand.getProduct().getIndexCodingGroup().remove(targetBand.getIndexCoding()); targetBand.setSampleCoding(null); } setIndexCoding(targetBand, sourceBand.getIndexCoding(), renameComponents, renamePattern); }
private void setBandProperties(Band band, String validMaskExpression) { band.setDescription(bandDescription); band.setUnit(bandUnit); band.setSpectralWavelength(bandWavelength); band.setGeophysicalNoDataValue(noDataValue); band.setNoDataValueUsed(noDataValueUsed); band.setValidPixelExpression(validMaskExpression); }
private static void configureBand(Band band05X, ImageInfo imageInfo, String unit, String description) { band05X.setUnit(unit); band05X.setDescription(description); band05X.setImageInfo(imageInfo); band05X.setNoDataValue(Double.NaN); band05X.setNoDataValueUsed(true); }
@Override public void setInvalidPixelExpression(Band band) { band.setNoDataValueUsed(false); band.setNoDataValue(0); }
private void addBand(final Product product) { final String bandName = "radiance_1"; // constant final Band band = new Band(bandName, ProductData.TYPE_UINT8, product.getSceneRasterWidth(), product.getSceneRasterHeight()); band.setSpectralBandIndex(0); // constant band.setSpectralWavelength(645); // constant band.setSpectralBandwidth(250); // constant band.setUnit("mw / (m^2*sr*nm)"); // constant band.setScalingFactor(leaderFile.getAncillary2Record().getAbsoluteCalibrationGain()); band.setScalingOffset(leaderFile.getAncillary2Record().getAbsoluteCalibrationOffset()); band.setNoDataValue(0.00); band.setNoDataValueUsed(true); product.addBand(band); }
private void addBand(String varName) { VariableMetadata variableMetadata = getVariableMetadata(varName); if (variableMetadata != null) { Band band = new Band(variableMetadata.name, variableMetadata.dataType, sceneRasterWidth, sceneRasterHeight); band.setDescription(variableMetadata.description); band.setUnit(variableMetadata.variable.getUnitsString()); band.setNoDataValue(variableMetadata.fillValue); band.setNoDataValueUsed(variableMetadata.fillValue != Double.NaN); band.setSpectralWavelength(getWavelengthFromBandName(varName)); product.addBand(band); final VariableReader variableReader = new VariableReader(variableMetadata.variable); bandMap.put(band, variableReader); } }
/** * Creates the forward view 1600 nm band */ private void createForward1600Band() { Band band = new Band(AtsrGBTConstants.FORWARD_1600_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_1600_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_16_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_16_WIDTH); addBand(band); }
private void addBand(String varName) { VariableMetadata variableMetadata = getVariableMetadata(varName); if (variableMetadata != null) { Band band = new Band(variableMetadata.name, ProductData.TYPE_INT16, _sceneRasterWidth, _sceneRasterHeight); band.setDescription(variableMetadata.description); band.setScalingOffset(variableMetadata.scalingOffset); band.setScalingFactor(variableMetadata.scalingFactor); band.setLog10Scaled(variableMetadata.log10Scaled); band.setNoDataValue(variableMetadata.fillValue); band.setNoDataValueUsed(variableMetadata.fillValue != Double.NaN); _product.addBand(band); bandMap.put(band, variableMetadata); } }
static Band createSubset(Band sourceBand, Scene targetScene, ProductSubsetDef subsetDef) { final Band targetBand = new Band(sourceBand.getName(), sourceBand.getDataType(), targetScene.getRasterWidth(), targetScene.getRasterHeight()); ProductUtils.copyRasterDataNodeProperties(sourceBand, targetBand); targetBand.setSourceImage(getSourceImage(subsetDef, sourceBand)); return targetBand; }
private void copyBandTo(Product destP, Band sourceBand) { final Band destBand = new Band(sourceBand.getName(), sourceBand.getDataType(), sourceBand.getRasterWidth(), sourceBand.getRasterHeight()); destBand.setRasterData(sourceBand.getData().createDeepClone()); destP.addBand(destBand); }
private static void attachSynthesisQualityFlagBand(Product probavProduct, Product flagProduct) { FlagCoding probavSmFlagCoding = new FlagCoding(ProbaVConstants.SM_FLAG_BAND_NAME); ProbaVUtils.addSynthesisQualityFlags(probavSmFlagCoding); ProbaVUtils.addSynthesisQualityMasks(probavProduct); probavProduct.getFlagCodingGroup().add(probavSmFlagCoding); final Band smFlagBand = probavProduct.addBand(ProbaVConstants.SM_FLAG_BAND_NAME, ProductData.TYPE_INT16); smFlagBand.setDescription("PROBA-V Synthesis SM Flags"); smFlagBand.setSampleCoding(probavSmFlagCoding); ProbaVSynthesisBitMaskOp bitMaskOp = new ProbaVSynthesisBitMaskOp(); bitMaskOp.setParameterDefaultValues(); bitMaskOp.setSourceProduct("sourceProduct", flagProduct); Product bitMaskProduct = bitMaskOp.getTargetProduct(); smFlagBand.setSourceImage(bitMaskProduct.getBand(ProbaVConstants.SM_FLAG_BAND_NAME).getSourceImage()); }
private void addSpectralInfo(Product product, String name, int index, float min, float max, float solFlux) { Band spectralBand = product.getBand(name); if (spectralBand != null) { spectralBand.setSpectralBandIndex(index); spectralBand.setSpectralWavelength(min + 0.5f * (max - min)); spectralBand.setSpectralBandwidth(max - min); spectralBand.setSolarFlux(solFlux); spectralBand.setDescription(MessageFormat.format("{0} spectral band", name)); } }
@Override void setInvalidPixelExpression(Band band) { if (band.getName().startsWith("reflec_")) { band.setNoDataValueUsed(true); band.setNoDataValue(0); } else { band.setNoDataValueUsed(false); band.setNoDataValue(0); } }
private static void addElevationBand(Product product, ElevationModel dem, String elevationBandName) { final GeoCoding geoCoding = product.getGeoCoding(); ElevationModelDescriptor demDescriptor = dem.getDescriptor(); final float noDataValue = dem.getDescriptor().getNoDataValue(); final Band elevationBand = product.addBand(elevationBandName, ProductData.TYPE_INT16); elevationBand.setSynthetic(true); elevationBand.setNoDataValue(noDataValue); elevationBand.setUnit("m"); elevationBand.setDescription(demDescriptor.getName()); elevationBand.setSourceImage(createElevationSourceImage(dem, geoCoding, elevationBand)); }
private static PixelGrid create(final Band b, ProgressMonitor pm) throws IOException { final int w = b.getRasterWidth(); final int h = b.getRasterHeight(); final float[] pixels = new float[w * h]; b.readPixels(0, 0, w, h, pixels, pm); return new PixelGrid(b.getProduct(), b.getName(), w, h, 0.5f, 0.5f, 1.0f, 1.0f, pixels); } }
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()); }
@Override public void initialize() throws OperatorException { Product targetProduct = new Product("target", "target", 100, 100); for (Band srcBand : source.getBands()) { Band band = targetProduct.addBand(srcBand.getName(), srcBand.getDataType()); band.setSourceImage(srcBand.getSourceImage()); } setTargetProduct(targetProduct); }
@Override public void decode(ProfileReadContext ctx, Product p) throws IOException { final Band[] bands = p.getBands(); for (Band band : bands) { String varName = EscapeStrings.backslashEscape(band.getName(), NetcdfFile.reservedSectionSpec); Variable variable = ctx.getNetcdfFile().findVariable(varName); final IndexCoding indexCoding = readIndexCoding(variable, band.getName()); if (indexCoding != null) { p.getIndexCodingGroup().add(indexCoding); band.setSampleCoding(indexCoding); } } }