private static void setSpectralBandWidth(final Element element, final Band band) { final String bandWidth = element.getChildTextTrim(DimapProductConstants.TAG_BANDWIDTH); if (bandWidth != null) { band.setSpectralBandwidth(Float.parseFloat(bandWidth)); } }
private void setSpectralBandProperties(Band band) { if (band.getName().endsWith("REFL_BLUE")) { band.setSpectralBandIndex(0); band.setSpectralWavelength(462.0f); band.setSpectralBandwidth(48.0f); } else if (band.getName().endsWith("REFL_RED")) { band.setSpectralBandIndex(1); band.setSpectralWavelength(655.5f); band.setSpectralBandwidth(81.0f); } else if (band.getName().endsWith("REFL_NIR")) { band.setSpectralBandIndex(2); band.setSpectralWavelength(843.0f); band.setSpectralBandwidth(142.0f); } else if (band.getName().endsWith("REFL_SWIR")) { band.setSpectralBandIndex(3); band.setSpectralWavelength(1599.0f); band.setSpectralBandwidth(70.0f); } }
private void setSpectralProperties(Band band) { if (band.getName().endsWith("REFL_BLUE")) { band.setSpectralBandIndex(0); band.setSpectralWavelength(462.0f); band.setSpectralBandwidth(48.0f); } else if (band.getName().endsWith("REFL_RED")) { band.setSpectralBandIndex(1); band.setSpectralWavelength(655.5f); band.setSpectralBandwidth(81.0f); } else if (band.getName().endsWith("REFL_NIR")) { band.setSpectralBandIndex(2); band.setSpectralWavelength(843.0f); band.setSpectralBandwidth(142.0f); } else if (band.getName().endsWith("REFL_SWIR")) { band.setSpectralBandIndex(3); band.setSpectralWavelength(1599.0f); band.setSpectralBandwidth(70.0f); } }
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)); } }
/** * 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); }
/** * Creates the nadir view 1600 nm band */ private void createNadir1600Band() { Band band = new Band(AtsrGBTConstants.NADIR_1600_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.NADIR_1600_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_16_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_16_WIDTH); addBand(band); }
private void handleRadianceProduct(Product product) { Product hicoProductPart = hicoProductParts.get(FileType.RAD); if (hicoProductPart != null) { copyMetadata(hicoProductPart, product, FileType.RAD.toString()); String[] bandNames = hicoProductPart.getBandNames(); for (String bandName : bandNames) { String[] bandNameSplit = bandName.split("_"); String newBandname = "radiance_" + bandNameSplit[1]; Band band = ProductUtils.copyBand(bandName, hicoProductPart, newBandname, product, true); band.setScalingFactor(1.0 / 50.0); band.setSpectralBandwidth(5.7f); } product.setAutoGrouping("radiance"); product.setFileLocation(hicoProductPart.getFileLocation()); } }
private void addRciAndMaskBands(final Product product) { final String units = chrisFile.getGlobalAttribute(ChrisConstants.ATTR_NAME_CALIBRATION_DATA_UNITS); for (int i = 0; i < spectralBandCount; ++i) { final String name = MessageFormat.format("radiance_{0}", i + 1); final Band band = product.addBand(name, ProductData.TYPE_INT32); band.setSpectralBandIndex(i); band.setSpectralWavelength(chrisFile.getWavelength(i)); band.setSpectralBandwidth(chrisFile.getBandwidth(i)); band.setUnit(units); band.setDescription(MessageFormat.format("Radiance for spectral band {0}", i + 1)); band.setValidPixelExpression(MessageFormat.format("mask_{0} != {1}", i + 1, Flags.DROPOUT.getMask())); rciBands[i] = band; } for (int i = 0; i < spectralBandCount; ++i) { final String name = MessageFormat.format("mask_{0}", i + 1); final Band band = product.addBand(name, ProductData.TYPE_INT16); band.setSpectralBandIndex(i); band.setSpectralWavelength(chrisFile.getWavelength(i)); band.setSpectralBandwidth(chrisFile.getBandwidth(i)); band.setDescription(MessageFormat.format("Quality mask for spectral band {0}", i + 1)); maskBands[i] = band; } product.setAutoGrouping("radiance:mask"); }
static void setBandSpectralInformation(ModisBandDescription bandDesc, String bandNameExt, Band band) { if (bandDesc.isSpectral()) { if (bandDesc.hasSpectralInfo()) { final ModisSpectralInfo specInfo = bandDesc.getSpecInfo(); band.setSpectralWavelength(specInfo.getSpectralWavelength()); band.setSpectralBandwidth(specInfo.getSpectralBandwidth()); band.setSpectralBandIndex(specInfo.getSpectralBandIndex()); } else { final float[] data = ModisUtils.decodeSpectralInformation(bandNameExt, null); band.setSpectralWavelength(data[0]); band.setSpectralBandwidth(data[1]); band.setSpectralBandIndex((int) data[2]); } } else { band.setSpectralBandIndex(-1); } }
static private SpectrumBand createBand(int index) { final Band band = new Band("Radiance_" + (index + 1), ProductData.TYPE_INT16, 100, 100); band.setDescription("Radiance for band " + (index + 1)); band.setSpectralWavelength((float) Math.random()); band.setSpectralBandwidth((float) Math.random()); band.setUnit("sr^-1"); if (index == 7) { band.setUnit("dl"); } return new SpectrumBand(band, true); }
/** * Creates the forward view thermal bands and adds them to the bands vector. */ private void createForwardThermalBands() { Band band = new Band(AtsrGBTConstants.FORWARD_1200_BT_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.BRIGHTNESS_TEMPERATURE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_1200_BT_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_12_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_12_WIDTH); addBand(band); band = new Band(AtsrGBTConstants.FORWARD_1100_BT_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.BRIGHTNESS_TEMPERATURE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_1100_BT_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_11_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_11_WIDTH); addBand(band); band = new Band(AtsrGBTConstants.FORWARD_370_BT_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.BRIGHTNESS_TEMPERATURE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_370_BT_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_37_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_37_WIDTH); addBand(band); }
/** * Creates the nadir view visible bands and adds them to the bands vector. */ private void createNadirVisibleBands() { Band band = new Band(AtsrGBTConstants.NADIR_870_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.NADIR_870_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_87_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_87_WIDTH); addBand(band); band = new Band(AtsrGBTConstants.NADIR_650_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.NADIR_650_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_65_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_65_WIDTH); addBand(band); band = new Band(AtsrGBTConstants.NADIR_550_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.NADIR_550_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_55_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_55_WIDTH); addBand(band); }
/** * Creates the forward view visible bands and adds them to the bands vector. */ private void createForwardVisibleBands() { Band band = new Band(AtsrGBTConstants.FORWARD_870_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_870_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_87_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_87_WIDTH); addBand(band); band = new Band(AtsrGBTConstants.FORWARD_650_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_650_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_65_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_65_WIDTH); addBand(band); band = new Band(AtsrGBTConstants.FORWARD_550_REF_NAME, ProductData.TYPE_FLOAT32, AtsrConstants.ATSR_SCENE_RASTER_WIDTH, AtsrConstants.ATSR_SCENE_RASTER_HEIGHT); band.setUnit(AtsrGBTConstants.REFLECTANCE_UNIT); band.setDescription(AtsrGBTConstants.FORWARD_550_REF_DESCRIPTION); band.setSpectralWavelength(AtsrConstants.BAND_55_WAVELENGTH); band.setSpectralBandwidth(AtsrConstants.BAND_55_WIDTH); addBand(band); }
private static void readBeamBandAttributes(Variable variable, Band band) { // todo se -- units for bandwidth and wavelength Attribute attribute = variable.findAttribute(BANDWIDTH); if (attribute != null) { band.setSpectralBandwidth(attribute.getNumericValue().floatValue()); } attribute = variable.findAttribute(WAVELENGTH); if (attribute != null) { band.setSpectralWavelength(attribute.getNumericValue().floatValue()); } attribute = variable.findAttribute(SPECTRAL_BAND_INDEX); if (attribute != null) { band.setSpectralBandIndex(attribute.getNumericValue().intValue()); } attribute = variable.findAttribute(VALID_PIXEL_EXPRESSION); if (attribute != null) { band.setValidPixelExpression(attribute.getStringValue()); } attribute = variable.findAttribute(SOLAR_FLUX); if (attribute != null) { band.setSolarFlux(attribute.getNumericValue().floatValue()); } band.setName(ReaderUtils.getRasterName(variable)); }
public void testBandwidth() { assertEquals(0.0F, _rsBand.getSpectralBandwidth(), 1e-6F); _rsBand.setSpectralBandwidth(1.3F); assertEquals(1.3F, _rsBand.getSpectralBandwidth(), 1e-6F); }
private void setSpectralBandInfo(Product product) { float[] wavelengths = productFile.getSpectralBandWavelengths(); float[] bandwidths = productFile.getSpectralBandBandwidths(); float[] solar_fluxes = productFile.getSpectralBandSolarFluxes(); for (int i = 0; i < product.getNumBands(); i++) { Band band = product.getBandAt(i); int sbi = band.getSpectralBandIndex(); if (sbi >= 0) { if (wavelengths != null) { band.setSpectralWavelength(wavelengths[sbi % wavelengths.length]); } if (bandwidths != null) { band.setSpectralBandwidth(bandwidths[sbi % bandwidths.length]); } if (solar_fluxes != null) { band.setSolarFlux(solar_fluxes[sbi % solar_fluxes.length]); } } // Debug.trace(band.toString()); } }
/** * Copies the spectral properties from source band to target band. These properties are: * <ul> * <li>{@link org.esa.beam.framework.datamodel.Band#getSpectralBandIndex() spectral band index},</li> * <li>{@link org.esa.beam.framework.datamodel.Band#getSpectralWavelength() the central wavelength},</li> * <li>{@link org.esa.beam.framework.datamodel.Band#getSpectralBandwidth() the spectral bandwidth} and</li> * <li>{@link org.esa.beam.framework.datamodel.Band#getSolarFlux() the solar spectral flux}.</li> * </ul> * * @param sourceBand the source band * @param targetBand the target band * * @see #copyRasterDataNodeProperties(org.esa.beam.framework.datamodel.RasterDataNode, org.esa.beam.framework.datamodel.RasterDataNode) */ public static void copySpectralBandProperties(Band sourceBand, Band targetBand) { Guardian.assertNotNull("source", sourceBand); Guardian.assertNotNull("target", targetBand); targetBand.setSpectralBandIndex(sourceBand.getSpectralBandIndex()); targetBand.setSpectralWavelength(sourceBand.getSpectralWavelength()); targetBand.setSpectralBandwidth(sourceBand.getSpectralBandwidth()); targetBand.setSolarFlux(sourceBand.getSolarFlux()); }
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 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 Band createBand(final Avnir2ImageFile avnir2ImageFile) throws IOException, IllegalCeosFormatException { final Band band = new Band(avnir2ImageFile.getBandName(), ProductData.TYPE_UINT8, sceneWidth, sceneHeight); final int bandIndex = avnir2ImageFile.getBandIndex(); band.setSpectralBandIndex(bandIndex - 1); band.setSpectralWavelength(avnir2ImageFile.getSpectralWavelength()); band.setSpectralBandwidth(avnir2ImageFile.getSpectralBandwidth()); band.setUnit(avnir2ImageFile.getGeophysicalUnit()); final double scalingFactor = leaderFile.getAbsoluteCalibrationGain(bandIndex); final double scalingOffset = leaderFile.getAbsoluteCalibrationOffset(bandIndex); band.setScalingFactor(scalingFactor); band.setScalingOffset(scalingOffset); band.setNoDataValueUsed(false); band.setDescription("Radiance band " + avnir2ImageFile.getBandIndex()); return band; }