本文整理汇总了Java中org.esa.snap.core.gpf.GPF.createProduct方法的典型用法代码示例。如果您正苦于以下问题:Java GPF.createProduct方法的具体用法?Java GPF.createProduct怎么用?Java GPF.createProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.esa.snap.core.gpf.GPF
的用法示例。
在下文中一共展示了GPF.createProduct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareTestProduct
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private Product prepareTestProduct() throws IOException {
final String filePath = ScapeMOperatorTest.class.getResource("source_product.dim").getFile();
final Product sourceProduct = ProductIO.readProduct(filePath);
final HashMap<String, Object> parameters = new HashMap<>();
parameters.put("reflectance_water_threshold", "0.08");
parameters.put("thicknessOfCoast", "20");
parameters.put("minimumOceanSize", "1600");
parameters.put("calculateLakes", false);
parameters.put("outputReflBand2", false);
parameters.put("useDEM", false);
parameters.put("skipGapFilling", false);
parameters.put("skipVisibilitySmoothing", false);
parameters.put("outputRhoToa", false);
return GPF.createProduct("snap.scapeM", parameters, sourceProduct);
}
示例2: reproject
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
/**
* STEP 2 methods
*/
private Product reproject(Product product, Product referenceProduct) {
final HashMap<String, Object> projParameters = createProjectionParameters();
final GeoCoding geoCoding = product.getSceneGeoCoding();
if (geoCoding == null) {
String msg = "Source product: '" + product.getName() + "' contains no geo-coding. Skipped for further processing.";
getLogger().warning(msg);
return product;
} else {
HashMap<String, Product> projProducts = new HashMap<>();
projProducts.put("source", product);
projParameters.put("crs", this.crs);
if(!this.nativeResolution){
projParameters.put("pixelSizeX", this.pixelSizeX);
projParameters.put("pixelSizeY", this.pixelSizeY);
}
if (referenceProduct != null) {
projParameters.put("pixelSizeX", computeStepX(referenceProduct));
projParameters.put("pixelSizeY", computeStepY(referenceProduct));
projProducts.put("reference", referenceProduct);
}
product = GPF.createProduct("S2tbx-Reproject", projParameters, projProducts);
}
return product;
}
示例3: processLandWaterMask
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private void processLandWaterMask() {
boolean isHigherResolutionInput = sourceProduct.getBand("B2") != null
&& sourceProduct.getBand("B2").getGeoCoding().getMapCRS().getName().toString().contains("UTM")
&& sourceProduct.getBand("B2").getImageToModelTransform().getScaleX() < LAND_WATER_MASK_RESOLUTION;
HashMap<String, Object> waterMaskParameters = new HashMap<>();
waterMaskParameters.put("resolution", LAND_WATER_MASK_RESOLUTION);
if (isHigherResolutionInput) {
System.out.println("No subsampling of " + sourceProduct.getBand("B2").getImageToModelTransform().getScaleX() + " m product necessary to access " + LAND_WATER_MASK_RESOLUTION + " m water mask");
waterMaskParameters.put("subSamplingFactorX", 1);
waterMaskParameters.put("subSamplingFactorY", 1);
} else {
waterMaskParameters.put("subSamplingFactorX", OVERSAMPLING_FACTOR_X);
waterMaskParameters.put("subSamplingFactorY", OVERSAMPLING_FACTOR_Y);
}
waterMaskProduct = GPF.createProduct("LandWaterMask", waterMaskParameters, sourceProduct);
}
示例4: computePostProcessProduct
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private void computePostProcessProduct() {
postProcessingProduct = s2ClassifProduct;
Product cloudBufferProduct = null;
if (computeCloudBuffer) {
HashMap<String, Product> input = new HashMap<>();
input.put("l1c", sourceProduct);
input.put("s2Cloud", s2ClassifProduct);
input.put("classifiedProduct", s2ClassifProduct);
Map<String, Object> paramsBuffer = new HashMap<>();
paramsBuffer.put("cloudBufferWidth", cloudBufferWidth);
cloudBufferProduct = GPF.createProduct(OperatorSpi.getOperatorAlias(S2IdepixCloudBufferOp.class),
paramsBuffer, input);
postProcessingProduct = cloudBufferProduct;
}
if (computeCloudShadow) {
HashMap<String, Product> inputShadow = new HashMap<>();
inputShadow.put("l1c", sourceProduct);
inputShadow.put("s2Classif", s2ClassifProduct);
inputShadow.put("s2CloudBuffer", cloudBufferProduct);
Map<String, Object> params = new HashMap<>();
params.put("computeCloudShadow", computeCloudShadow);
postProcessingProduct = GPF.createProduct(OperatorSpi.getOperatorAlias(S2IdepixPostProcessOp.class),
params, inputShadow);
}
}
示例5: reprojectProducts
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private void reprojectProducts(List<Product> allProducts, ProgressMonitor pm) {
pm.beginTask("Reprojecting source products...", allProducts.size());
try {
for (Product product : allProducts) {
if (pm.isCanceled()) {
return;
}
if (!product.isCompatibleProduct(tsProduct, LAT_LON_EPSILON)) {
HashMap<String, Product> productToBeReprojectedMap = new HashMap<>();
productToBeReprojectedMap.put("source", product);
productToBeReprojectedMap.put("collocateWith", tsProduct);
final Product collocatedProduct = GPF.createProduct("Reproject", createProjectionParameters(), productToBeReprojectedMap);
collocatedProduct.setStartTime(product.getStartTime());
collocatedProduct.setEndTime(product.getEndTime());
product = collocatedProduct;
}
productTimeMap.put(formatTimeString(product), product);
pm.worked(1);
}
} finally {
pm.done();
}
}
示例6: createTargetProduct
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
@Override
protected Product createTargetProduct() throws Exception {
final S2tbxMosaicFormModel formModel = form.getFormModel();
final Map<String, Object> parameterMap = formModel.getParameterMap();
boolean multiSize=false;
for(Product product:formModel.getSourceProductMap().values() )
if(product.isMultiSize()){
multiSize = true;
break;
}
if(!multiSize){
return GPF.createProduct("Mosaic", parameterMap, formModel.getSourceProductMap());
}
return GPF.createProduct("Multi-size Mosaic", parameterMap, formModel.getSourceProductMap());
}
示例7: initialize
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
@Override
public void initialize() throws OperatorException {
final boolean inputProductIsValid = IdepixUtils.isValidMerisProduct(sourceProduct);
if (!inputProductIsValid) {
throw new OperatorException(IdepixConstants.INPUT_INCONSISTENCY_ERROR_MESSAGE);
}
geoSceneCoding = sourceProduct.getSceneGeoCoding();
if (geoSceneCoding == null) {
throw new OperatorException("Source product has no geocoding");
}
if (!geoSceneCoding.canGetGeoPos()) {
throw new OperatorException("Source product has no usable geocoding");
}
Product targetProduct = ScapeMUtils.createSimpleTargetProduct(sourceProduct);
Band flagBand = targetProduct.addBand(WATER_FLAGS, ProductData.TYPE_INT16);
FlagCoding flagCoding = createScapeMLakesFlagCoding(WATER_FLAGS);
flagBand.setSampleCoding(flagCoding);
targetProduct.getFlagCodingGroup().add(flagCoding);
setupCloudScreeningBitmasks(targetProduct);
landWaterMaskProduct = GPF.createProduct("LandWaterMask", GPF.NO_PARAMS, sourceProduct);
coastRegionImage = new BufferedImage(sourceProduct.getSceneRasterWidth(),
sourceProduct.getSceneRasterHeight(), BufferedImage.TYPE_INT_RGB);
kmxpix = 0.3f;
if (sourceProduct.getProductType().equals(EnvisatConstants.MERIS_RR_L1B_PRODUCT_TYPE_NAME)) {
kmxpix = 1.2f;
}
if (calculateLakes) {
minimumOceanSizeInPixels = (int) (minimumOceanSize / kmxpix);
identifyLakeRegions();
thicknessOfCoastInPixels = (int) (thicknessOfCoast / kmxpix) / 2;
identifyCoastRegions();
}
setTargetProduct(targetProduct);
}
示例8: main
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
File sourceFile = new File(args[0]);
File sensor = new File(args[1]);
LOGGER.info("Source: " + sourceFile.getName());
Product source = ProductIO.readProduct(sourceFile);
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("useDefaultSolarFlux", true);
Product target = GPF.createProduct("c2rcc." + sensor, parameters, source);
writeWithGPF(target, args[1]);
}
示例9: main
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
Product product = ProductIO.readProduct(args[0]);
File vectorFile = new File(args[1]);
File rgbFile = new File(args[2]);
String[] rgBbandNames = new String[]{"radiance_1", "radiance_1", "radiance_1", };
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("vectorFile", vectorFile);
parameters.put("separateShapes", false);
product = GPF.createProduct("Import-Vector", parameters, product);
String vectorName = FileUtils.getFilenameWithoutExtension(vectorFile);
quicklookRGBwOverlay(product, rgbFile, rgBbandNames, vectorName);
}
示例10: processSentinel2
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private void processSentinel2() {
processLandWaterMask();
Map<String, Product> inputProducts = new HashMap<>(4);
inputProducts.put("l1c", sourceProduct);
inputProducts.put("waterMask", waterMaskProduct);
final Map<String, Object> pixelClassificationParameters = createPixelClassificationParameters();
s2ClassifProduct = GPF.createProduct(OperatorSpi.getOperatorAlias(S2IdepixClassificationOp.class),
pixelClassificationParameters, inputProducts);
if (computeCloudShadow || computeCloudBuffer) {
// Post Cloud Classification: cloud shadow, cloud buffer
computePostProcessProduct();
targetProduct = S2IdepixUtils.cloneProduct(s2ClassifProduct, true);
Band cloudFlagBand = targetProduct.getBand(S2IdepixUtils.IDEPIX_CLASSIF_FLAGS);
cloudFlagBand.setSourceImage(postProcessingProduct.getBand(S2IdepixUtils.IDEPIX_CLASSIF_FLAGS).getSourceImage());
} else {
targetProduct = s2ClassifProduct;
}
// new bit masks:
S2IdepixUtils.setupIdepixCloudscreeningBitmasks(targetProduct);
setTargetProduct(targetProduct);
}
示例11: resample
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private Product resample(Product source, int targetWidth, int targetHeight) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("referenceBandName", null);
parameters.put("targetWidth", targetWidth);
parameters.put("targetHeight", targetHeight);
parameters.put("targetResolution", null);
if (RESAMPLE_LOWEST.equals(this.resampleType)) {
parameters.put("downsampling", this.downsamplingMethod != null ? this.downsamplingMethod : "First");
} else if (RESAMPLE_HIGHEST.equals(this.resampleType)) {
parameters.put("upsampling", this.upsamplingMethod != null ? this.upsamplingMethod : "Nearest");
}
return GPF.createProduct("Resample", parameters, source);
}
示例12: testOpLAI
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
@Test
public void testOpLAI() throws Exception {
Product sourceProduct = createTestProduct(BiophysicalVariable.LAI);
Map<String, Object> parameters = new HashMap<String, Object>() {{
put("computeLAI", true);
put("computeCab", false);
put("computeCw", false);
put("computeFapar", false);
put("computeFcover", false);
}};
Product targetProduct = GPF.createProduct("BiophysicalOp", parameters, sourceProduct);
assertNotNull(targetProduct);
Band biophysicalVariableBand = targetProduct.getBand("lai");
assertNotNull(biophysicalVariableBand);
Band flagBand = targetProduct.getBand("lai_flags");
assertNotNull(flagBand);
float[] actualOutput = new float[width*height];
biophysicalVariableBand.readPixels(0, 0, width, height, actualOutput, ProgressMonitor.NULL);
int[] actualFlag = new int[width*height];
flagBand.readPixels(0, 0, width, height, actualFlag, ProgressMonitor.NULL);
Band expectedBand = sourceProduct.getBand("expected_output");
float[] expectedOutput = new float[width*height];
expectedBand.readPixels(0, 0, width, height, expectedOutput, ProgressMonitor.NULL);
for (int i = 0; i < width*height; i++) {
float actual = actualOutput[i];
int flag = actualFlag[i];
float expected = expectedOutput[i];
if (flag == 0) {
assertEquals(expected, actual, 1E-3f);
}
}
}
示例13: doInBackground
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
@Override
protected Void doInBackground(ProgressMonitor pm) throws Exception {
pm.beginTask("Computing pixel values...", -1);
AbstractButton runButton = getButton(ID_OK);
runButton.setEnabled(false);
try {
GPF.createProduct("PixEx", parameterMap, ioForm.getSourceProducts());
pm.worked(1);
} finally {
pm.done();
}
return null;
}
示例14: createTargetProduct
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
@Override
protected Product createTargetProduct() throws Exception {
if (validateUI()) {
SystemUtils.freeAllMemory();
opUI.updateParameters();
final HashMap<String, Product> sourceProducts = ioParametersPanel.createSourceProductsMap();
return GPF.createProduct(operatorName, parameterSupport.getParameterMap(), sourceProducts);
}
return null;
}
示例15: createProjectedProduct
import org.esa.snap.core.gpf.GPF; //导入方法依赖的package包/类
private Product createProjectedProduct(Product toReproject, Product crsReference) {
final Map<String, Product> productMap = getProductMap(toReproject, crsReference);
final Map<String, Object> parameterMap = new HashMap<>();
parameterMap.put("resamplingName", "Nearest");
parameterMap.put("includeTiePointGrids", false);
parameterMap.put("addDeltaBands", false);
// @todo - generalise
final Product reprojectedProduct = GPF.createProduct("Reproject", parameterMap, productMap);
reprojectedProduct.setStartTime(toReproject.getStartTime());
reprojectedProduct.setEndTime(toReproject.getEndTime());
return reprojectedProduct;
}