Skip to content

Commit c8b059d

Browse files
committed
implemented AVHRR FRAC MetOp C support
1 parent eba2001 commit c8b059d

File tree

3 files changed

+110
-23
lines changed

3 files changed

+110
-23
lines changed

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
### Updates from version 1.5.2 to 1.5.3
2-
* updated to use SNAP version 8.0.2
2+
* updated to use SNAP version 8.0.3
33
* added random string to SLSTR uncompressed temp directory
44
* updated workflow handling to new PMonitor version
55
* updated random seed strategy: keeps on iterating after IOException
66
* update MxD021km reader - split vector based attributes to channel layer
7+
* added support for AVHRR FRAC MetOp-C L1b
8+
* added post-processing to add ERA-5 NWP data
79

810
### Updates from version 1.5.1 to 1.5.2
911
* updated to use SNAP version 8.0-SNAPSHOT

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

Lines changed: 102 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import com.bc.fiduceo.reader.time.TimeLocator;
1414
import com.bc.fiduceo.util.TempFileUtils;
1515
import org.junit.Before;
16-
import org.junit.Ignore;
1716
import org.junit.Test;
1817
import org.junit.runner.RunWith;
1918
import ucar.ma2.Array;
@@ -187,45 +186,66 @@ public void testReadAcquisitionInfo_MA_GZ() throws IOException {
187186
}
188187

189188
@Test
190-
@Ignore
191189
public void testReadAcquisitionInfo_MC() throws IOException {
192190
final File file = getAvhrrFRAC_MC_File();
193191

194-
// @todo 1 tb/tb continue here
195-
196192
try {
197193
reader.open(file);
198194

199195
final AcquisitionInfo acquisitionInfo = reader.read();
200196
assertNotNull(acquisitionInfo);
201197

202198
final Date sensingStart = acquisitionInfo.getSensingStart();
203-
TestUtil.assertCorrectUTCDate(2019, 9, 11, 2, 20, 46, sensingStart);
199+
TestUtil.assertCorrectUTCDate(2019, 9, 18, 17, 8, 2, sensingStart);
204200

205201
final Date sensingStop = acquisitionInfo.getSensingStop();
206-
TestUtil.assertCorrectUTCDate(2019, 9, 11, 3, 19, 28, sensingStop);
202+
TestUtil.assertCorrectUTCDate(2019, 9, 18, 18, 49, 39, sensingStop);
207203

208204
final NodeType nodeType = acquisitionInfo.getNodeType();
209205
assertEquals(NodeType.UNDEFINED, nodeType);
210206

211207
final Geometry boundingGeometry = acquisitionInfo.getBoundingGeometry();
212208
assertNotNull(boundingGeometry);
213-
assertTrue(boundingGeometry instanceof Polygon);
214-
final Polygon polygon = (Polygon) boundingGeometry;
209+
assertTrue(boundingGeometry instanceof MultiPolygon);
210+
final MultiPolygon multiPolygon = (MultiPolygon) boundingGeometry;
215211

216-
final Point[] coordinates = polygon.getCoordinates();
217-
assertEquals(75, coordinates.length);
218-
assertEquals(59.658199310302734, coordinates[0].getLon(), 1e-8);
219-
assertEquals(-61.54189682006836, coordinates[0].getLat(), 1e-8);
212+
final List<Polygon> polygons = multiPolygon.getPolygons();
213+
assertEquals(2, polygons.size());
220214

221-
assertEquals(99.13909912109376, coordinates[28].getLon(), 1e-8);
222-
assertEquals(80.86370086669922, coordinates[28].getLat(), 1e-8);
215+
Polygon polygon = polygons.get(0);
216+
Point[] coordinates = polygon.getCoordinates();
217+
assertEquals(67, coordinates.length);
218+
assertEquals(-32.34819793701172, coordinates[0].getLon(), 1e-8);
219+
assertEquals(68.38959503173828, coordinates[0].getLat(), 1e-8);
220+
221+
assertEquals(118.37899780273439, coordinates[35].getLon(), 1e-8);
222+
assertEquals(-66.94749450683594, coordinates[35].getLat(), 1e-8);
223+
224+
assertEquals(9.459699630737305, coordinates[58].getLon(), 1e-8);
225+
assertEquals(82.74839782714844, coordinates[58].getLat(), 1e-8);
226+
227+
polygon = polygons.get(1);
228+
coordinates = polygon.getCoordinates();
229+
assertEquals(67, coordinates.length);
230+
assertEquals(-96.81669616699219, coordinates[0].getLon(), 1e-8);
231+
assertEquals(-82.56119537353516, coordinates[0].getLat(), 1e-8);
232+
233+
assertEquals(93.87649536132814, coordinates[33].getLon(), 1e-8);
234+
assertEquals(82.41559600830078, coordinates[33].getLat(), 1e-8);
235+
236+
assertEquals(-179.3227996826172, coordinates[61].getLon(), 1e-8);
237+
assertEquals(-79.1001968383789, coordinates[61].getLat(), 1e-8);
223238

224239
final TimeAxis[] timeAxes = acquisitionInfo.getTimeAxes();
225-
assertEquals(1, timeAxes.length);
240+
assertEquals(2, timeAxes.length);
226241

227-
Date time = timeAxes[0].getTime(coordinates[0]);
228-
TestUtil.assertCorrectUTCDate(2019, 9, 11, 2, 20, 46, time);
242+
polygon = polygons.get(0);
243+
Date time = timeAxes[0].getTime(polygon.getCoordinates()[0]);
244+
TestUtil.assertCorrectUTCDate(2019, 9, 18, 17, 8, 2, time);
245+
246+
polygon = polygons.get(1);
247+
time = timeAxes[1].getTime(polygon.getCoordinates()[0]);
248+
TestUtil.assertCorrectUTCDate(2019, 9, 18, 17, 58, 53, time);
229249
} finally {
230250
reader.close();
231251
}
@@ -271,6 +291,26 @@ public void testGetTimeLocator_MB() throws IOException {
271291
}
272292
}
273293

294+
@Test
295+
public void testGetTimeLocator_MC() throws IOException {
296+
final File file = getAvhrrFRAC_MC_File();
297+
298+
try {
299+
reader.open(file);
300+
final TimeLocator timeLocator = reader.getTimeLocator();
301+
assertNotNull(timeLocator);
302+
303+
assertEquals(1568826482000L, timeLocator.getTimeFor(170, 0));
304+
assertEquals(1568826482167L, timeLocator.getTimeFor(169, 1));
305+
assertEquals(1568826484668L, timeLocator.getTimeFor(170, 16));
306+
assertEquals(1568826651602L, timeLocator.getTimeFor(171, 1017));
307+
assertEquals(1568826818536L, timeLocator.getTimeFor(172, 2018));
308+
assertEquals(1568830004285L, timeLocator.getTimeFor(173, 21121));
309+
} finally {
310+
reader.close();
311+
}
312+
}
313+
274314
@Test
275315
public void testGetVariables_MA() throws IOException {
276316
final File file = getAvhrrFRAC_MA_File();
@@ -331,6 +371,36 @@ public void testGetVariables_MB() throws IOException {
331371
}
332372
}
333373

374+
@Test
375+
public void testGetVariables_MC() throws IOException {
376+
final File file = getAvhrrFRAC_MC_File();
377+
378+
try {
379+
reader.open(file);
380+
381+
final List<Variable> variables = reader.getVariables();
382+
assertEquals(19, variables.size());
383+
384+
Variable variable = variables.get(2);
385+
assertEquals("radiance_3a", variable.getShortName());
386+
assertEquals(DataType.FLOAT, variable.getDataType());
387+
388+
variable = variables.get(6);
389+
assertEquals("reflec_1", variable.getShortName());
390+
assertEquals(DataType.FLOAT, variable.getDataType());
391+
392+
variable = variables.get(10);
393+
assertEquals("temp_4", variable.getShortName());
394+
assertEquals(DataType.FLOAT, variable.getDataType());
395+
396+
variable = variables.get(18);
397+
assertEquals("longitude", variable.getShortName());
398+
assertEquals(DataType.FLOAT, variable.getDataType());
399+
} finally {
400+
reader.close();
401+
}
402+
}
403+
334404
@Test
335405
public void testGetProductSize_MA() throws IOException {
336406
final File file = getAvhrrFRAC_MA_File();
@@ -361,6 +431,21 @@ public void testGetProductSize_MB() throws IOException {
361431
}
362432
}
363433

434+
@Test
435+
public void testGetProductSize_MC() throws IOException {
436+
final File file = getAvhrrFRAC_MC_File();
437+
438+
try {
439+
reader.open(file);
440+
441+
final Dimension productSize = reader.getProductSize();
442+
assertEquals(2001, productSize.getNx());
443+
assertEquals(36561, productSize.getNy());
444+
} finally {
445+
reader.close();
446+
}
447+
}
448+
364449
@Test
365450
public void testReadAcquisitionTime_MA() throws IOException {
366451
final File file = getAvhrrFRAC_MA_File();

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@
2727
<dependency>
2828
<groupId>org.esa.snap</groupId>
2929
<artifactId>snap-core</artifactId>
30-
<version>8.0.2</version>
30+
<version>8.0.3</version>
3131
</dependency>
3232

3333
<dependency>
3434
<groupId>org.esa.snap</groupId>
3535
<artifactId>snap-engine-utilities</artifactId>
36-
<version>8.0.2</version>
36+
<version>8.0.3</version>
3737
</dependency>
3838

3939
<dependency>
4040
<groupId>org.esa.snap</groupId>
4141
<artifactId>snap-envisat-reader</artifactId>
42-
<version>8.0.2</version>
42+
<version>8.0.3</version>
4343
</dependency>
4444

4545
<dependency>
4646
<groupId>org.esa.s3tbx</groupId>
4747
<artifactId>s3tbx-avhrr-reader</artifactId>
48-
<version>8.0.0</version>
48+
<version>8.0.1</version>
4949
</dependency>
5050

5151
<dependency>
5252
<groupId>org.esa.s3tbx</groupId>
5353
<artifactId>s3tbx-sentinel3-reader</artifactId>
54-
<version>8.0.0</version>
54+
<version>8.0.1</version>
5555
<!--<exclusions>-->
5656
<!--<exclusion>-->
5757
<!--<groupId>edu.ucar</groupId>-->

0 commit comments

Comments
 (0)