@Test public void testWavelength() throws Exception { Float wavelength = metadata.getWavelength("LC08_L1TP_024036_20181011_20181011_01_RT_sr_band3.tif"); assertEquals(560.0,wavelength,1E-6); }
public float getWavelength(String filename) { String instrument = getInstrument(); int index1 = filename.indexOf("sr_band"); int index2 = filename.indexOf(".tif"); if(index1<0 || index2<index1) { return 0; } Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)); int band=Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)) - 1; if(instrument.startsWith("OLI")) { return L8_WAVELENGTHS[band]; } else if(instrument.startsWith("TM")) { return TM_WAVELENGTHS[band]; } else if (instrument.startsWith("ETM")) { return ETM_PLUS_WAVELENGTHS[band]; } return 0; }
LandsatLevel2Metadata extends XmlMetadata { public float getWavelength(String filename) { String instrument = getInstrument(); int index1 = filename.indexOf("sr_band"); int index2 = filename.indexOf(".tif"); if(index1<0 || index2<index1) { return 0; } Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)); int band=Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)) - 1; if(instrument.startsWith("OLI")) { return L8_WAVELENGTHS[band]; } else if(instrument.startsWith("TM")) { return TM_WAVELENGTHS[band]; } else if (instrument.startsWith("ETM")) { return ETM_PLUS_WAVELENGTHS[band]; } return 0; } }
LandsatLevel2Metadata extends XmlMetadata { public float getWavelength(String filename) { String instrument = getInstrument(); int index1 = filename.indexOf("sr_band"); int index2 = filename.indexOf(".tif"); if(index1<0 || index2<index1) { return 0; } Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)); int band=Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)) - 1; if(instrument.startsWith("OLI")) { return L8_WAVELENGTHS[band]; } else if(instrument.startsWith("TM")) { return TM_WAVELENGTHS[band]; } else if (instrument.startsWith("ETM")) { return ETM_PLUS_WAVELENGTHS[band]; } return 0; } LandsatLevel2Metadata(String name); }
LandsatLevel2Metadata extends XmlMetadata { public float getWavelength(String filename) { String instrument = getInstrument(); int index1 = filename.indexOf("sr_band"); int index2 = filename.indexOf(".tif"); if(index1<0 || index2<index1) { return 0; } Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)); int band=Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)) - 1; if(instrument.startsWith("OLI")) { return L8_WAVELENGTHS[band]; } else if(instrument.startsWith("TM")) { return TM_WAVELENGTHS[band]; } else if (instrument.startsWith("ETM")) { return ETM_PLUS_WAVELENGTHS[band]; } return 0; } LandsatLevel2Metadata(String name); @Override String getFileName(); @Override String getProductName(); String getProductDescription(); @Override String getFormatName(); @Override String getMetadataProfile(); @Override int getRasterWidth(); @Override int getRasterHeight(); @Override String[] getRasterFileNames(); @Override ProductData.UTC getProductStartTime(); @Override ProductData.UTC getProductEndTime(); @Override ProductData.UTC getCenterTime(); @Override int getNumBands(); Point2D.Double getUpperLeft(); String getBandName(String filename); double getScalingFactor(String filename); double getScalingOffset(String filename); float getWavelength(String filename); float getBandwidth(String filename); String getBandDescription(String filename); boolean isReflectanceBand(String filename); boolean isSaturationBand(String filename); boolean isAerosolBand(String filename); boolean isQualityBand(String filename); boolean isAtmosBand(String filename); boolean isCloudBand(String filename); String getSatellite(); String getInstrument(); FlagCoding createSaturationFlagCoding(String bandName); }
LandsatLevel2Metadata extends XmlMetadata { public float getWavelength(String filename) { String instrument = getInstrument(); int index1 = filename.indexOf("sr_band"); int index2 = filename.indexOf(".tif"); if(index1<0 || index2<index1) { return 0; } Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)); int band=Integer.parseInt(filename.substring(index1+"sr_band".length(),index2)) - 1; if(instrument.startsWith("OLI")) { return L8_WAVELENGTHS[band]; } else if(instrument.startsWith("TM")) { return TM_WAVELENGTHS[band]; } else if (instrument.startsWith("ETM")) { return ETM_PLUS_WAVELENGTHS[band]; } return 0; } LandsatLevel2Metadata(String name); @Override String getFileName(); @Override String getProductName(); String getProductDescription(); @Override String getFormatName(); @Override String getMetadataProfile(); @Override int getRasterWidth(); @Override int getRasterHeight(); @Override String[] getRasterFileNames(); @Override ProductData.UTC getProductStartTime(); @Override ProductData.UTC getProductEndTime(); @Override ProductData.UTC getCenterTime(); @Override int getNumBands(); Point2D.Double getUpperLeft(); String getBandName(String filename); double getScalingFactor(String filename); double getScalingOffset(String filename); float getWavelength(String filename); float getBandwidth(String filename); String getBandDescription(String filename); boolean isReflectanceBand(String filename); boolean isSaturationBand(String filename); boolean isAerosolBand(String filename); boolean isQualityBand(String filename); boolean isAtmosBand(String filename); boolean isCloudBand(String filename); String getSatellite(); String getInstrument(); FlagCoding createSaturationFlagCoding(String bandName);  }