Hi,
I’ve just noticed that the ProductSubsetBuilder does not support multi-size products well. The API can be improved.
When specifying a pixel region all bands of a Sentinel-2 products have the same size. I would actually expect that the scene dimension is used as reference and all bands are subsetted accordingly.
ProductSubset.setRegion() and ProductSubset.setSubsetRegion() do not work as expected.
I must call ProductSubsetDef.setRegionMap() and define the regions for each band myself. I think this should be done by default. The generation of this map is implemented in SubsetOp.computeRegionMap(…).
I’ve noticed this by using Product.createSubset(…).
It is easier to use the Subset operator directly.
Map<String, Object> parameters = Map.of("referenceBand", referenceBand, "region", pixelRegion, "copyMetadata", true);
GPF.createProduct("Subset", parameters, source);