|
13 | 13 | import com.bc.fiduceo.reader.time.TimeLocator; |
14 | 14 | import com.bc.fiduceo.util.TempFileUtils; |
15 | 15 | import org.junit.Before; |
16 | | -import org.junit.Ignore; |
17 | 16 | import org.junit.Test; |
18 | 17 | import org.junit.runner.RunWith; |
19 | 18 | import ucar.ma2.Array; |
@@ -187,45 +186,66 @@ public void testReadAcquisitionInfo_MA_GZ() throws IOException { |
187 | 186 | } |
188 | 187 |
|
189 | 188 | @Test |
190 | | - @Ignore |
191 | 189 | public void testReadAcquisitionInfo_MC() throws IOException { |
192 | 190 | final File file = getAvhrrFRAC_MC_File(); |
193 | 191 |
|
194 | | - // @todo 1 tb/tb continue here |
195 | | - |
196 | 192 | try { |
197 | 193 | reader.open(file); |
198 | 194 |
|
199 | 195 | final AcquisitionInfo acquisitionInfo = reader.read(); |
200 | 196 | assertNotNull(acquisitionInfo); |
201 | 197 |
|
202 | 198 | 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); |
204 | 200 |
|
205 | 201 | 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); |
207 | 203 |
|
208 | 204 | final NodeType nodeType = acquisitionInfo.getNodeType(); |
209 | 205 | assertEquals(NodeType.UNDEFINED, nodeType); |
210 | 206 |
|
211 | 207 | final Geometry boundingGeometry = acquisitionInfo.getBoundingGeometry(); |
212 | 208 | assertNotNull(boundingGeometry); |
213 | | - assertTrue(boundingGeometry instanceof Polygon); |
214 | | - final Polygon polygon = (Polygon) boundingGeometry; |
| 209 | + assertTrue(boundingGeometry instanceof MultiPolygon); |
| 210 | + final MultiPolygon multiPolygon = (MultiPolygon) boundingGeometry; |
215 | 211 |
|
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()); |
220 | 214 |
|
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); |
223 | 238 |
|
224 | 239 | final TimeAxis[] timeAxes = acquisitionInfo.getTimeAxes(); |
225 | | - assertEquals(1, timeAxes.length); |
| 240 | + assertEquals(2, timeAxes.length); |
226 | 241 |
|
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); |
229 | 249 | } finally { |
230 | 250 | reader.close(); |
231 | 251 | } |
@@ -271,6 +291,26 @@ public void testGetTimeLocator_MB() throws IOException { |
271 | 291 | } |
272 | 292 | } |
273 | 293 |
|
| 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 | + |
274 | 314 | @Test |
275 | 315 | public void testGetVariables_MA() throws IOException { |
276 | 316 | final File file = getAvhrrFRAC_MA_File(); |
@@ -331,6 +371,36 @@ public void testGetVariables_MB() throws IOException { |
331 | 371 | } |
332 | 372 | } |
333 | 373 |
|
| 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 | + |
334 | 404 | @Test |
335 | 405 | public void testGetProductSize_MA() throws IOException { |
336 | 406 | final File file = getAvhrrFRAC_MA_File(); |
@@ -361,6 +431,21 @@ public void testGetProductSize_MB() throws IOException { |
361 | 431 | } |
362 | 432 | } |
363 | 433 |
|
| 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 | + |
364 | 449 | @Test |
365 | 450 | public void testReadAcquisitionTime_MA() throws IOException { |
366 | 451 | final File file = getAvhrrFRAC_MA_File(); |
|
0 commit comments