Mosaic with GPT and .XML in python

Hello,

I am trying to create a mosaic of 2 L2A images, using a .xml file in a python script, but the GPT doesn’t find my .dim files. I guess that my error is in my xml file, but I didn’t found it.

Here is my .xml :
graph_S2_mosaic.xml (1.3 KB)

And my script and the error that I get :
script_mosaic_s2
error_mosaic_s2

I specify that I have already processed Sentinel 1 images using the GPTcmd in python this way

Thank you in advance (and sorry for my poor english)

First thing there are two types of mosaic as they are mentioned in here,

The second thing, would you please to check this XML, comparison to your,

myGraph.xml (1.7 KB)

Thank you, I think that I will try to use the multi-size mosaic tool then.

The problem is that tried to modify my XML in comparison to the one that you uploaded, but it still doesn’t seem do find my input files ; I get the same message from python

Here is my .XML modified
graph_S2_multi_size_mosaic.xml (1.5 KB)

Let’s try up a solution, could you change this line in your xml file,

<fileList>${files}</fileList>

By removing {files} and adding up

<fileList>$input1</fileList>

Similar thing you could do to the output

<file>${output}</file>

<file>$output1</file>

Your call should be like below,

gpt /path/to/graph/ -Pinput1=/path/input/Sentinel/images/ -Poutput1=/path/o utput1/directory/file.dim

Thank you again, but I still get the “non zero exit status” error…

I also tried to call -Pinput1=mypath/images/* and -Pinput1=mypath/images/*dim

Maybe it is because the mosaic tools from snap want a specific kind of path, like “path/images/file1.dim , path/images/file2.dim” or with an other separator, or several different inputs for the number of images to mosaic ?

Yes, let’s try two input, but before that, did you try up the mosaic in SNAP directly?

I tried both mosaic and multisize mosaic on SNAP, but the multisize didn’t really worked ;

Here for the mosaic tool (with resampled data) :

And here for the multisize mosaic (just with sen2cor preprocessed data) :

Only a small amount of cloud pixels appear, the rest of the image has pixels in NaN

So apparently the problem is not in the xml file,

Something is already mentioned in here,

Mosaic operator

Well, for the multi-mosaicing yes, but the simple mosaic tool works perfectly on SNAP. And eventually I need to use resampled data to apply a subset in my process chain so I am going to use the simple mosaic tool.

I also tried the 2 input solutions with some modifications to the .xml that I found on other posts, where I use the “ProductSet-Reader” to read my 2 files as “path/to/file1.dim,path/to/file2.dim”, and then i place it as sources for the Mosaic operator, as sourceProduct.2 refid=“ProductSet-Reader”, but it still doesn’t work…

Just in case, here is the modified .xml : graph_S2_mosaic.xml (1.3 KB)

I also tried to write the path to my files directly in the .xml, like this :


But it doesn’t work either

I could eventually do the mosaics directly on SNAP one by one, but i have at least 38 dates to process, so it could help to do it on python

Sorry, my message might not be clear, but what I tried didn’t work