@Test public void testConfigureTargetProduct() { final TestProductConfigurer productConfigurer = new TestProductConfigurer(); mphChlOp.configureTargetProduct(productConfigurer); final Product targetProduct = productConfigurer.getTargetProduct(); assertNotNull(targetProduct); final Band chlBand = targetProduct.getBand("chl"); assertNotNull(chlBand); assertEquals(ProductData.TYPE_FLOAT32, chlBand.getDataType()); assertEquals("mg/m^3", chlBand.getUnit()); assertEquals(Double.NaN, chlBand.getGeophysicalNoDataValue(), 1e-8); final Band immersed_cyanobacteriaBand = targetProduct.getBand("immersed_cyanobacteria"); assertNotNull(immersed_cyanobacteriaBand); assertEquals(ProductData.TYPE_INT8, immersed_cyanobacteriaBand.getDataType()); final Band floating_cyanobacteriaBand = targetProduct.getBand("floating_cyanobacteria"); assertNotNull(floating_cyanobacteriaBand); assertEquals(ProductData.TYPE_INT8, floating_cyanobacteriaBand.getDataType()); final Band floating_vegetationBand = targetProduct.getBand("floating_vegetation"); assertNotNull(floating_vegetationBand); assertEquals(ProductData.TYPE_INT8, floating_vegetationBand.getDataType()); final Band flagBand = targetProduct.getBand("mph_chl_flags"); Assert.assertNotNull(flagBand); assertEquals(ProductData.TYPE_INT8, flagBand.getDataType()); assertTrue(productConfigurer.isCopyGeoCodingCalled()); final FlagCoding flagCoding = targetProduct.getFlagCodingGroup().get("mph_chl_flags"); assertNotNull(flagCoding); FlagCoding bandFlagcoding = flagBand.getFlagCoding(); assertSame(flagCoding, bandFlagcoding); final MetadataAttribute cyanoFlag = flagCoding.getFlag("mph_cyano"); assertEquals("mph_cyano", cyanoFlag.getName()); assertEquals("Cyanobacteria dominated waters", cyanoFlag.getDescription()); assertEquals(1, cyanoFlag.getData().getElemInt()); final MetadataAttribute floatingFlag = flagCoding.getFlag("mph_floating"); assertNotNull(floatingFlag); assertEquals("mph_floating", floatingFlag.getName()); assertEquals("Floating vegetation or cyanobacteria on water surface", floatingFlag.getDescription()); assertEquals(2, floatingFlag.getData().getElemInt()); final MetadataAttribute adjacencyFlag = flagCoding.getFlag("mph_adjacency"); assertNotNull(adjacencyFlag); assertEquals("mph_adjacency", adjacencyFlag.getName()); assertEquals("Pixel suspect of adjacency effects", adjacencyFlag.getDescription()); assertEquals(4, adjacencyFlag.getData().getElemInt()); final ProductNodeGroup<Mask> maskGroup = targetProduct.getMaskGroup(); assertNotNull(maskGroup); final Mask cyanoMask = maskGroup.get("mph_cyano"); assertNotNull(cyanoMask); assertEquals("Cyanobacteria dominated waters", cyanoMask.getDescription()); assertEquals(Color.cyan, cyanoMask.getImageColor()); assertEquals(0.5f, cyanoMask.getImageTransparency(), 1e-8); final Mask floatingMask = maskGroup.get("mph_floating"); assertNotNull(floatingMask); assertEquals("Floating vegetation or cyanobacteria on water surface", floatingMask.getDescription()); assertEquals(Color.green, floatingMask.getImageColor()); assertEquals(0.5f, floatingMask.getImageTransparency(), 1e-8); final Mask adjacencyMask = maskGroup.get("mph_adjacency"); assertNotNull(adjacencyMask); assertEquals("Pixel suspect of adjacency effects", adjacencyMask.getDescription()); assertEquals(Color.red, adjacencyMask.getImageColor()); assertEquals(0.5f, adjacencyMask.getImageTransparency(), 1e-8); }
@Override protected void configureTargetProduct(ProductConfigurer productConfigurer) { final Band chlBand = productConfigurer.addBand("chl", ProductData.TYPE_FLOAT32); chlBand.setUnit("mg/m^3"); chlBand.setGeophysicalNoDataValue(Double.NaN); chlBand.setNoDataValue(Double.NaN); chlBand.setNoDataValueUsed(true); final Band immersedCyanoBand = productConfigurer.addBand("immersed_cyanobacteria", ProductData.TYPE_INT8); immersedCyanoBand.setNoDataValue(0); immersedCyanoBand.setNoDataValueUsed(true); productConfigurer.addBand("floating_cyanobacteria", ProductData.TYPE_INT8); productConfigurer.addBand("floating_vegetation", ProductData.TYPE_INT8); if (exportMph) { final Band mphBand = productConfigurer.addBand("mph", ProductData.TYPE_FLOAT32); mphBand.setUnit("dl"); mphBand.setGeophysicalNoDataValue(Double.NaN); mphBand.setNoDataValue(Double.NaN); mphBand.setNoDataValueUsed(true); } final Band flagBand = productConfigurer.addBand("mph_chl_flags", ProductData.TYPE_INT8); super.configureTargetProduct(productConfigurer); final Product targetProduct = productConfigurer.getTargetProduct(); final FlagCoding flagCoding = MphChlUtils.createMphChlFlagCoding("mph_chl_flags"); targetProduct.getFlagCodingGroup().add(flagCoding); flagBand.setSampleCoding(flagCoding); MphChlUtils.setupMphChlBitmask(targetProduct); final Product sourceProduct = productConfigurer.getSourceProduct(); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true); }
MphChlBasisOp extends PixelOperator { @Override protected void configureTargetProduct(ProductConfigurer productConfigurer) { final Band chlBand = productConfigurer.addBand("chl", ProductData.TYPE_FLOAT32); chlBand.setUnit("mg/m^3"); chlBand.setGeophysicalNoDataValue(Double.NaN); chlBand.setNoDataValue(Double.NaN); chlBand.setNoDataValueUsed(true); final Band immersedCyanoBand = productConfigurer.addBand("immersed_cyanobacteria", ProductData.TYPE_INT8); immersedCyanoBand.setNoDataValue(0); immersedCyanoBand.setNoDataValueUsed(true); productConfigurer.addBand("floating_cyanobacteria", ProductData.TYPE_INT8); productConfigurer.addBand("floating_vegetation", ProductData.TYPE_INT8); if (exportMph) { final Band mphBand = productConfigurer.addBand("mph", ProductData.TYPE_FLOAT32); mphBand.setUnit("dl"); mphBand.setGeophysicalNoDataValue(Double.NaN); mphBand.setNoDataValue(Double.NaN); mphBand.setNoDataValueUsed(true); } final Band flagBand = productConfigurer.addBand("mph_chl_flags", ProductData.TYPE_INT8); super.configureTargetProduct(productConfigurer); final Product targetProduct = productConfigurer.getTargetProduct(); final FlagCoding flagCoding = MphChlUtils.createMphChlFlagCoding("mph_chl_flags"); targetProduct.getFlagCodingGroup().add(flagCoding); flagBand.setSampleCoding(flagCoding); MphChlUtils.setupMphChlBitmask(targetProduct); final Product sourceProduct = productConfigurer.getSourceProduct(); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true); } }
MphChlBasisOp extends PixelOperator { @Override protected void configureTargetProduct(ProductConfigurer productConfigurer) { final Band chlBand = productConfigurer.addBand("chl", ProductData.TYPE_FLOAT32); chlBand.setUnit("mg/m^3"); chlBand.setGeophysicalNoDataValue(Double.NaN); chlBand.setNoDataValue(Double.NaN); chlBand.setNoDataValueUsed(true); final Band immersedCyanoBand = productConfigurer.addBand("immersed_cyanobacteria", ProductData.TYPE_INT8); immersedCyanoBand.setNoDataValue(0); immersedCyanoBand.setNoDataValueUsed(true); productConfigurer.addBand("floating_cyanobacteria", ProductData.TYPE_INT8); productConfigurer.addBand("floating_vegetation", ProductData.TYPE_INT8); if (exportMph) { final Band mphBand = productConfigurer.addBand("mph", ProductData.TYPE_FLOAT32); mphBand.setUnit("dl"); mphBand.setGeophysicalNoDataValue(Double.NaN); mphBand.setNoDataValue(Double.NaN); mphBand.setNoDataValueUsed(true); } final Band flagBand = productConfigurer.addBand("mph_chl_flags", ProductData.TYPE_INT8); super.configureTargetProduct(productConfigurer); final Product targetProduct = productConfigurer.getTargetProduct(); final FlagCoding flagCoding = MphChlUtils.createMphChlFlagCoding("mph_chl_flags"); targetProduct.getFlagCodingGroup().add(flagCoding); flagBand.setSampleCoding(flagCoding); MphChlUtils.setupMphChlBitmask(targetProduct); final Product sourceProduct = productConfigurer.getSourceProduct(); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true); }  }
MphChlBasisOp extends PixelOperator { @Override protected void configureTargetProduct(ProductConfigurer productConfigurer) { final Band chlBand = productConfigurer.addBand("chl", ProductData.TYPE_FLOAT32); chlBand.setUnit("mg/m^3"); chlBand.setGeophysicalNoDataValue(Double.NaN); chlBand.setNoDataValue(Double.NaN); chlBand.setNoDataValueUsed(true); final Band immersedCyanoBand = productConfigurer.addBand("immersed_cyanobacteria", ProductData.TYPE_INT8); immersedCyanoBand.setNoDataValue(0); immersedCyanoBand.setNoDataValueUsed(true); productConfigurer.addBand("floating_cyanobacteria", ProductData.TYPE_INT8); productConfigurer.addBand("floating_vegetation", ProductData.TYPE_INT8); if (exportMph) { final Band mphBand = productConfigurer.addBand("mph", ProductData.TYPE_FLOAT32); mphBand.setUnit("dl"); mphBand.setGeophysicalNoDataValue(Double.NaN); mphBand.setNoDataValue(Double.NaN); mphBand.setNoDataValueUsed(true); } final Band flagBand = productConfigurer.addBand("mph_chl_flags", ProductData.TYPE_INT8); super.configureTargetProduct(productConfigurer); final Product targetProduct = productConfigurer.getTargetProduct(); final FlagCoding flagCoding = MphChlUtils.createMphChlFlagCoding("mph_chl_flags"); targetProduct.getFlagCodingGroup().add(flagCoding); flagBand.setSampleCoding(flagCoding); MphChlUtils.setupMphChlBitmask(targetProduct); final Product sourceProduct = productConfigurer.getSourceProduct(); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true); }   }
MphChlBasisOp extends PixelOperator { @Override protected void configureTargetProduct(ProductConfigurer productConfigurer) { final Band chlBand = productConfigurer.addBand("chl", ProductData.TYPE_FLOAT32); chlBand.setUnit("mg/m^3"); chlBand.setGeophysicalNoDataValue(Double.NaN); chlBand.setNoDataValue(Double.NaN); chlBand.setNoDataValueUsed(true); final Band immersedCyanoBand = productConfigurer.addBand("immersed_cyanobacteria", ProductData.TYPE_INT8); immersedCyanoBand.setNoDataValue(0); immersedCyanoBand.setNoDataValueUsed(true); productConfigurer.addBand("floating_cyanobacteria", ProductData.TYPE_INT8); productConfigurer.addBand("floating_vegetation", ProductData.TYPE_INT8); if (exportMph) { final Band mphBand = productConfigurer.addBand("mph", ProductData.TYPE_FLOAT32); mphBand.setUnit("dl"); mphBand.setGeophysicalNoDataValue(Double.NaN); mphBand.setNoDataValue(Double.NaN); mphBand.setNoDataValueUsed(true); } final Band flagBand = productConfigurer.addBand("mph_chl_flags", ProductData.TYPE_INT8); super.configureTargetProduct(productConfigurer); final Product targetProduct = productConfigurer.getTargetProduct(); final FlagCoding flagCoding = MphChlUtils.createMphChlFlagCoding("mph_chl_flags"); targetProduct.getFlagCodingGroup().add(flagCoding); flagBand.setSampleCoding(flagCoding); MphChlUtils.setupMphChlBitmask(targetProduct); final Product sourceProduct = productConfigurer.getSourceProduct(); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true); }    }