Skip to content

Commit bd0db16

Browse files
committed
AVHRR MetOpC - intermediate
1 parent b2d5c6d commit bd0db16

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

core/src/main/java/com/bc/fiduceo/reader/avhrr_frac/AVHRR_FRAC_Reader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
public class AVHRR_FRAC_Reader extends SNAP_Reader {
2929

30-
private static final String REG_EX = "NSS.FRAC.M([12]).D\\d{5}.S\\d{4}.E\\d{4}.B\\d{7}.[A-Z]{2,2}(.gz){0,1}";
30+
private static final String REG_EX = "NSS.FRAC.M([123]).D\\d{5}.S\\d{4}.E\\d{4}.B\\d{7}.[A-Z]{2,2}(.gz){0,1}";
3131
private static final Interval INTERVAL = new Interval(5, 20);
3232
private static final int NUM_SPLITS = 2;
3333
private final ReaderContext readerContext;

core/src/main/java/com/bc/fiduceo/reader/avhrr_frac/AVHRR_FRAC_ReaderPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class AVHRR_FRAC_ReaderPlugin implements ReaderPlugin {
99

10-
private static final String[] SENSOR_KEYS = {"avhrr-frac-ma", "avhrr-frac-mb"};
10+
private static final String[] SENSOR_KEYS = {"avhrr-frac-ma", "avhrr-frac-mb", "avhrr-frac-mc"};
1111

1212
@Override
1313
public Reader createReader(ReaderContext readerContext) {

core/src/test/java/com/bc/fiduceo/reader/avhrr_frac/AVHRR_FRAC_ReaderPluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void testGetDataType() {
3434

3535
@Test
3636
public void testGetSupportedSensorKeys(){
37-
final String[] expected = {"avhrr-frac-ma", "avhrr-frac-mb"};
37+
final String[] expected = {"avhrr-frac-ma", "avhrr-frac-mb", "avhrr-frac-mc"};
3838
final String[] keys = plugin.getSupportedSensorKeys();
3939

4040
assertArrayEquals(expected, keys);

core/src/test/java/com/bc/fiduceo/reader/avhrr_frac/AVHRR_FRAC_ReaderTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void setUp() {
2222

2323
@Test
2424
public void testGetRegEx() {
25-
final String expected = "NSS.FRAC.M([12]).D\\d{5}.S\\d{4}.E\\d{4}.B\\d{7}.[A-Z]{2,2}(.gz){0,1}";
25+
final String expected = "NSS.FRAC.M([123]).D\\d{5}.S\\d{4}.E\\d{4}.B\\d{7}.[A-Z]{2,2}(.gz){0,1}";
2626

2727
assertEquals(expected, reader.getRegEx());
2828

@@ -46,6 +46,9 @@ public void testGetRegEx() {
4646
matcher = pattern.matcher("NSS.FRAC.M1.D19254.S0220.E0319.B3621920.SV");
4747
assertTrue(matcher.matches());
4848

49+
matcher = pattern.matcher("NSS.FRAC.M3.D19261.S1708.E1849.B0448586.SV");
50+
assertTrue(matcher.matches());
51+
4952
matcher = pattern.matcher("AT2_TOA_1PURAL19980424_055754_000000001031_00348_15733_0000.OT");
5053
assertFalse(matcher.matches());
5154

core/src/test/java/com/bc/fiduceo/reader/avhrr_frac/AVHRR_FRAC_Reader_IO_Test.java

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ public void testReadAcquisitionInfo_MB() throws IOException {
124124
assertTrue(boundingGeometry instanceof Polygon);
125125
final Polygon polygon = (Polygon) boundingGeometry;
126126

127-
System.out.println(GeometryUtil.toPointListWkt(polygon));
128-
129127
final Point[] coordinates = polygon.getCoordinates();
130128
assertEquals(75, coordinates.length);
131129
assertEquals(59.658199310302734, coordinates[0].getLon(), 1e-8);
@@ -187,6 +185,48 @@ public void testReadAcquisitionInfo_MA_GZ() throws IOException {
187185
}
188186
}
189187

188+
@Test
189+
public void testReadAcquisitionInfo_MC() throws IOException {
190+
final File file = getAvhrrFRAC_MC_File();
191+
192+
try {
193+
reader.open(file);
194+
195+
final AcquisitionInfo acquisitionInfo = reader.read();
196+
assertNotNull(acquisitionInfo);
197+
198+
final Date sensingStart = acquisitionInfo.getSensingStart();
199+
TestUtil.assertCorrectUTCDate(2019, 9, 11, 2, 20, 46, sensingStart);
200+
201+
final Date sensingStop = acquisitionInfo.getSensingStop();
202+
TestUtil.assertCorrectUTCDate(2019, 9, 11, 3, 19, 28, sensingStop);
203+
204+
final NodeType nodeType = acquisitionInfo.getNodeType();
205+
assertEquals(NodeType.UNDEFINED, nodeType);
206+
207+
final Geometry boundingGeometry = acquisitionInfo.getBoundingGeometry();
208+
assertNotNull(boundingGeometry);
209+
assertTrue(boundingGeometry instanceof Polygon);
210+
final Polygon polygon = (Polygon) boundingGeometry;
211+
212+
final Point[] coordinates = polygon.getCoordinates();
213+
assertEquals(75, coordinates.length);
214+
assertEquals(59.658199310302734, coordinates[0].getLon(), 1e-8);
215+
assertEquals(-61.54189682006836, coordinates[0].getLat(), 1e-8);
216+
217+
assertEquals(99.13909912109376, coordinates[28].getLon(), 1e-8);
218+
assertEquals(80.86370086669922, coordinates[28].getLat(), 1e-8);
219+
220+
final TimeAxis[] timeAxes = acquisitionInfo.getTimeAxes();
221+
assertEquals(1, timeAxes.length);
222+
223+
Date time = timeAxes[0].getTime(coordinates[0]);
224+
TestUtil.assertCorrectUTCDate(2019, 9, 11, 2, 20, 46, time);
225+
} finally {
226+
reader.close();
227+
}
228+
}
229+
190230
@Test
191231
public void testGetTimeLocator_MA() throws IOException {
192232
final File file = getAvhrrFRAC_MA_File();
@@ -782,4 +822,9 @@ private File getAvhrrFRAC_MA_GZ_File() throws IOException {
782822
final String testFilePath = TestUtil.assembleFileSystemPath(new String[]{"avhrr-frac-ma", "v1", "2014", "11", "09", "NSS.FRAC.M1.D14313.S1746.E1837.B1112525.MM.gz"}, false);
783823
return TestUtil.getTestDataFileAsserted(testFilePath);
784824
}
825+
826+
private File getAvhrrFRAC_MC_File() throws IOException {
827+
final String testFilePath = TestUtil.assembleFileSystemPath(new String[]{"avhrr-frac-mc", "v1", "2019", "09", "18", "NSS.FRAC.M3.D19261.S1708.E1849.B0448586.SV"}, false);
828+
return TestUtil.getTestDataFileAsserted(testFilePath);
829+
}
785830
}

0 commit comments

Comments
 (0)