Product [sourceProduct] is not compatible to master product

Dear developers,

we encountered the following peculiar issue.

As a pre-processing step we TOPSAR-split and Apply-Orbit to each subswath and polarization seperately of all S1 products we download and then write them to beam-dimaps. In this we we end up with a database that contains 6 beam-dimaps per dual-pol S1 product downloaded (2 pols x 3 subswaths = 6 files). So far so good.

After this, each beam-dimap in our database is processed, together with a matching beam-dimap of an earlier date, in the same way (BackGeocoding -> some BandMaths -> Merge -> Terrain-Correction -> Subset -> Write). Now the peculiar thing is that processing in this way goes without problem for data belonging to subswaths 2 and 3, but does throw an error if applied to subswath 1 data. Below is a print of the error info, which seems to indicate that there is an issue with the validateSourceProducts method in the MergeOp.

Note that although the error printout below is generated with the snap3.0-alpha-01, we can also reprodcue it with Snap2.0.x.

Any help in solving this would be very much appreciated.

Best regards,
Sven.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/s1tbx-snap3.0-alpha-01/snap/modules/ext/org.esa.snap.snap-netcdf/org-slf4j/slf4j-simple.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/s1tbx-snap3.0-alpha-01/bin/…/snap/modules/ext/org.esa.snap.snap-netcdf/org-slf4j/slf4j-simple.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
org.esa.snap.core.gpf.graph.GraphException: Product [sourceProduct] is not compatible to master product.
at org.esa.snap.core.gpf.graph.NodeContext.initTargetProduct(NodeContext.java:78)
at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:195)
at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:178)
at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:178)
at org.esa.snap.core.gpf.graph.GraphContext.initOutput(GraphContext.java:162)
at org.esa.snap.core.gpf.graph.GraphContext.(GraphContext.java:91)
at org.esa.snap.core.gpf.graph.GraphContext.(GraphContext.java:64)
at org.esa.snap.core.gpf.graph.GraphProcessor.executeGraph(GraphProcessor.java:130)
at org.esa.snap.core.gpf.main.DefaultCommandLineContext.executeGraph(DefaultCommandLineContext.java:84)
at org.esa.snap.core.gpf.main.CommandLineTool.executeGraph(CommandLineTool.java:502)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraph(CommandLineTool.java:350)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:249)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:150)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:122)
at org.esa.snap.core.gpf.main.GPT.run(GPT.java:54)
at org.esa.snap.core.gpf.main.GPT.main(GPT.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.esa.snap.runtime.Launcher.lambda$run$13(Launcher.java:55)
at org.esa.snap.runtime.Engine.runClientCode(Engine.java:183)
at org.esa.snap.runtime.Launcher.run(Launcher.java:51)
at org.esa.snap.runtime.Launcher.main(Launcher.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:62)
at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:57)
Caused by: org.esa.snap.core.gpf.OperatorException: Product [sourceProduct] is not compatible to master product.
at org.esa.snap.core.gpf.common.MergeOp.validateSourceProducts(MergeOp.java:176)
at org.esa.snap.core.gpf.common.MergeOp.initialize(MergeOp.java:90)
at org.esa.snap.core.gpf.internal.OperatorContext.initializeOperator(OperatorContext.java:485)
at org.esa.snap.core.gpf.internal.OperatorContext.getTargetProduct(OperatorContext.java:272)
at org.esa.snap.core.gpf.Operator.getTargetProduct(Operator.java:382)
at org.esa.snap.core.gpf.graph.NodeContext.initTargetProduct(NodeContext.java:76)
… 29 more

This error happens when two products being merged are not compatible. It could be the dimensions or the geocoding are different. Merge has a geographicError parameter which you could make larger.

If these are the same then it could also be related to a currently opened issue where this check is too restrictive.

Following Sven’s experiments and as suggested by you, we have tried to increase the geographicError parameter and did more tests. These always resulted in the identified error, both in snap2.0 and snap3.0alpha.

I investigated a bit more, and inside the isCompatibleProduct() function in snap/core/datamodel/Product.java the code returns false in the second verification step:
getSceneRasterWidth() != product.getSceneRasterWidth()

I confirmed that the subswaths (IW1) of the products we are trying to merge have the same dimensions (width and height) so there seems to be indeed a problem in the toolbox.

What are the values within both raster widths?

These are the values of the raster widths:
getSceneRasterWidth() = 39258
product.getSceneRasterWidth() = 39071

This is after a TOPS Split? Each subswath does have different dimensions so you can’t be merging bands from different swaths. I assume you are creating new bands with band maths and then want to merge them with the other bands which are of the same dimension.

If you are trying to merge (really mosaic) all the subswaths together then, you should be using TOPS Deburst and then TOPS Merge of all the deburst subswaths.