use of org.esa.snap.core.gpf.annotations.SourceProduct in project s1tbx by senbox-org.
the class PolarimetricClassificationOp method createTargetProduct.
/**
* Create target product.
*/
private void createTargetProduct() {
targetProduct = new Product(sourceProduct.getName() + PRODUCT_SUFFIX, sourceProduct.getProductType(), sourceImageWidth, sourceImageHeight);
ProductUtils.copyProductNodes(sourceProduct, targetProduct);
final String targetBandName = classifier.getTargetBandName();
// add index coding
final IndexCoding indexCoding = classifier.createIndexCoding();
targetProduct.getIndexCodingGroup().add(indexCoding);
// add a target product per source product
for (final PolBandUtils.PolSourceBand bandList : srcBandList) {
final Band targetBand = new Band(targetBandName + bandList.suffix, ProductData.TYPE_UINT8, targetProduct.getSceneRasterWidth(), targetProduct.getSceneRasterHeight());
targetBand.setUnit("zone_index");
targetBand.setNoDataValue(HAlphaWishart.NODATACLASS);
targetBand.setNoDataValueUsed(true);
targetProduct.addBand(targetBand);
bandMap.put(targetBand, bandList);
targetBand.setSampleCoding(indexCoding);
}
}
use of org.esa.snap.core.gpf.annotations.SourceProduct in project s1tbx by senbox-org.
the class HorizontalVerticalMotionOp method createTargetProduct.
private void createTargetProduct() {
targetProduct = new Product(sourceProduct.getName() + PRODUCT_SUFFIX, sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight());
ProductUtils.copyProductNodes(sourceProduct, targetProduct);
// Band for horizontal motion
targetBandHorizontalMotion = targetProduct.addBand(HORIZONTAL_MOTION_BAND_NAME, ProductData.TYPE_FLOAT32);
targetBandHorizontalMotion.setNoDataValue(Double.NaN);
targetBandHorizontalMotion.setNoDataValueUsed(true);
targetBandHorizontalMotion.setUnit("millimeters");
targetBandHorizontalMotion.setDescription("Horizontal motion");
// Band for vertical motion
targetBandVerticalMotion = targetProduct.addBand(VERTICAL_MOTION_BAND_NAME, ProductData.TYPE_FLOAT32);
targetBandVerticalMotion.setNoDataValue(Double.NaN);
targetBandVerticalMotion.setNoDataValueUsed(true);
targetBandVerticalMotion.setUnit("millimeters");
targetBandVerticalMotion.setDescription("Vertical motion");
}
use of org.esa.snap.core.gpf.annotations.SourceProduct in project s1tbx by senbox-org.
the class OilSpillClusteringOp method createTargetProduct.
/**
* Create target product.
*/
private void createTargetProduct() {
targetProduct = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceImageWidth, sourceImageHeight);
ProductUtils.copyProductNodes(sourceProduct, targetProduct);
addSelectedBands();
}
use of org.esa.snap.core.gpf.annotations.SourceProduct in project s1tbx by senbox-org.
the class AzimuthShiftOp method createTargetProduct.
/**
* Create target product.
*/
private void createTargetProduct() {
targetProduct = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight());
ProductUtils.copyProductNodes(sourceProduct, targetProduct);
final String[] bandNames = sourceProduct.getBandNames();
for (String srcBandName : bandNames) {
final Band band = sourceProduct.getBand(srcBandName);
if (band instanceof VirtualBand) {
continue;
}
Band targetBand;
if (srcBandName.contains(StackUtils.MST) || srcBandName.contains("derampDemod")) {
targetBand = ProductUtils.copyBand(srcBandName, sourceProduct, srcBandName, targetProduct, true);
} else if (srcBandName.contains("azOffset") || srcBandName.contains("rgOffset")) {
continue;
} else {
targetBand = new Band(srcBandName, band.getDataType(), band.getRasterWidth(), band.getRasterHeight());
targetBand.setUnit(band.getUnit());
targetProduct.addBand(targetBand);
}
if (targetBand != null && srcBandName.startsWith("q_")) {
final String suffix = srcBandName.substring(1);
ReaderUtils.createVirtualIntensityBand(targetProduct, targetProduct.getBand("i" + suffix), targetBand, suffix);
}
}
/*
// test data generation
final String[] bandNames = sourceProduct.getBandNames();
String mstBandI = null, mstBandQ = null, slvBandI = null, slvBandQ = null, derampBand = null;
for (String srcBandName : bandNames) {
if (srcBandName.contains("i_") && srcBandName.contains(StackUtils.MST)) {
mstBandI = srcBandName;
} else if (srcBandName.contains("q_") && srcBandName.contains(StackUtils.MST)) {
mstBandQ = srcBandName;
} else if (srcBandName.contains("i_") && srcBandName.contains(StackUtils.SLV)) {
slvBandI = srcBandName;
} else if (srcBandName.contains("q_") && srcBandName.contains(StackUtils.SLV)) {
slvBandQ = srcBandName;
} else if (srcBandName.contains("derampDemod")) {
derampBand = srcBandName;
}
}
final Band tgtMstBandI = ProductUtils.copyBand(slvBandI, sourceProduct, mstBandI, targetProduct, true);
final Band tgtMstBandQ = ProductUtils.copyBand(slvBandQ, sourceProduct, mstBandQ, targetProduct, true);
ProductUtils.copyBand(derampBand, sourceProduct, derampBand, targetProduct, true);
Band tgtSlvBandI = new Band(slvBandI,
sourceProduct.getBand(slvBandI).getDataType(),
sourceProduct.getBand(slvBandI).getRasterWidth(),
sourceProduct.getBand(slvBandI).getRasterHeight());
Band tgtSlvBandQ = new Band(slvBandQ,
sourceProduct.getBand(slvBandQ).getDataType(),
sourceProduct.getBand(slvBandQ).getRasterWidth(),
sourceProduct.getBand(slvBandQ).getRasterHeight());
tgtSlvBandI.setUnit(Unit.REAL);
tgtSlvBandQ.setUnit(Unit.IMAGINARY);
targetProduct.addBand(tgtSlvBandI);
targetProduct.addBand(tgtSlvBandQ);
final String slvSuffix = slvBandI.substring(1);
ReaderUtils.createVirtualIntensityBand(targetProduct, tgtSlvBandI, tgtSlvBandQ, slvSuffix);
final String mstSuffix = mstBandI.substring(1);
ReaderUtils.createVirtualIntensityBand(targetProduct, tgtMstBandI, tgtMstBandQ, mstSuffix);
//==============
*/
targetProduct.setPreferredTileSize(512, subSwath[subSwathIndex - 1].linesPerBurst);
updateTargetMetadata();
}
use of org.esa.snap.core.gpf.annotations.SourceProduct in project s1tbx by senbox-org.
the class EAPPhaseCorrectionOp method createTargetProduct.
/**
* Create target product.
*/
void createTargetProduct() {
targetProduct = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight());
ProductUtils.copyProductNodes(sourceProduct, targetProduct);
addSelectedBands();
updateTargetProductMetadata();
}
Aggregations