Hello , I am using the “gpt Mosaic” to combine many tiles of S2 imagery, and seems the first input images is missed in the result. I downloaded S2 tiles as jp2 and metadata from AWS server.
Is my input settings correct?
Here is my command:
gpt ./Mosiac_extent.xml –SsourceProducts="Image1.jp2" "Image2.jp2" "Image3.jp2"… “ImageN.jp2”
and here is the content of the
Yes, the xml look correct.
You say the first image is missed. You mean the one in the upper elft corner or the first one you specify on the command line.
It should also be possible to remove the -SsourceProducts=. Just specify the paths to the files.
Thank you Marco,
yes, when I say “
the first input images” , it means the first image in the input image sequence, or
Image1.jp2 in my example.
I have tested the
gpt mosaic with or without
-SsourceProducts= keyword as you suggested. I notice without the
SsourceProducts keyword gives me correct mosaicking result. Any clue why?
Another issue is , as discussed in a previous post, the metadata information is lost when mosaicking tiles; then how can I update the metadata (esp. band wavelength) of the mosaicked image using
gpt for further spectral processing? (an manual approach mentioned in this post, but I would like to let the workflow run in gpt)
Using the mosaic operator with
–SsourceProducts is just the wrong way of invoking this operator.
If you look at the help when calling
gpt Mosaic -h. You see that there is no sourceProducts option.
-parameter is ignored and the others are treated as in the corrected call.
Keeping the band properties or let the user specify those properties for the variables is definitely missing. I’ve noted this (SNAP-745).
For adding the wavelength. You could use the BandMaths operator. Simply use the band name in the expression. This way you can create a copy the band and add metadata information like wavelength, unit and description.
If you put everything in one graph xml file it is still just one command line call and it will not much extract processing time.
Thank you Marco for the explanation of
gpt mosaic usage. I followed a previous post which used the
-SsourceProducts keyword and reported to be successful at the end. Also in the help file, the xml format does include:
So I assume the
-SsourceProducts should be included.
You have mentioned the SNAP_745, I also want to mention SNAP-599. ’
_count’ bands are unnecessary when combining tiles together.
Considering the disconnection of metadata and the unnecessary
_count bands, are there other alternatives to
Mosaic that can overcome these two problems while spatially merging tiles together? such as,
gpt binnning? or
Overall, the current approach is fine for me.
You can add a subset operator to the graph to exclude the ‘_count’ bands. With the binning you are limited to WGS84 and merge, does not merge spatially.
I do not understand your previous comment regarding “BandMaths”.
Do you mean I can add “wavelength” information directly in the BandMaths Operator? Or I can copy bands from a file using BandMaths, and then still need to add “wavelength” information manually ?
If the latter, I can add such information directly in the “mosaic.dim” file? why BandMaths operator to a new file?
If the former, then HOW to do it? and I notice BandMaths only support one band output, which is inconvenient for multi-band imagery?
You can add the wavelength in the description of the target bands in the BandMaths operator.
The operator supports multiple target bands.
And I think the jp2 images don’t have wavelength information attached. At least I don’t see it when I open the S2 jp2 tile images from the official ESA data. This information is only available when you use the complete product, but get’s lost during mosaic processing. I don’t know the Amazon products.
I would like to ask if I there is a way to set a folder with files to mosaic as input parameter. I want to mosaic 100 tiles or more and it is hard to imagine command with 100 paths to files.
On Linux it should work if you remove the –SsourceProducts parameter and add at the end of the command the path to the files.
gpt ./Mosiac_extent.xml /path/files/*.jp2
i also try to do mosaicing with gpt - how do i add all .tif files in a folder using windows commandline?
If i try *.tif it gives me this error: “Error: Invalid argument”, when i only specify the path to the mosaic files “No product reader found for file [Path]” occurs… any ideas on how to approach this?
For files in this form in windows:
-Pfiles=“F:\_remote_sensing\_backscatter\GLL_0.0025[degree]_slope_intercept\VV\POLYGON ((-2 44\u002C-2 46\u002C0 46\u002C0 44\u002C-2 44))_slope_inter_VV.dim,F:\_remote_sensing\_backscatter\GLL_0.0025[degree]_slope_intercept\VV\POLYGON ((-2 46\u002C-2 48\u002C0 48\u002C0 46\u002C-2 46))_slope_inter_VV.dim,F:\_remote_sensing\_backscatter\GLL_0.0025[degree]_slope_intercept\VV\POLYGON ((-2 48\u002C-2 50\u002C0 50\u002C0 48\u002C-2 48))_slope_inter_VV.dim”
Try this graph interface:
mosaic_stats_graph.xml (1.9 KB)
Should be same for pure snappy since the mosaic OP is using graph as well. Can be more complicated, but I am using the console from python on windows, which should be the same principle. Oh and you need to change the variables in the graph to the names of you bands as well as add BBox coordinates in decimal geogr. coordinates.
Hope it will be somewhat helpful.
Windows is not evaluating the asterisk as Linux does.
You can write a batch script which combines the paths of the products and then calls gpt.
Hi, i’m using gpt (not mosaic but an test.xml graph file) on Linux env . i want to run it on multiple input files so in my input images folder i’m launching the command
opt/snap/bin/gpt /home/dario/test.xml *.hdr
it products only a single output file having default name target.dim
Is there the chance to have one target file every input file keeping the same name?
If you want to process each input product separately you have to iterate over the files on your own in a shell script file.
This wiki page might help you.