@Test public void testGetSensorType() { Product sourceProduct = new Product("test", "test", 1, 1); for (String bandName : MphChlConstants.MERIS_REQUIRED_RADIANCE_BAND_NAMES) { sourceProduct.addBand(bandName, ProductData.TYPE_FLOAT32); } Sensor sensor = MphChlOp.getSensorType(sourceProduct); assertEquals(sensor, Sensor.MERIS_3RD); sourceProduct = new Product("test2", "test2", 1, 1); for (String bandName : MphChlConstants.MERIS_REQUIRED_RADIANCE_BAND_NAMES_4TH) { sourceProduct.addBand(bandName, ProductData.TYPE_FLOAT32); } sensor = MphChlOp.getSensorType(sourceProduct); assertEquals(sensor, Sensor.MERIS_4TH); sourceProduct = new Product("test3", "test3", 1, 1); for (String bandName : MphChlConstants.OLCI_REQUIRED_RADIANCE_BAND_NAMES) { sourceProduct.addBand(bandName, ProductData.TYPE_FLOAT32); } sensor = MphChlOp.getSensorType(sourceProduct); assertEquals(sensor, Sensor.OLCI); sourceProduct = new Product("test4", "test4", 1, 1); for (String bandName : MphChlConstants.MERIS_REQUIRED_BRR_BAND_NAMES) { sourceProduct.addBand(bandName, ProductData.TYPE_FLOAT32); } sourceProduct.addBand(SensorConstants.MERIS_L1B_FLAGS_NAME, ProductData.TYPE_UINT8); sensor = MphChlOp.getSensorType(sourceProduct); assertEquals(sensor, Sensor.MERIS_3RD); sourceProduct = new Product("test5", "test5", 1, 1); for (String bandName : MphChlConstants.MERIS_REQUIRED_BRR_BAND_NAMES) { sourceProduct.addBand(bandName, ProductData.TYPE_FLOAT32); } sourceProduct.addBand(SensorConstants.MERIS_4TH_L1B_FLAGS_NAME, ProductData.TYPE_INT16); sensor = MphChlOp.getSensorType(sourceProduct); assertEquals(sensor, Sensor.MERIS_4TH); sourceProduct = new Product("test6", "test6", 1, 1); for (String bandName : MphChlConstants.OLCI_REQUIRED_BRR_BAND_NAMES) { sourceProduct.addBand(bandName, ProductData.TYPE_FLOAT32); } sensor = MphChlOp.getSensorType(sourceProduct); assertEquals(sensor, Sensor.OLCI); }
static Sensor getSensorType(Product sourceProduct) { boolean isOlci = isValidL1bSourceProduct(sourceProduct, Sensor.OLCI) || isValidBrrSourceProduct(sourceProduct, Sensor.OLCI); if (isOlci) { return Sensor.OLCI; } boolean isMeris3rd = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_3RD) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_3RD) && sourceProduct.containsBand(SensorConstants.MERIS_L1B_FLAGS_NAME)); if (isMeris3rd) { return Sensor.MERIS_3RD; } boolean isMeris4th = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_4TH) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_4TH) && sourceProduct.containsBand(SensorConstants.MERIS_4TH_L1B_FLAGS_NAME)); if (isMeris4th) { return Sensor.MERIS_4TH; } throw new OperatorException("Source product not applicable to this operator.\n" + "Only OLCI and MERIS are supported"); }
MphChlOp extends Operator { static Sensor getSensorType(Product sourceProduct) { boolean isOlci = isValidL1bSourceProduct(sourceProduct, Sensor.OLCI) || isValidBrrSourceProduct(sourceProduct, Sensor.OLCI); if (isOlci) { return Sensor.OLCI; } boolean isMeris3rd = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_3RD) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_3RD) && sourceProduct.containsBand(SensorConstants.MERIS_L1B_FLAGS_NAME)); if (isMeris3rd) { return Sensor.MERIS_3RD; } boolean isMeris4th = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_4TH) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_4TH) && sourceProduct.containsBand(SensorConstants.MERIS_4TH_L1B_FLAGS_NAME)); if (isMeris4th) { return Sensor.MERIS_4TH; } throw new OperatorException("Source product not applicable to this operator.\n" + "Only OLCI and MERIS are supported"); } }
MphChlOp extends Operator { static Sensor getSensorType(Product sourceProduct) { boolean isOlci = isValidL1bSourceProduct(sourceProduct, Sensor.OLCI) || isValidBrrSourceProduct(sourceProduct, Sensor.OLCI); if (isOlci) { return Sensor.OLCI; } boolean isMeris3rd = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_3RD) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_3RD) && sourceProduct.containsBand(SensorConstants.MERIS_L1B_FLAGS_NAME)); if (isMeris3rd) { return Sensor.MERIS_3RD; } boolean isMeris4th = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_4TH) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_4TH) && sourceProduct.containsBand(SensorConstants.MERIS_4TH_L1B_FLAGS_NAME)); if (isMeris4th) { return Sensor.MERIS_4TH; } throw new OperatorException("Source product not applicable to this operator.\n" + "Only OLCI and MERIS are supported"); }  }
MphChlOp extends Operator { static Sensor getSensorType(Product sourceProduct) { boolean isOlci = isValidL1bSourceProduct(sourceProduct, Sensor.OLCI) || isValidBrrSourceProduct(sourceProduct, Sensor.OLCI); if (isOlci) { return Sensor.OLCI; } boolean isMeris3rd = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_3RD) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_3RD) && sourceProduct.containsBand(SensorConstants.MERIS_L1B_FLAGS_NAME)); if (isMeris3rd) { return Sensor.MERIS_3RD; } boolean isMeris4th = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_4TH) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_4TH) && sourceProduct.containsBand(SensorConstants.MERIS_4TH_L1B_FLAGS_NAME)); if (isMeris4th) { return Sensor.MERIS_4TH; } throw new OperatorException("Source product not applicable to this operator.\n" + "Only OLCI and MERIS are supported"); }  @Override void initialize(); }
MphChlOp extends Operator { static Sensor getSensorType(Product sourceProduct) { boolean isOlci = isValidL1bSourceProduct(sourceProduct, Sensor.OLCI) || isValidBrrSourceProduct(sourceProduct, Sensor.OLCI); if (isOlci) { return Sensor.OLCI; } boolean isMeris3rd = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_3RD) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_3RD) && sourceProduct.containsBand(SensorConstants.MERIS_L1B_FLAGS_NAME)); if (isMeris3rd) { return Sensor.MERIS_3RD; } boolean isMeris4th = isValidL1bSourceProduct(sourceProduct, Sensor.MERIS_4TH) || (isValidBrrSourceProduct(sourceProduct, Sensor.MERIS_4TH) && sourceProduct.containsBand(SensorConstants.MERIS_4TH_L1B_FLAGS_NAME)); if (isMeris4th) { return Sensor.MERIS_4TH; } throw new OperatorException("Source product not applicable to this operator.\n" + "Only OLCI and MERIS are supported"); }  @Override void initialize();  }