I s2resampled Sentinel-2 MSI L1C to 10m and subsetted with a lake polygon shape, then I ran idepix.S2 operator and merged with ‘IDEPIX_CLOUD or IDEPIX_CLOUD_SHADOW’ expression to convert the clouds and cloud shadows masks as a whole and outputed (saved) th disk. The question is how to import ( assmble) this cloud_and_shadow(combined) band into the subsetted product with Python? In the next c2rcc.msi operator step the pixelwise cloud_and shadow information will be used when setting validPixelExpression.
Great thanks!
You can either use the BandMaths operator or the Merge operator.
But it is also possible to simply use the snappy API.
source = snappy.ProductIO.readProduct(“path1.dim”)
target = snappy.ProductIO.readProduct(“path2.dim”)
snappy.ProductUtils.copyBand("bandName", source, target, True)
snappy.ProductIO.writeProduct(target, “path3.dim”, "BEAM-DIMAP")