/** * Adds a new band description to the product description. * * @param name the name of the band (without spectral extension) * @param isSpectral whether the badnd is a spectral band or not * @param scalingMethod the scaling method to be used for this band (lin, exp ..) * @param scaleName name of the attribute containing the scale factors * @param offsetName name of the attribute containing the scale offsets * @param unitName name off the attribute containing the physical unit * @param bandName name of the attribute containing the spectral extensions (band names) * @param descName name of the attribute containing a description of the band */ public void addBand(String name, String isSpectral, String scalingMethod, String scaleName, String offsetName, String unitName, String bandName, String descName) { addBand(new ModisBandDescription( name, isSpectral, scalingMethod, scaleName, offsetName, unitName, bandName, descName)); }
/** * Adds a new band description to the product description. * * @param name the name of the band (without spectral extension) * @param isSpectral whether the badnd is a spectral band or not * @param scalingMethod the scaling method to be used for this band (lin, exp ..) * @param scaleName name of the attribute containing the scale factors * @param offsetName name of the attribute containing the scale offsets * @param unitName name off the attribute containing the physical unit * @param bandName name of the attribute containing the spectral extensions (band names) * @param descName name of the attribute containing a description of the band * @param spectralWaveLength the spectral wavelength in nm (nanomater) units * @param spectralBandWidth the spectral bandwidth in nm (nanomater) units * @param spectralBandIndex the (zero-based) spectral band index */ public void addBand(final String name, final String isSpectral, final String scalingMethod, final String scaleName, final String offsetName, final String unitName, final String bandName, final String descName, final String spectralWaveLength, final String spectralBandWidth, final String spectralBandIndex) { final ModisBandDescription bandDesc = new ModisBandDescription( name, isSpectral, scalingMethod, scaleName, offsetName, unitName, bandName, descName); bandDesc.setSpecInfo(new ModisSpectralInfo( spectralWaveLength, spectralBandWidth, spectralBandIndex)); addBand(bandDesc); }
@Test public void testIsPow10Scale() { final ModisBandDescription pow10 = new ModisBandDescription("", "", ModisConstants.POW_10_SCALE_NAME, "", "", "", "", ""); assertTrue(pow10.isPow10Scaled()); final ModisBandDescription notPow10 = new ModisBandDescription("", "", "notPowTen", "", "", "", "", ""); assertFalse(notPow10.isPow10Scaled()); } }
@Test public void testIsLinearScale() { final ModisBandDescription linear = new ModisBandDescription("", "", ModisConstants.LINEAR_SCALE_NAME, "", "", "", "", ""); assertTrue(linear.isLinearScaled()); final ModisBandDescription notLinear = new ModisBandDescription("", "", "notLinear", "", "", "", "", ""); assertFalse(notLinear.isLinearScaled()); }
@Test public void testIsSlopeInterceptScale() { final ModisBandDescription slopeIntercept = new ModisBandDescription("", "", ModisConstants.SLOPE_INTERCEPT_SCALE_NAME, "", "", "", "", ""); assertTrue(slopeIntercept.isSlopeInterceptScaled()); final ModisBandDescription notSLopeIntercept = new ModisBandDescription("", "", "notSlopeIntercept", "", "", "", "", ""); assertFalse(notSLopeIntercept.isSlopeInterceptScaled()); }
@Test public void testIsExponentialScale() { final ModisBandDescription exponential = new ModisBandDescription("", "", ModisConstants.EXPONENTIAL_SCALE_NAME, "", "", "", "", ""); assertTrue(exponential.isExponentialScaled()); final ModisBandDescription notExponential = new ModisBandDescription("", "", "notExp", "", "", "", "", ""); assertFalse(notExponential.isExponentialScaled()); }
@Test public void testIsLinearInvertedScale() { final ModisBandDescription linear = new ModisBandDescription("", "", ModisConstants.LINEAR_INVERTED_SCALE_NAME, "", "", "", "", ""); assertTrue(linear.isLinearInvertedScaled()); final ModisBandDescription notLinear = new ModisBandDescription("", "", "notLinear", "", "", "", "", ""); assertFalse(notLinear.isLinearInvertedScaled()); }
public void testSetSpectralBandInfo_fromBandIndex() { final Band band = new Band("bla", ProductData.TYPE_FLOAT32, 3, 3); final ModisBandDescription description = new ModisBandDescription("", "true", "", "", "", "", "", ""); ModisFileReader.setBandSpectralInformation(description, "4", band); assertEquals(6, band.getSpectralBandIndex()); assertEquals(555.f, band.getSpectralWavelength(), 1e-8); assertEquals(20.f, band.getSpectralBandwidth(), 1e-8); }
public void testSetSpectralBandInfo_notSpectral() { final Band band = new Band("bla", ProductData.TYPE_FLOAT32, 3, 3); final ModisBandDescription description = new ModisBandDescription("", "false", "", "", "", "", "", ""); ModisFileReader.setBandSpectralInformation(description, "", band); assertEquals(-1, band.getSpectralBandIndex()); assertEquals(0.f, band.getSpectralWavelength(), 1e-8); assertEquals(0.f, band.getSpectralBandwidth(), 1e-8); }
public void testSetSpectralBandInfo_fromSpecInfo() { final Band band = new Band("bla", ProductData.TYPE_FLOAT32, 3, 3); final ModisBandDescription description = new ModisBandDescription("", "true", "", "", "", "", "", ""); final ModisSpectralInfo spectralInfo = new ModisSpectralInfo("2", "3", "4"); description.setSpecInfo(spectralInfo); ModisFileReader.setBandSpectralInformation(description, "", band); assertEquals(4, band.getSpectralBandIndex()); assertEquals(2.f, band.getSpectralWavelength(), 1e-8); assertEquals(3.f, band.getSpectralBandwidth(), 1e-8); }
ModisBandDescription desc = new ModisBandDescription(null, null, null, null, null, null, null, null); assertEquals(null, desc.getName()); assertEquals(false, desc.isSpectral()); desc = new ModisBandDescription(expName, null, null, null, null, null, null, null); assertEquals(expName, desc.getName()); assertEquals(false, desc.isSpectral()); desc = new ModisBandDescription(null, expSpectral, null, null, null, null, null, null); assertEquals(null, desc.getName()); assertEquals(true, desc.isSpectral()); desc = new ModisBandDescription(null, null, expScaleMethod, null, null, null, null, null); assertEquals(null, desc.getName()); assertEquals(false, desc.isSpectral()); desc = new ModisBandDescription(null, null, null, expScale, null, null, null, null); assertEquals(null, desc.getName()); assertEquals(false, desc.isSpectral()); desc = new ModisBandDescription(null, null, null, null, expOffset, null, null, null); assertEquals(null, desc.getName()); assertEquals(false, desc.isSpectral()); desc = new ModisBandDescription(null, null, null, null, null, expUnit, null, null); assertEquals(null, desc.getName()); assertEquals(false, desc.isSpectral()); desc = new ModisBandDescription(null, null, null, null, null, null, expBandNames, null);