@@ -45,9 +45,6 @@ public class OlciSlstrClassificationOp extends Operator {
4545 @ SourceProduct (alias = "reflOlci" )
4646 private Product olciRad2reflProduct ;
4747
48- @ SourceProduct (alias = "reflSlstr" )
49- private Product slstrRad2reflProduct ;
50-
5148 @ SourceProduct (alias = "waterMask" )
5249 private Product waterMaskProduct ;
5350
@@ -58,11 +55,9 @@ public class OlciSlstrClassificationOp extends Operator {
5855 Band cloudFlagBand ;
5956
6057 private Band [] olciReflBands ;
61- private Band [] slstrReflBands ;
6258
6359 private Band landWaterBand ;
6460
65- // public static final String OLCISLSTR_ALL_NET_NAME = "11x9x6x4x3x2_57.8.net";
6661 public static final String OLCISLSTR_ALL_NET_NAME = "11x10x4x3x2_207.9.net" ;
6762
6863 private static final double THRESH_LAND_MINBRIGHT1 = 0.3 ;
@@ -94,16 +89,6 @@ public void setBands() {
9489 olciReflBands [i ] = olciRad2reflProduct .getBand (reflBandname + "_reflectance" );
9590 }
9691
97- // e.g. S4_reflectance_an
98- //make sure that these are all *_an bands, as the NN uses only these
99- slstrReflBands = new Band [OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES .length ];
100- for (int i = 0 ; i < OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES .length ; i ++) {
101- final int suffixStart = OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES [i ].indexOf ("_" );
102- final String reflBandname = OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES [i ].substring (0 , suffixStart );
103- final int length = OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES [i ].length ();
104- slstrReflBands [i ] = slstrRad2reflProduct .getBand (reflBandname + "_reflectance_an" );
105- }
106-
10792 landWaterBand = waterMaskProduct .getBand ("land_water_fraction" );
10893 }
10994
@@ -124,7 +109,7 @@ void createTargetProduct() throws OperatorException {
124109 ProductUtils .copyGeoCoding (sourceProduct , targetProduct );
125110 targetProduct .setStartTime (sourceProduct .getStartTime ());
126111 targetProduct .setEndTime (sourceProduct .getEndTime ());
127- ProductUtils .copyMetadata (sourceProduct , targetProduct );
112+ // ProductUtils.copyMetadata(sourceProduct, targetProduct);
128113
129114 if (outputSchillerNNValue ) {
130115 final Band nnValueBand = targetProduct .addBand (IdepixConstants .NN_OUTPUT_BAND_NAME , ProductData .TYPE_FLOAT32 );
@@ -141,18 +126,15 @@ public void computeTileStack(Map<Band, Tile> targetTiles, Rectangle rectangle, P
141126 final Band olciQualityFlagBand = sourceProduct .getBand (OlciSlstrConstants .OLCI_QUALITY_FLAGS_BAND_NAME );
142127 final Tile olciQualityFlagTile = getSourceTile (olciQualityFlagBand , rectangle );
143128
129+ final Band slstrCloudAnFlagBand = sourceProduct .getBand (OlciSlstrConstants .SLSTR_CLOUD_AN_FLAG_BAND_NAME );
130+ final Tile slstrCloudAnFlagTile = getSourceTile (slstrCloudAnFlagBand , rectangle );
131+
144132 Tile [] olciReflectanceTiles = new Tile [Rad2ReflConstants .OLCI_REFL_BAND_NAMES .length ];
145133 float [] olciReflectance = new float [Rad2ReflConstants .OLCI_REFL_BAND_NAMES .length ];
146134 for (int i = 0 ; i < Rad2ReflConstants .OLCI_REFL_BAND_NAMES .length ; i ++) {
147135 olciReflectanceTiles [i ] = getSourceTile (olciReflBands [i ], rectangle );
148136 }
149137
150- Tile [] slstrReflectanceTiles = new Tile [OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES .length ];
151- float [] slstrReflectance = new float [OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES .length ];
152- for (int i = 0 ; i < OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES .length ; i ++) {
153- slstrReflectanceTiles [i ] = getSourceTile (slstrReflBands [i ], rectangle );
154- }
155-
156138 final Band cloudFlagTargetBand = targetProduct .getBand (IdepixConstants .CLASSIF_BAND_NAME );
157139 final Tile cloudFlagTargetTile = targetTiles .get (cloudFlagTargetBand );
158140
@@ -177,24 +159,18 @@ public void computeTileStack(Map<Band, Tile> targetTiles, Rectangle rectangle, P
177159 olciReflectance [i ] = olciReflectanceTiles [i ].getSampleFloat (x , y );
178160 }
179161
180- for (int i = 0 ; i < OlciSlstrConstants .SLSTR_REFL_AN_BAND_NAMES .length ; i ++) {
181- slstrReflectance [i ] = slstrReflectanceTiles [i ].getSampleFloat (x , y );
182- }
183-
184162 final boolean l1Invalid = olciQualityFlagTile .getSampleBit (x , y , OlciSlstrConstants .L1_F_INVALID );
185163 boolean reflectancesValid = IdepixIO .areAllReflectancesValid (olciReflectance );
186- reflectancesValid &= IdepixIO .areAllReflectancesValid (slstrReflectance );
187164 cloudFlagTargetTile .setSample (x , y , IdepixConstants .IDEPIX_INVALID , l1Invalid || !reflectancesValid );
188165
166+ final boolean isSlstrCloudAn137Thresh =
167+ slstrCloudAnFlagTile .getSampleBit (x , y , OlciSlstrConstants .CLOUD_AN_F_137_THRESH );
168+ final boolean isSlstrCloudAnGrossCloud =
169+ slstrCloudAnFlagTile .getSampleBit (x , y , OlciSlstrConstants .CLOUD_AN_F_GROSS_CLOUD );
170+
189171 if (reflectancesValid ) {
190172 SchillerNeuralNetWrapper nnWrapper = olciSlstrAllNeuralNet .get ();
191173 double [] inputVector = nnWrapper .getInputVector ();
192- // for (int i = 0; i < inputVector.length - 6; i++) {
193- // inputVector[i] = Math.sqrt(olciReflectance[i]);
194- // }
195- // for (int i = inputVector.length - slstrReflectance.length; i < inputVector.length; i++) {
196- // inputVector[i] = Math.sqrt(slstrReflectance[i - olciReflectance.length]);
197- // }
198174 // use OLCI net instead of OLCI/SLSTR net:
199175 for (int i = 0 ; i < inputVector .length ; i ++) {
200176 inputVector [i ] = Math .sqrt (olciReflectance [i ]);
@@ -216,7 +192,11 @@ public void computeTileStack(Map<Band, Tile> targetTiles, Rectangle rectangle, P
216192
217193 cloudFlagTargetTile .setSample (x , y , IdepixConstants .IDEPIX_CLOUD_AMBIGUOUS , cloudAmbiguous );
218194 cloudFlagTargetTile .setSample (x , y , IdepixConstants .IDEPIX_CLOUD_SURE , cloudSure );
195+ // request RQ, GK, 20220111:
196+ final boolean isSynCloud = cloudAmbiguous || cloudSure || isSlstrCloudAn137Thresh ||
197+ isSlstrCloudAnGrossCloud ;
219198 cloudFlagTargetTile .setSample (x , y , IdepixConstants .IDEPIX_CLOUD , cloudAmbiguous || cloudSure );
199+ cloudFlagTargetTile .setSample (x , y , IdepixConstants .IDEPIX_CLOUD , isSynCloud );
220200 cloudFlagTargetTile .setSample (x , y , IdepixConstants .IDEPIX_SNOW_ICE , nnInterpreter .isSnowIce (nnOutput ));
221201 }
222202
0 commit comments