Skip to content

Commit 8291ca5

Browse files
default OLCI classification NN exchanged to better discriminate cloud from lake ice
1 parent 0352597 commit 8291ca5

File tree

4 files changed

+1743
-11
lines changed

4 files changed

+1743
-11
lines changed

idepix-olci/src/main/java/org/esa/snap/idepix/olci/IdepixOlciClassificationOp.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"CLEAR_SNOW_ICE_BOUNDS": [0.0, 1.68],
3+
"OPAQUE_CLOUD_BOUNDS": [1.68, 2.37],
4+
"SEMI_TRANS_CLOUD_BOUNDS": [2.37, 3.60],
5+
"SPATIAL_MIXED_BOUNDS_LAND": [3.60, 4.79],
6+
"SPATIAL_MIXED_BOUNDS_WATER_GLINT": [3.60, 3.60],
7+
"SPATIAL_MIXED_BOUNDS_WATER_NOGLINT": [3.60, 4.2],
8+
"CLEAR_LAND_BOUNDS": [4.79, 5.16],
9+
"CLEAR_WATER_BOUNDS": [5.16, 6.00]
10+
}

0 commit comments

Comments
 (0)