/** * Copies the tie point data. * * @param sourceProduct * @param targetProduct */ private void copyTiePoints(Product sourceProduct, Product targetProduct) { if (copyAllTiePoints) { // copy all tie point grids to output product ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); } else { for (int i = 0; i < sourceProduct.getNumTiePointGrids(); i++) { TiePointGrid srcTPG = sourceProduct.getTiePointGridAt(i); if (srcTPG.getName().equals("latitude") || srcTPG.getName().equals("longitude")) { targetProduct.addTiePointGrid(srcTPG.cloneTiePointGrid()); } } } }
/** * Creates the output product skeleton. */ private void initOutputProduct() throws IOException, ParseException { if (!EnvisatConstants.MERIS_L1_TYPE_PATTERN.matcher(l1bProduct.getProductType()).matches()) { throw new OperatorException("Product type '" + l1bProduct.getProductType() + "' is not supported." + "It must be a MERIS Level 1b product."); } tempCloudProduct = cloudNode.readProductNodes(l1bProduct, null); targetProduct = cloudNode.createTargetProductImpl(); ProductUtils.copyFlagBands(l1bProduct, targetProduct, true); ProductUtils.copyTiePointGrids(l1bProduct, targetProduct); ProductUtils.copyGeoCoding(l1bProduct, targetProduct); ProductUtils.copyMetadata(l1bProduct, targetProduct); targetProduct.setStartTime(l1bProduct.getStartTime()); targetProduct.setEndTime(l1bProduct.getEndTime()); cloudNode.startProcessing(); getLogger().info("Output product successfully initialised"); }
ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct);
/** * Copies all properties from source product to the target product. * * @param sourceProduct the source product * @param targetProduct the target product */ public static void copyProductNodes(final Product sourceProduct, final Product targetProduct) { ProductUtils.copyMetadata(sourceProduct, targetProduct); ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyFlagCodings(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); ProductUtils.copyMasks(sourceProduct, targetProduct); ProductUtils.copyVectorData(sourceProduct, targetProduct); ProductUtils.copyIndexCodings(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); targetProduct.setDescription(sourceProduct.getDescription()); }
targetProduct.addBand(ndviOutputBand); ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true);
ProductUtils.copyTiePointGrids(masterProduct, targetProduct);
private void createOutputProduct() throws IOException { String productType = sourceProduct.getProductType() + "_SMAC"; String productName = sourceProduct.getName() + "_SMAC"; int sceneWidth = sourceProduct.getSceneRasterWidth(); int sceneHeight = sourceProduct.getSceneRasterHeight(); targetProduct = new Product(productName, productType, sceneWidth, sceneHeight); // loop over bands and create them // ------------------------------- if (ObjectUtils.equalObjects(sensorType, SensorCoefficientManager.MERIS_NAME)) { addBandsToOutput("Atmosphere corrected MERIS band ", true); } else { addBandsToOutput("Atmosphere corrected band ", false); } ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); // the following line copies the processing request as metadata into the target product. // there is no such mechanism in GPF yet, so it is commented out. // copyRequestMetaData(_outputProduct); ProductUtils.copyFlagBands(sourceProduct, targetProduct, true); // for MERIS FSG / FRG products ProductUtils.copyBand(EnvisatConstants.MERIS_AMORGOS_L1B_CORR_LATITUDE_BAND_NAME, sourceProduct, targetProduct, true); ProductUtils.copyBand(EnvisatConstants.MERIS_AMORGOS_L1B_CORR_LONGITUDE_BAND_NAME, sourceProduct, targetProduct, true); ProductUtils.copyBand(EnvisatConstants.MERIS_AMORGOS_L1B_ALTIUDE_BAND_NAME, sourceProduct, targetProduct, true); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); }
private static Product copyProduct(Product writtenProduct) { Product targetProduct = new Product(writtenProduct.getName(), writtenProduct.getProductType(), writtenProduct.getSceneRasterWidth(), writtenProduct.getSceneRasterHeight()); targetProduct.setStartTime(writtenProduct.getStartTime()); targetProduct.setEndTime(writtenProduct.getEndTime()); ProductUtils.copyMetadata(writtenProduct, targetProduct); ProductUtils.copyGeoCoding(writtenProduct, targetProduct); ProductUtils.copyTiePointGrids(writtenProduct, targetProduct); ProductUtils.copyMasks(writtenProduct, targetProduct); ProductUtils.copyVectorData(writtenProduct, targetProduct); for (Band band : writtenProduct.getBands()) { // Force setting source image, otherwise GPF will set an OperatorImage and invoke computeTile()!! ProductUtils.copyBand(band.getName(), writtenProduct, targetProduct, true); } return targetProduct; }
sourceProduct.getSceneRasterHeight()); ProductUtils.copyTiePointGrids(sourceProduct, flhProduct); ProductUtils.copyGeoCoding(sourceProduct, flhProduct); ProductUtils.copyFlagBands(sourceProduct, flhProduct, true);
@Override public void initialize() throws OperatorException { collectSourceBands(); int width = sourceProduct.getSceneRasterWidth(); int height = sourceProduct.getSceneRasterHeight(); final String name = sourceProduct.getName() + "_CLUSTERS"; final String type = sourceProduct.getProductType() + "_CLUSTERS"; targetProduct = new Product(name, type, width, height); ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); clusterMapBand = new Band("class_indices", ProductData.TYPE_UINT8, width, height); clusterMapBand.setDescription("Class_indices"); clusterMapBand.setNoDataValue(NO_DATA_VALUE); clusterMapBand.setNoDataValueUsed(true); targetProduct.addBand(clusterMapBand); final IndexCoding indexCoding = new IndexCoding("Cluster_classes"); for (int i = 0; i < clusterCount; i++) { indexCoding.addIndex("class_" + (i + 1), i, "Cluster " + (i + 1)); } targetProduct.getIndexCodingGroup().add(indexCoding); clusterMapBand.setSampleCoding(indexCoding); clusterAnalysis = new MetadataElement("Cluster_Analysis"); targetProduct.getMetadataRoot().addElement(clusterAnalysis); setTargetProduct(targetProduct); }
ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime());
@Override public void initialize() throws OperatorException { final Product inputProduct = getSourceProduct(); final int sceneWidth = inputProduct.getSceneRasterWidth(); final int sceneHeight = getSourceProduct().getSceneRasterHeight(); Product targetProduct = new Product("ndvi", "NDVI_TYPE", sceneWidth, sceneHeight); targetProduct.setStartTime(inputProduct.getStartTime()); targetProduct.setEndTime(inputProduct.getEndTime()); ProductUtils.copyTiePointGrids(inputProduct, targetProduct); ProductUtils.copyGeoCoding(inputProduct, targetProduct); // create and add the NDVI band Band ndviOutputBand = new Band("ndvi", ProductData.TYPE_FLOAT32, sceneWidth, sceneHeight); targetProduct.addBand(ndviOutputBand); // create and add the NDVI flags band Band ndviFlagsOutputBand = new Band("ndvi_flags", ProductData.TYPE_INT16, sceneWidth, sceneHeight); ndviFlagsOutputBand.setDescription("NDVI specific flags"); targetProduct.addBand(ndviFlagsOutputBand); setTargetProduct(targetProduct); } }
ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime());
ProductUtils.copyTiePointGrids(sourceProduct, targetProduct);