Hello all,
I am trying to coregister RS2 images from the same orbit and track. I have succeeded in the GUI, but cannot get the following code to work in my java code. I think perhaps there is something I don’t understand in how the parameters and sourceProducts must be passed to the operator.
-
Even though I specify to only use two bands (the first of each product), the operator tries to write all of them. How can I coregister only selected bands from each product ?
-
The operator can successfully write the master bands to disk, but fails when trying to write the slave bands :
Exception in thread “main” org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:421)
at org.esa.s1tbx.insar.gpf.coregistration.CreateStackOp.computeTile(CreateStackOp.java:911)
…
Any advice would be greatly appreciated.
SDB
/* Load products */ Product[] products = new Product[2]; products[0] = ProductIO.readProduct(inFile1); products[1] = ProductIO.readProduct(inFile2);
GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis(); /* Operator parameters */ HashMap parameters = new HashMap(); HashMap productMap = new HashMap(); parameters.put("extent","Master"); parameters.put("initialOffsetMethod","Product Geolocation"); parameters.put("masterBands",products[0].getBandAt(0).getName()); parameters.put("resamplingType","Nearest-Neighbor"); parameters.put("sourceBands",products[1].getBandAt(0).getName()); System.out.println("Creating stack..."); Product outProduct = GPF.createProduct("CreateStack", parameters, products); System.out.println("Done.");
ProductIO.writeProduct(outProduct, outFile, "BEAM-DIMAP", true);