@@ -55,12 +55,12 @@ public class S2IdepixCloudPostProcessOp extends Operator {
5555 public void initialize () throws OperatorException {
5656
5757 Product cloudBufferProduct = createTargetProduct (classifiedProduct ,
58- classifiedProduct .getName (),
59- classifiedProduct .getProductType ());
58+ classifiedProduct .getName (),
59+ classifiedProduct .getProductType ());
6060
6161 rectCalculator = new RectangleExtender (new Rectangle (classifiedProduct .getSceneRasterWidth (),
62- classifiedProduct .getSceneRasterHeight ()),
63- cloudBufferWidth , cloudBufferWidth );
62+ classifiedProduct .getSceneRasterHeight ()),
63+ cloudBufferWidth , cloudBufferWidth );
6464
6565 origClassifFlagBand = classifiedProduct .getBand (IDEPIX_CLASSIF_FLAGS );
6666 ProductUtils .copyBand (IDEPIX_CLASSIF_FLAGS , classifiedProduct , cloudBufferProduct , false );
@@ -95,22 +95,21 @@ public void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm) th
9595 checkForCancellation ();
9696 for (int x = srcRectangle .x ; x < srcRectangle .x + srcRectangle .width ; x ++) {
9797
98- boolean isCloud ;
98+ Tile workTile ;
9999 if (targetRectangle .contains (x , y )) {
100- S2IdepixUtils .combineFlags (x , y , sourceFlagTile , targetTile );
101- coastalCloudDistinction .correctCloudFlag (x , y , targetTile , targetTile );
102- urbanCloudDistinction .correctCloudFlag (x , y , targetTile , targetTile );
103- isCloud = isCloudPixel (targetTile , y , x );
104- } else {
105- isCloud = isCloudPixel (sourceFlagTile , y , x );
100+ workTile = S2IdepixUtils .combineFlags (x , y , sourceFlagTile , targetTile ); // overlap area of extended source tile
101+ }else {
102+ workTile = sourceFlagTile ;
106103 }
104+ coastalCloudDistinction .correctCloudFlag (x , y , workTile , workTile );
105+ urbanCloudDistinction .correctCloudFlag (x , y , workTile , workTile );
107106
108- if (isCloud ) {
107+ if (isCloudPixel ( workTile , x , y ) ) {
109108 S2IdepixCloudBuffer .computeSimpleCloudBuffer (x , y ,
110- targetTile ,
111- srcRectangle ,
112- cloudBufferWidth ,
113- IDEPIX_CLOUD_BUFFER );
109+ targetTile ,
110+ srcRectangle ,
111+ cloudBufferWidth ,
112+ IDEPIX_CLOUD_BUFFER );
114113 }
115114 }
116115 }
@@ -123,9 +122,8 @@ public void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm) th
123122 }
124123 }
125124
126- private boolean isCloudPixel (Tile targetTile , int y , int x ) {
127- boolean isCloud ;
128- isCloud = targetTile .getSampleBit (x , y , IDEPIX_CLOUD_SURE );
125+ private boolean isCloudPixel (Tile targetTile , int x , int y ) {
126+ boolean isCloud = targetTile .getSampleBit (x , y , IDEPIX_CLOUD_SURE );
129127 if (computeCloudBufferForCloudAmbiguous ) {
130128 isCloud = isCloud || targetTile .getSampleBit (x , y , IDEPIX_CLOUD_AMBIGUOUS );
131129 }
0 commit comments