Graph Builder -> Extraction of subsets from Sentinel-2 granules

My goal is batch processing Sentinel-2 granules so that eventually I end up with

  • subset images
  • containing the RGB information (i.e. bands 4,3,2)
  • in UTM projection
  • with a pixel spacing of 10x10 m.

However, this doesn’t really seem to work as the Graph Builder keeps on telling me that the “Source product contains rasters of different sizes and can not be processed. Please consider resampling it so that all rasters have the same size.”

The awkward thing is that I even used the BandSelect module and chose bands 4,3 and 2, which all have 10m pixel spacing - but the error message remains. I also added a Resampling module, but then I get new error messages, e.g. when using both the Resampling module and an export to GeoTiff: “Product Writer is unable to write this product as GeoTiff: Cannot write multisize products. Consider resampling the products first”.

Long story short: Is there any simple and bug-free way to achieve what I want to do? I figure that Sentinel-2 granules are already UTM-projected, so there is no need for any reprojection. But both for RGB image creation and subsetting, I need a solution. I would even consider adding it to my Python/Snappy-based download routine - if anybody could point me into the right direction how to extract bands and subsets from downloaded products using the API…

There are currently some issues with the graph builder. You can use it to assemble your graph. Ignore the errors the builder produces and save the graph file to disk.
You might need to set some parameters within the graph. In the end, you can run this graph file with gpt. It is a command line tool which is located in the bin folder of your SNAP installation.
Type

gpt -h 

to get some help. There are also some pages in the help system of SNAP Desktop.

Thanks a lot for pointing this out. However, I continue to face problems:
I have installed SNAP 5.0.8 under Ubuntu 16.04 LTS. When I go to /opt/snap/bin and type ls, I see gpt as one of the executables. But when I type gpt -h, I receive a message that the command gpt was not found.

EDIT: One needs to run bash gpt -h, then it works.

1 Like