Exemplo n.º 1
0
 private void maybeCopyFlagCoding(Band sourceBand, Band targetBand) {
   FlagCoding sourceCoding = sourceBand.getFlagCoding();
   if (sourceCoding != null) {
     FlagCoding targetCoding =
         getTargetProduct().getFlagCodingGroup().get(sourceCoding.getName());
     if (targetCoding == null) {
       targetCoding = ProductUtils.copyFlagCoding(sourceCoding, getTargetProduct());
     }
     targetBand.setSampleCoding(targetCoding);
   }
 }
  /**
   * This method copies the flag bands from the synergy product to the target product
   *
   * @param synergyProduct - the Synergy product
   * @param targetProduct - the target product
   */
  public static void copySynergyFlagBands(Product synergyProduct, Product targetProduct) {
    final Band aatsrConfidFlagNadirBand =
        targetProduct.addBand(SynergyConstants.CONFID_NADIR_FLAGS_AATSR, ProductData.TYPE_INT16);
    final Band aatsrConfidFlagFwardBand =
        targetProduct.addBand(SynergyConstants.CONFID_FWARD_FLAGS_AATSR, ProductData.TYPE_INT16);
    final Band aatsrCloudFlagNadirBand =
        targetProduct.addBand(SynergyConstants.CLOUD_NADIR_FLAGS_AATSR, ProductData.TYPE_INT16);
    final Band aatsrCloudFlagFwardBand =
        targetProduct.addBand(SynergyConstants.CLOUD_FWARD_FLAGS_AATSR, ProductData.TYPE_INT16);
    final Band merisL1FlagsBand =
        targetProduct.addBand(SynergyConstants.L1_FLAGS_MERIS, ProductData.TYPE_INT16);
    final Band merisCloudFlagBand =
        targetProduct.addBand(SynergyConstants.CLOUD_FLAG_MERIS, ProductData.TYPE_INT16);

    final FlagCoding aatsrConfidNadirFlagCoding =
        synergyProduct.getFlagCodingGroup().get(SynergyConstants.CONFID_NADIR_FLAGS_AATSR);
    ProductUtils.copyFlagCoding(aatsrConfidNadirFlagCoding, targetProduct);
    aatsrConfidFlagNadirBand.setSampleCoding(aatsrConfidNadirFlagCoding);

    final FlagCoding aatsrConfidFwardFlagCoding =
        synergyProduct.getFlagCodingGroup().get(SynergyConstants.CONFID_FWARD_FLAGS_AATSR);
    ProductUtils.copyFlagCoding(aatsrConfidFwardFlagCoding, targetProduct);
    aatsrConfidFlagFwardBand.setSampleCoding(aatsrConfidFwardFlagCoding);

    final FlagCoding aatsrCloudNadirFlagCoding =
        synergyProduct.getFlagCodingGroup().get(SynergyConstants.CLOUD_NADIR_FLAGS_AATSR);
    ProductUtils.copyFlagCoding(aatsrCloudNadirFlagCoding, targetProduct);
    aatsrCloudFlagNadirBand.setSampleCoding(aatsrCloudNadirFlagCoding);

    final FlagCoding aatsrCloudFwardFlagCoding =
        synergyProduct.getFlagCodingGroup().get(SynergyConstants.CLOUD_FWARD_FLAGS_AATSR);
    ProductUtils.copyFlagCoding(aatsrCloudFwardFlagCoding, targetProduct);
    aatsrCloudFlagFwardBand.setSampleCoding(aatsrCloudFwardFlagCoding);

    final FlagCoding merisL1FlagsCoding =
        synergyProduct.getFlagCodingGroup().get(SynergyConstants.L1_FLAGS_MERIS);
    ProductUtils.copyFlagCoding(merisL1FlagsCoding, targetProduct);
    merisL1FlagsBand.setSampleCoding(merisL1FlagsCoding);

    final FlagCoding merisCloudFlagCoding =
        synergyProduct.getFlagCodingGroup().get(SynergyConstants.CLOUD_FLAG_MERIS);
    ProductUtils.copyFlagCoding(merisCloudFlagCoding, targetProduct);
    merisCloudFlagBand.setSampleCoding(merisCloudFlagCoding);
  }