Skip to content

Commit ebf0a89

Browse files
committed
fixed slstr-s3x-uor reader issue
1 parent 5188b09 commit ebf0a89

File tree

4 files changed

+88
-2
lines changed

4 files changed

+88
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### Updates from version 1.5.6 to 1.5.7
22
* added support for SMOS L1C daily aggregated products
33
* added support for SIC-CCI RRDP insitu data
4+
* Corrected reading bug in slstr-s3x-uor reader
45

56
### Updates from version 1.5.5 to 1.5.6
67
* added support for SLSTR subset data processed by UoR

MMS_Manual_v_1_5.pdf

2.93 KB
Binary file not shown.

core/src/main/java/com/bc/fiduceo/reader/slstr_subset/SlstrRegriddedSubsetReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public Array readRaw(int centerX, int centerY, Interval interval, String variabl
240240
final int mappedX = (int) transform.mapCoordinate_X(centerX);
241241
final int mappedY = (int) transform.mapCoordinate_Y(centerY);
242242

243-
return RawDataReader.read(mappedX, mappedY, interval, fillValue, rawArray, getProductSize());
243+
return RawDataReader.read(mappedX, mappedY, interval, fillValue, rawArray, getProductSize()).copy();
244244
}
245245

246246
@Override
@@ -253,7 +253,7 @@ public Array readScaled(int centerX, int centerY, Interval interval, String vari
253253
final int mappedX = (int) transform.mapCoordinate_X(centerX);
254254
final int mappedY = (int) transform.mapCoordinate_Y(centerY);
255255

256-
return RawDataReader.read(mappedX, mappedY, interval, fillValue, scaledArray, getProductSize());
256+
return RawDataReader.read(mappedX, mappedY, interval, fillValue, scaledArray, getProductSize()).copy();
257257
}
258258

259259
@Override

matchup-tool/src/test/java/com/bc/fiduceo/matchup/MatchupToolIntegrationTest_AVHRR_SLSTR.java

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,58 @@ public void testMatchup_AVHRR_SLSTR_UOR() throws IOException, ParseException, SQ
9292
}
9393
}
9494

95+
@Test
96+
public void testMatchup_AVHRR_SLSTR_UOR_coo6() throws IOException, ParseException, SQLException, InvalidRangeException {
97+
final UseCaseConfig useCaseConfig = createUseCaseConfigBuilder_coo06()
98+
.withTimeDeltaSeconds(7200, null)
99+
.withMaxPixelDistanceKm(1.f, null)
100+
.withBorderDistance(4, 4)
101+
.withOverlapRemoval("PRIMARY")
102+
.withPixelPosition("PRIMARY", 548, 1448, -1, -1)
103+
.withPixelValueScreening("S8_BT_in > 260.0", null)
104+
.withRandomPointsPerDay(2400000, "INV_TRUNC_COSINE_LAT")
105+
.withTestRun() // we need that to always have the same random sequence, else we cannot run assertions tb 2022-12-14
106+
.createConfig();
107+
final File useCaseConfigFile = storeUseCaseConfig(useCaseConfig, "usecase-avhrr-slstr.xml");
108+
109+
insert_AVHRR_FRAC_MC_coo06();
110+
insert_SLSTR_UOR_coo06();
111+
112+
final String[] args = new String[]{"-c", configDir.getAbsolutePath(), "-u", useCaseConfigFile.getName(), "-start", "2020-084", "-end", "2020-085"};
113+
MatchupToolMain.main(args);
114+
115+
final File mmdFile = getMmdFilePath(useCaseConfig, "2020-084", "2020-085");
116+
assertTrue(mmdFile.isFile());
117+
118+
try (NetcdfFile mmd = NetcdfFile.open(mmdFile.getAbsolutePath())) {
119+
final int matchupCount = NetCDFUtils.getDimensionLength(FiduceoConstants.MATCHUP_COUNT, mmd);
120+
assertEquals(2, matchupCount);
121+
122+
NCTestUtils.assert3DVariable("slstr-s3a-uor_S2_radiance_in", 0, 0, 0, -32768, mmd);
123+
NCTestUtils.assert3DVariable("slstr-s3a-uor_S8_BT_in", 1, 0, 1, -489, mmd);
124+
NCTestUtils.assert3DVariable("slstr-s3a-uor_acquisition_time", 2, 0, 0, 1585094546, mmd);
125+
NCTestUtils.assert3DVariable("slstr-s3a-uor_S9_exception_in", 3, 0, 1, 0, mmd);
126+
NCTestUtils.assert3DVariable("slstr-s3a-uor_cloud_in", 4, 0, 0, 6720, mmd);
127+
NCTestUtils.assert3DVariable("slstr-s3a-uor_detector_io", 5, 0, 1, 0, mmd);
128+
NCTestUtils.assert3DVariable("slstr-s3a-uor_latitude_in", 6, 0, 0, 44083570, mmd);
129+
NCTestUtils.assert3DVariable("slstr-s3a-uor_longitude_in", 0, 1, 1, -35702362, mmd);
130+
NCTestUtils.assert3DVariable("slstr-s3a-uor_solar_azimuth_tn", 1, 1, 0, 315.4619750972859, mmd);
131+
NCTestUtils.assert3DVariable("slstr-s3a-uor_solar_azimuth_to", 2, 1, 1, 315.61679013351716, mmd);
132+
133+
NCTestUtils.assert3DVariable("avhrr-frac-mc_acquisition_time", 3, 1, 0, 1585088512, mmd);
134+
NCTestUtils.assert3DVariable("avhrr-frac-mc_cloudFlag", 4, 1, 0, 0, mmd);
135+
NCTestUtils.assert3DVariable("avhrr-frac-mc_delta_azimuth", 5, 1, 1, -51.33234405517578, mmd);
136+
NCTestUtils.assert3DVariable("avhrr-frac-mc_flags", 6, 1, 0, 0, mmd);
137+
NCTestUtils.assert3DVariable("avhrr-frac-mc_latitude", 0, 2, 1, 45.60192108154297, mmd);
138+
NCTestUtils.assert3DVariable("avhrr-frac-mc_longitude", 1, 2, 0, -34.61174392700195, mmd);
139+
NCTestUtils.assert3DVariable("avhrr-frac-mc_radiance_1", 2, 2, 1, -0.10135757923126221, mmd);
140+
NCTestUtils.assert3DVariable("avhrr-frac-mc_radiance_2", 3, 2, 0, 0.007804560009390116, mmd);
141+
NCTestUtils.assert3DVariable("avhrr-frac-mc_radiance_3a", 4, 2, 1, 0.0, mmd);
142+
NCTestUtils.assert3DVariable("avhrr-frac-mc_radiance_4", 5, 2, 0, 73.82252502441406, mmd);
143+
NCTestUtils.assert3DVariable("avhrr-frac-mc_radiance_5", 6, 2, 1, 97.5717544555664, mmd);
144+
}
145+
}
146+
95147
private void insert_SLSTR_UOR() throws IOException, SQLException {
96148
final String sensorKey = "slstr-s3a-uor";
97149
final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{sensorKey, "1.0", "2020", "05", "22", "S3A_SL_1_RBT____20200522T231202_20200522T231502_20200524T053503_0179_058_286_5580_LN2_O_NT_004.SEN3"}, true);
@@ -100,6 +152,14 @@ private void insert_SLSTR_UOR() throws IOException, SQLException {
100152
storage.insert(satelliteObservation);
101153
}
102154

155+
private void insert_SLSTR_UOR_coo06() throws IOException, SQLException {
156+
final String sensorKey = "slstr-s3a-uor";
157+
final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{sensorKey, "1.0", "2020", "03", "25", "S3A_SL_1_RBT____20200325T000151_20200325T000451_20200326T054139_0179_056_216_0720_LN2_O_NT_004.zip"}, true);
158+
159+
final SatelliteObservation satelliteObservation = readSatelliteObservation(sensorKey, relativeArchivePath, "1.0");
160+
storage.insert(satelliteObservation);
161+
}
162+
103163
private void insert_AVHRR_FRAC_MC() throws IOException, SQLException {
104164
final String sensorKey = "avhrr-frac-mc";
105165
final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{sensorKey, "v1", "2020", "05", "22", "NSS.FRAC.M3.D20143.S2148.E2331.B0799798.SV"}, true);
@@ -108,6 +168,31 @@ private void insert_AVHRR_FRAC_MC() throws IOException, SQLException {
108168
storage.insert(satelliteObservation);
109169
}
110170

171+
private void insert_AVHRR_FRAC_MC_coo06() throws IOException, SQLException {
172+
final String sensorKey = "avhrr-frac-mc";
173+
final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{sensorKey, "v1", "2020", "03", "24", "NSS.FRAC.M3.D20084.S2209.E2352.B0715960.SV"}, true);
174+
175+
final SatelliteObservation satelliteObservation = readSatelliteObservation(sensorKey, relativeArchivePath, "v1");
176+
storage.insert(satelliteObservation);
177+
}
178+
179+
private MatchupToolTestUseCaseConfigBuilder createUseCaseConfigBuilder_coo06() {
180+
final List<Sensor> sensorList = new ArrayList<>();
181+
final Sensor primary = new Sensor("slstr-s3a-uor");
182+
primary.setPrimary(true);
183+
sensorList.add(primary);
184+
sensorList.add(new Sensor("avhrr-frac-mc"));
185+
186+
final List<com.bc.fiduceo.core.Dimension> dimensions = new ArrayList<>();
187+
dimensions.add(new com.bc.fiduceo.core.Dimension("avhrr-frac-mc", 7, 7));
188+
dimensions.add(new com.bc.fiduceo.core.Dimension("slstr-s3a-uor", 7, 7));
189+
190+
return (MatchupToolTestUseCaseConfigBuilder) new MatchupToolTestUseCaseConfigBuilder("coo06")
191+
.withSensors(sensorList)
192+
.withOutputPath(new File(TestUtil.getTestDir().getPath(), "coo06-avhrr-slstr").getPath())
193+
.withDimensions(dimensions);
194+
}
195+
111196
private MatchupToolTestUseCaseConfigBuilder createUseCaseConfigBuilder() {
112197
final List<Sensor> sensorList = new ArrayList<>();
113198
final Sensor primary = new Sensor("avhrr-frac-mc");

0 commit comments

Comments
 (0)