@@ -80,12 +80,16 @@ public class IdepixOlciClassificationOp extends Operator {
8080 private boolean outputSchillerNNValue ;
8181
8282 @ Parameter (description = "Alternative NN file. " +
83- "If set, it MUST follow format and input/output as used in default '11x10x4x3x2_207.9.net. " ,
83+ "If set, it MUST follow format and input/output used in default " +
84+ "'class-sequential-i21x42x8x4x2o1-5489.net'. " +
85+ "('11x10x4x3x2_207.9.net' has been default until June 2023.)" ,
8486 label = " Alternative NN file" )
8587 private File alternativeNNFile ;
8688
8789 @ Parameter (description = "Alternative NN thresholds file. " +
88- "If set, it MUST follow format as used in default '11x10x4x3x2_207.9-thresholds.json. " ,
90+ "If set, it MUST follow format used in default " +
91+ "'class-sequential-i21x42x8x4x2o1-5489-thresholds.json'. " +
92+ "('11x10x4x3x2_207.9-thresholds.json' has been default until June 2023.)" ,
8993 label = " Alternative NN thresholds file" )
9094 private File alternativeNNThresholdsFile ;
9195
@@ -123,8 +127,10 @@ public class IdepixOlciClassificationOp extends Operator {
123127 private Band surface13Band ;
124128 private Band trans13Band ;
125129
126- private static final String OLCI_ALL_NET_NAME = "11x10x4x3x2_207.9.net" ;
127- private static final String DEFAULT_NN_THRESHOLDS_FILE = "11x10x4x3x2_207.9-thresholds.json" ;
130+ private static final String OLCI_2018_NET_NAME = "11x10x4x3x2_207.9.net" ;
131+ private static final String OLCI_2018_NN_THRESHOLDS_FILE = "11x10x4x3x2_207.9-thresholds.json" ;
132+ private static final String OLCI_202306_NET_NAME = "class-sequential-i21x42x8x4x2o1-5489.net" ;
133+ private static final String OLCI_202306_NN_THRESHOLDS_FILE = "class-sequential-i21x42x8x4x2o1-5489-thresholds.json" ;
128134
129135 private static final double THRESH_LAND_MINBRIGHT1 = 0.3 ;
130136 private static final double THRESH_LAND_MINBRIGHT2 = 0.25 ; // test OD 20170411
@@ -186,9 +192,11 @@ private void readSchillerNeuralNets() {
186192 }
187193
188194 void readNNThresholds () {
189- try (Reader r = alternativeNNThresholdsFile != null
190- ? new FileReader (alternativeNNThresholdsFile )
191- : new InputStreamReader (getClass ().getResourceAsStream (DEFAULT_NN_THRESHOLDS_FILE ))) {
195+ try (Reader r = alternativeNNThresholdsFile == null
196+ ? new InputStreamReader (getClass ().getResourceAsStream (OLCI_202306_NN_THRESHOLDS_FILE ))
197+ : OLCI_2018_NN_THRESHOLDS_FILE .equals (alternativeNNThresholdsFile .getName ())
198+ ? new InputStreamReader (getClass ().getResourceAsStream (OLCI_2018_NN_THRESHOLDS_FILE ))
199+ : new FileReader (alternativeNNThresholdsFile )) {
192200 Map <String , Object > m = (JSONObject ) JSONValue .parse (r );
193201 for (NNThreshold t : NNThreshold .values ()) {
194202 if (m .containsKey (t .name ())) {
@@ -208,10 +216,12 @@ void readNNThresholds() {
208216 }
209217
210218 private InputStream getNNInputStream () throws IOException {
211- if (alternativeNNFile != null ) {
212- return Files .newInputStream (alternativeNNFile .toPath ());
219+ if (alternativeNNFile == null ) {
220+ return getClass ().getResourceAsStream (OLCI_202306_NET_NAME );
221+ } else if (OLCI_2018_NET_NAME .equals (alternativeNNFile .getName ())) {
222+ return getClass ().getResourceAsStream (OLCI_2018_NET_NAME );
213223 } else {
214- return getClass (). getResourceAsStream ( OLCI_ALL_NET_NAME );
224+ return Files . newInputStream ( alternativeNNFile . toPath () );
215225 }
216226 }
217227
0 commit comments