Batch processing using multiple rois


Has anybody tried to use multiple roi’s in batch processing? I would like to resample S2 data, then subset the data and then use Idepix. I have tried to used idepix only, but is too memory consuming and my computer is not able to do that (even in command line and with separate processes). My idea, for example, firstly, create txt file, where every roi is defined by its own limits and satellite image path is defined in separate column. And then using the info in the txt file in batch processing. Is it possible to do it and how?

name, roi limits, image path
roi1, (58.1,57.1,27.3,28.3), /S2B_MSIL1Cdate1*:SAFE
roi1, (58.1,57.1,27.3,28.3), /S2B_MSIL1Cdate2*:SAFE
roi2, (59.1,52.1,26.3,27.3), /S2B_MSIL!Cdate1*:SAFE

Thank you in advance

You can set up a graph, which reads one S2 product and then you add for each ROI one subset operation and afterwards you do IdePix. In this case the number of rois is not dynamic.
You could store all the ROIs in a properties file if you like and use this properties file along with the graph.

A more dynamic approach could be done to set up a straight graph read-subset-idepix-write and in a batch script the read the ROIs from a file or define them within the scrip and then use them as parameter for the command line call of gpt.

Thank you for your answer!

But I am still having trouble with subsetting in cmd.

Error: [NodeId: Subset] Operator ‘SubsetOp’: The geometry could not be parsed.

How the region should be written in the properties file? (459 Bytes)
snap_resample_subset_idepix.xml (1.5 KB)

1 Like

There are a few issues with your files.

  1. The you need to remove the curly brackets. Wikipedia provides a good explanation on the format.
    Well-known text representation of geometry - Wikipedia
  2. The coordinates need to be lat/lon WGS84. I think you provide UTM coordinates.
  3. The ROIs need to be named differently. Currently both are nemd ‘geoRegion’. Name them roi1, roi2 and so on.
  4. If you only want to use one command line call, without a script, you need to add multiple subset nodes to the XML. One for each ROI.
  5. In the xml you can then use the rois from the properties file like this
  6. You also need to add additional Idepix and Write nodes.
    Here I did something similar: Split product bandwise into single GeoTiff files - GPF Graphs - STEP Forum (