@Override protected void addCustomMetadata(Product product) throws IOException { // add bitmasks for ATSR active fires, see http://dup.esrin.esa.it/ionia/wfa/algorithm.asp final String nadirBand = EnvisatConstants.AATSR_L1B_BTEMP_NADIR_0370_BAND_NAME; final String fwardBand = EnvisatConstants.AATSR_L1B_BTEMP_FWARD_0370_BAND_NAME; ProductNodeGroup<Mask> maskGroup = product.getMaskGroup(); if (product.containsBand(nadirBand)) { maskGroup.add( mask( "fire_nadir_1", "ATSR active fire (ALGO1)", nadirBand + " > 312.0", Color.RED, 0.5f)); maskGroup.add( mask( "fire_nadir_2", "ATSR active fire (ALGO2)", nadirBand + " > 308.0", Color.RED.darker(), 0.5f)); } if (product.containsBand(fwardBand)) { maskGroup.add( mask( "fire_fward_1", "ATSR active fire (ALGO1)", fwardBand + " > 312.0", Color.RED, 0.5f)); maskGroup.add( mask( "fire_fward_2", "ATSR active fire (ALGO2)", fwardBand + " > 308.0", Color.RED.darker(), 0.5f)); } }
static void addBitmaskDefinitions(final Product product, final String flagsBandName) { for (final Flags flag : Flags.values()) { final String name = new StringBuilder(flagsBandName.split("flags")[0]).append(flag.name()).toString(); final ProductNodeGroup<Mask> maskGroup = product.getMaskGroup(); if (maskGroup.contains(name)) { continue; } final String expression = new StringBuilder(flagsBandName).append(".").append(flag.name()).toString(); final int width = product.getSceneRasterWidth(); final int height = product.getSceneRasterHeight(); Mask mask = Mask.BandMathsType.create( name, flag.getDescription(), width, height, expression, flag.getColor(), flag.getTransparency()); maskGroup.add(mask); } }
private void addMask( MetadataAttribute metadataSample, String expression, Color color, Product product) { final ProductNodeGroup<Mask> maskGroup = product.getMaskGroup(); final int width = product.getSceneRasterWidth(); final int height = product.getSceneRasterHeight(); Mask mask = Mask.BandMathsType.create( metadataSample.getName().toLowerCase(), metadataSample.getDescription(), width, height, expression, color, 0.5); maskGroup.add(mask); }
public static void addAerosolFlagBand(Product targetProduct, int rasterWidth, int rasterHeight) { FlagCoding aerosolFlagCoding = new FlagCoding(SynergyConstants.aerosolFlagCodingName); aerosolFlagCoding.addFlag( SynergyConstants.flagCloudyName, SynergyConstants.cloudyMask, SynergyConstants.flagCloudyDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagOceanName, SynergyConstants.oceanMask, SynergyConstants.flagOceanDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagSuccessName, SynergyConstants.successMask, SynergyConstants.flagSuccessDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagBorderName, SynergyConstants.borderMask, SynergyConstants.flagBorderDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagFilledName, SynergyConstants.filledMask, SynergyConstants.flagFilledDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagNegMetricName, SynergyConstants.negMetricMask, SynergyConstants.flagNegMetricDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagAotLowName, SynergyConstants.aotLowMask, SynergyConstants.flagAotLowDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagErrHighName, SynergyConstants.errHighMask, SynergyConstants.flagErrHighDesc); aerosolFlagCoding.addFlag( SynergyConstants.flagCoastName, SynergyConstants.coastMask, SynergyConstants.flagCoastDesc); targetProduct.getFlagCodingGroup().add(aerosolFlagCoding); ProductNodeGroup<Mask> maskGroup = targetProduct.getMaskGroup(); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagCloudyName, SynergyConstants.flagCloudyDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagCloudyName, Color.lightGray, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagOceanName, SynergyConstants.flagOceanDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagOceanName, Color.blue, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagSuccessName, SynergyConstants.flagSuccessDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagSuccessName, Color.pink, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagBorderName, SynergyConstants.flagBorderDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagBorderName, Color.orange, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagFilledName, SynergyConstants.flagFilledDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagFilledName, Color.magenta, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagNegMetricName, SynergyConstants.flagNegMetricDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagNegMetricName, Color.magenta, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagAotLowName, SynergyConstants.flagAotLowDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagAotLowName, Color.magenta, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagErrHighName, SynergyConstants.flagErrHighDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagErrHighName, Color.magenta, 0.2f)); maskGroup.add( Mask.BandMathsType.create( SynergyConstants.flagCoastName, SynergyConstants.flagCoastDesc, rasterWidth, rasterHeight, SynergyConstants.aerosolFlagCodingName + "." + SynergyConstants.flagCoastName, Color.magenta, 0.2f)); Band targetBand = new Band( SynergyConstants.aerosolFlagCodingName, ProductData.TYPE_UINT16, rasterWidth, rasterHeight); targetBand.setDescription(SynergyConstants.aerosolFlagCodingDesc); targetBand.setSampleCoding(aerosolFlagCoding); targetProduct.addBand(targetBand); }