Is there a minimum size for the specified window, either in pixels or in geographic coordinates, when creating a subset?
I’ve been working with Sentinel-2 L1C images, trying to make subscenes of various sizes. I’ve found that, if the subscene is too small, the operation returns with error, either on SNAP GUI or using Snappy.
Any clues on why that would happen? For my particular case, and using S-2 Band 1 as reference, the minimum window turns out to be of 35x57 pixels:
The workaround I’ve found around the issue is to increase the AOI rectangle and try again, until eventually the error does not take place:
The point when the error dissapears is not directly linked to the AOI area, and so maybe it has something to do with its aspect proportions?
The happens due to the multi-resolution characteristics of Sentinel-2.
This bug is known since a while but not fixed yet.
You can work around this issue by first resampling the product to a common resolution and do the subsetting afterwards.
A workaround I found was to first subset the area with a Shapefile that is bigger than the subset you’re using here (Done with LandSeaMask). This creates a smaller raster, that you can then subset as small as you want using the Subset tool.
This is more of a lengthy work-around, but it fixed the issue for me.
Thanks for your reply.
I did try to search through the source code in Github where the ‘invalid region’ Illegal Argument Exception was thrown, to understand what would trigger it, but did not find the location.
Yes, I think that, once all bands have the same resolution, the minimum subset bug no longer takes place. Thanks!