SmileCorrectionUtils { public static Sensor getSensorType(Product sourceProduct) { String[] bandNames = sourceProduct.getBandNames(); boolean isSensor = Stream.of(bandNames).anyMatch(p -> p.matches(SensorConstants.OLCI_NAME_PATTERN)); if (isSensor) { return Sensor.OLCI; } isSensor = Stream.of(bandNames).anyMatch(p -> p.matches(SensorConstants.MERIS_NAME_PATTERN)); if (isSensor) { return Sensor.MERIS; } isSensor = Stream.of(bandNames).anyMatch(p -> p.matches(SensorConstants.MERIS_4TH_NAME_PATTERN)); if (isSensor) { return Sensor.MERIS_4TH; } isSensor = Stream.of(bandNames).anyMatch(p -> p.matches(SensorConstants.S2_MSI_NAME_PATTERN)); if (isSensor) { return Sensor.S2_MSI; } throw new OperatorException("No supported sensor found for given source product.\n" + "Only OLCI and MERIS are supported"); }  static float[] multiple2ArrayFloat(float[] array1, float[] array2); static float[] multiple3ArrayFloat(float[] array1, float[] array2, float[] array3); static float[] add2ArrayFloat(float[] array1, float[] array2); static double[] convertDegreesToRadians(double[] angle); static float[] convertDegreesToRadians(float[] angle); static double[] getAirMass(double[] cosOZARads, double[] cosSZARads); static double[] getAziDiff(double[] saaRads, double[] aooRads); static double[] getSampleDoubles(Tile sourceTile); static float[] getSampleFloats(Tile sourceTile); static int getSourceBandIndex(String name); static Sensor getSensorType(Product sourceProduct);  }
@Test public void testSensorTypeOlci() throws Exception { Product sourceProduct = new Product("bla", "what", 300, 300); sourceProduct.addBand("Oa1_radiance", ProductData.TYPE_UINT8); sourceProduct.addBand("Oa2_radiance", ProductData.TYPE_UINT8); sourceProduct.addBand("Oa3_radiance", ProductData.TYPE_UINT8); Sensor sensorType = SmileCorrectionUtils.getSensorType(sourceProduct); assertEquals(Sensor.OLCI, sensorType); }
@Test public void testSensorTypeMeris() throws Exception { Product sourceProduct = new Product("bla", "what", 300, 300); sourceProduct.addBand("radiance_1", ProductData.TYPE_UINT8); Sensor sensorType = SmileCorrectionUtils.getSensorType(sourceProduct); assertEquals(Sensor.MERIS, sensorType); }
@Test public void testSensorTypeMeris_4th() throws Exception { Product sourceProduct = new Product("bla", "what", 300, 300); sourceProduct.addBand("M05_radiance", ProductData.TYPE_UINT8); Sensor sensorType = SmileCorrectionUtils.getSensorType(sourceProduct); assertEquals(Sensor.MERIS_4TH, sensorType); }