@Override public void destroy() throws IOException { deleteProductNode(getProductNode().getProduct(), getProductNode().getProduct().getFlagCodingGroup(), getProductNode()); }
list.add(new PNGGroup.IC(product.getIndexCodingGroup())); if (product.getFlagCodingGroup().getNodeCount() > 0) { list.add(new PNGGroup.FC(product.getFlagCodingGroup())); list.addAll(Arrays.asList(product.getFlagCodingGroup().toArray())); list.addAll(Arrays.asList(product.getVectorDataGroup().toArray())); list.addAll(Arrays.asList(product.getTiePointGridGroup().toArray()));
/** * Creates the flags for the saturation mask; the flags are: * <ul><li>XS1 band is saturated</li></ul> * <ul><li>XS2 band is saturated</li></ul> * <ul><li>XS3 band is saturated</li></ul> * <ul><li>SWIR band is saturated</li></ul> * * @param outputProduct the products on which the flagCoding containing the flags is added * @return the flagCoding created with the saturated flags, and added to the product */ FlagCoding createSaturatedFlagCoding(Product outputProduct) { String bandName = SpotConstants.SPOT4_TAKE5_TAG_SATURATION; FlagCoding flagCoding = new FlagCoding(bandName); flagCoding.addFlag("XS1_saturated", 1, "XS1 band is saturated"); flagCoding.addFlag("XS2_saturated", 2, "XS2 band is saturated"); flagCoding.addFlag("XS3_saturated", 4, "XS3 band is saturated"); flagCoding.addFlag("SWIR_saturated", 8, "SWIR band is saturated"); outputProduct.getFlagCodingGroup().add(flagCoding); return flagCoding; }
protected FlagCoding createFlagCoding(Product product) { FlagCoding flagCoding = new FlagCoding("unusable_data"); flagCoding.addFlag(RapidEyeConstants.FLAG_BLACK_FILL, 1, "area was not imaged by spacecraft"); flagCoding.addFlag(RapidEyeConstants.FLAG_CLOUDS, 2, "cloud covered"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_BLUE_DATA, 4, "missing/suspect data in blue band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_GREEN_DATA, 8, "missing/suspect data in green band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_RED_DATA, 16, "missing/suspect data in red band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_RED_EDGE_DATA, 32, "missing/suspect data in red edge band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_NIR_DATA, 64, "missing/suspect data in nir band"); product.getFlagCodingGroup().add(flagCoding); return flagCoding; }
/** * Creates the flags for the diverse masks (snow, water); the flags are: * <ul><li>no diverse data</li></ul> * <ul><li>water</li></ul> * <ul><li>snow</li></ul> * <ul><li>Sun too low for terrain correction (limitation of correction factor that tends to the infinity, correction is false)</li></ul> * <ul><li>Sun too low for terrain correction (correction might be inaccurate)</li></ul> * * @param outputProduct the products on which the flagCoding containing the flags is added * @return the flagCoding created with the saturated flags, and added to the */ FlagCoding createDiverseFlagCoding(Product outputProduct) { String bandName = SpotConstants.SPOT4_TAKE5_TAG_DIVERSE; FlagCoding flagCoding = new FlagCoding(bandName); flagCoding.addFlag("no_div_data", 1, "no diverse data"); flagCoding.addFlag("water", 2, "water"); flagCoding.addFlag("snow", 4, "snow"); flagCoding.addFlag("false_correction", 8, "Sun too low for terrain correction (limitation of correction factor that tends to the infinity, correction is false)"); flagCoding.addFlag("inaccurate_correction", 16, "Sun too low for terrain correction (correction might be inaccurate)"); outputProduct.getFlagCodingGroup().add(flagCoding); return flagCoding; }
/** * Creates the flags for the clouds mask; the flags are: * <ul><li>all clouds (except thin ones) or shadows</li></ul> * <ul><li>all clouds (except thin ones)</li></ul> * <ul><li>cloud detected through absolute threshold</li></ul> * <ul><li>cloud detected through multi-t threshold</li></ul> * <ul><li>very thin clouds</li></ul> * <ul><li>high clouds detected with 1.38 µm band (LANDSAT 8 only)</li></ul> * <ul><li>cloud shadows matched with a cloud</li></ul> * <ul><li>cloud shadows in the zone where clouds could be outside the image (less reliable)</li></ul> * * @param outputProduct the products on which the flagCoding containing the flags is added * @return the flagCoding created with the clouds flags, and added to the product */ FlagCoding createCloudsFlagCoding(Product outputProduct) { String bandName = SpotConstants.SPOT4_TAKE5_TAG_CLOUDS; FlagCoding flagCoding = new FlagCoding(bandName); flagCoding.addFlag("clouds_or_shadows", 1, "all clouds (except thin ones) or shadows"); flagCoding.addFlag("clouds", 2, "all clouds (except thin ones)"); flagCoding.addFlag("cloud_absolute_threshold", 4, "cloud detected through absolute threshold"); flagCoding.addFlag("cloud_multi_t_threshold", 8, "cloud detected through multi-t threshold"); flagCoding.addFlag("thin_clouds", 16, "very thin clouds"); flagCoding.addFlag("clouds_1.38band", 32, "high clouds detected with 1.38 µm band (LANDSAT 8 only)"); flagCoding.addFlag("shadows_matched_clouds", 64, "cloud shadows matched with a cloud"); flagCoding.addFlag("shadows_for_clouds_outside", 128, "cloud shadows in the zone where clouds could be outside the image (less reliable)"); outputProduct.getFlagCodingGroup().add(flagCoding); return flagCoding; }
for (String flagCodingName : srcProduct.getFlagCodingGroup().getNodeNames()) { FlagCoding srcFC = srcProduct.getFlagCodingGroup().get(flagCodingName); String[] flagNames = srcFC.getFlagNames(); FlagCoding contextFC = new FlagCoding(flagCodingName); contextFC.addFlag(flagName, srcFC.getFlagMask(flagName), srcFC.getFlag(flagName).getDescription()); contextProduct.getFlagCodingGroup().add(contextFC); contextBand.setSampleCoding(contextProduct.getFlagCodingGroup().get(srcBand.getFlagCoding().getName()));
public static void createFlagMasks(Product targetProduct) { Guardian.assertNotNull("targetProduct", targetProduct); int w = targetProduct.getSceneRasterWidth(); int h = targetProduct.getSceneRasterHeight(); MyMaskColor mColor = new MyMaskColor(); ProductNodeGroup<Mask> tarMG = targetProduct.getMaskGroup(); ProductNodeGroup<FlagCoding> tarFCG = targetProduct.getFlagCodingGroup(); for (int node=0; node<tarFCG.getNodeCount(); node++){ FlagCoding fc = tarFCG.get(node); for (int i=0; i<fc.getNumAttributes(); i++){ MetadataAttribute f = fc.getAttributeAt(i); String expr = fc.getName() + "." + f.getName(); Mask m = Mask.BandMathsType.create(f.getName(), f.getDescription(), w, h, expr, mColor.next(), 0.5); tarMG.add(m); } } }
biophysicalVariableFlagCoding.addFlag(flagDef.getName(), flagDef.getFlagValue(), flagDef.getDescription()); tp.getFlagCodingGroup().add(biophysicalVariableFlagCoding); biophysicalVariableFlagBand.setSampleCoding(biophysicalVariableFlagCoding);
@Override public void initialize() throws OperatorException { String pname = aotProduct.getName(); String ptype = aotProduct.getProductType(); rasterWidth = aotProduct.getSceneRasterWidth(); rasterHeight = aotProduct.getSceneRasterHeight(); targetProduct = new Product(pname, ptype, rasterWidth, rasterHeight); FlagCoding aotFlagCoding = new FlagCoding(AotConsts.aotFlags.name); aotFlagCoding.addFlag("aot_climatology", BitSetter.setFlag(0, F_CLIM), "aot from climatology only"); aotFlagCoding.addFlag("aot_interp", BitSetter.setFlag(0, F_INTERP), "aot spatially interpolated"); targetProduct.getFlagCodingGroup().add(aotFlagCoding); AerosolUtils.createFlagMasks(targetProduct); Band targetBand = AerosolUtils.createTargetBand(AotConsts.aotFlags, rasterWidth, rasterHeight); targetBand.setSampleCoding(aotFlagCoding); targetProduct.addBand(targetBand); ProductUtils.copyBand(AotConsts.aot.name, aotProduct, targetProduct, false); ProductUtils.copyBand(AotConsts.aotErr.name, aotProduct, targetProduct, false); setTargetProduct(targetProduct); }
private void copyBands(Product sourceProduct, Product targetProduct) { Guardian.assertNotNull("source", sourceProduct); Guardian.assertNotNull("target", targetProduct); ProductNodeGroup<FlagCoding> targetFCG = targetProduct.getFlagCodingGroup(); for (int iBand = 0; iBand < sourceProduct.getNumBands(); iBand++) { Band sourceBand = sourceProduct.getBandAt(iBand); if (!targetProduct.containsBand(sourceBand.getName())) { Band targetBand = copyBandScl(sourceBand.getName(), sourceProduct, sourceBand.getName(), targetProduct); if (sourceBand.isFlagBand()) { FlagCoding flgCoding = sourceBand.getFlagCoding(); if (!targetFCG.contains(flgCoding.getName())) { ProductUtils.copyFlagCoding(flgCoding, targetProduct); } if (targetBand != null) { targetBand.setSampleCoding(targetFCG.get(flgCoding.getName())); } } } } }
flagsOutputBand.setSampleCoding(flagCoding); targetProduct.getFlagCodingGroup().add(flagCoding); targetProduct.addBand(flagsOutputBand);
if (sourceFlagCoding != null) { final String flagCodingName = sourceFlagCoding.getName(); final FlagCoding destFlagCoding = targetProduct.getFlagCodingGroup().get(flagCodingName); targetBand.setSampleCoding(destFlagCoding); } else if (sourceIndexCoding != null) {
FlagCoding flagCoding = S2IdepixUtils.createIdepixFlagCoding(S2IdepixUtils.IDEPIX_CLASSIF_FLAGS); classifFlagBand.setSampleCoding(flagCoding); targetProduct.getFlagCodingGroup().add(flagCoding);