@Test 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); }
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); } }
ModisFileReader { 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); } } }
ModisFileReader { 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); } } ModisFileReader(); }
ModisFileReader { 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); } } ModisFileReader(); void addRastersAndGeoCoding(final Product product, ModisGlobalAttributes globalAttribs, NetCDFVariables netCDFVariables); ModisBandReader getBandReader(final Band band); void close(); }
ModisFileReader { 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); } } ModisFileReader(); void addRastersAndGeoCoding(final Product product, ModisGlobalAttributes globalAttribs, NetCDFVariables netCDFVariables); ModisBandReader getBandReader(final Band band); void close();  }