@@ -67,6 +67,21 @@ public void testReadAcquisitionInfo_TRITON() throws Exception {
6767 assertNull (info .getBoundingGeometry ());
6868 }
6969
70+ @ Test
71+ public void testReadAcquisitionInfo_PIRATA () throws Exception {
72+ final File insituDataFile = getPirataProduct ();
73+
74+ reader .open (insituDataFile );
75+
76+ final AcquisitionInfo info = reader .read ();
77+ TestUtil .assertCorrectUTCDate (2016 , 10 , 1 , 0 , 0 , 0 , 0 , info .getSensingStart ());
78+ TestUtil .assertCorrectUTCDate (2016 , 10 , 31 , 23 , 0 , 0 , 0 , info .getSensingStop ());
79+
80+ assertEquals (NodeType .UNDEFINED , info .getNodeType ());
81+
82+ assertNull (info .getBoundingGeometry ());
83+ }
84+
7085 @ Test
7186 public void testGetProductSize_TAO () throws IOException {
7287 final File insituDataFile = getTAOProduct ();
@@ -95,6 +110,20 @@ public void testGetProductSize_TRITON() throws IOException {
95110 assertEquals (31 , productSize .getNy ());
96111 }
97112
113+ @ Test
114+ public void testGetProductSize_RAMA () throws IOException {
115+ final File insituDataFile = getRamaProduct ();
116+
117+ reader .open (insituDataFile );
118+
119+ final Dimension productSize = reader .getProductSize ();
120+
121+ assertNotNull (productSize );
122+ assertEquals ("product_size" , productSize .getName ());
123+ assertEquals (1 , productSize .getNx ());
124+ assertEquals (720 , productSize .getNy ());
125+ }
126+
98127 @ Test
99128 public void testGetTimeLocator_TAO () throws IOException {
100129 final File insituDataFile = getTAOProduct ();
@@ -125,6 +154,21 @@ public void testGetTimeLocator_TRITON() throws IOException {
125154 assertEquals (-1L , timeLocator .getTimeFor (20 , 45 ));
126155 }
127156
157+ @ Test
158+ public void testGetTimeLocator_PIRATA () throws IOException {
159+ final File insituDataFile = getPirataProduct ();
160+
161+ reader .open (insituDataFile );
162+
163+ final TimeLocator timeLocator = reader .getTimeLocator ();
164+ assertEquals (1475280000000L , timeLocator .getTimeFor (0 , 0 ));
165+ assertEquals (1475337600000L , timeLocator .getTimeFor (10 , 16 ));
166+ assertEquals (1475391600000L , timeLocator .getTimeFor (20 , 31 ));
167+
168+ assertEquals (-1L , timeLocator .getTimeFor (20 , -1 ));
169+ assertEquals (-1L , timeLocator .getTimeFor (20 , 1734 ));
170+ }
171+
128172 @ Test
129173 public void testReadRaw_TAO () throws IOException , InvalidRangeException {
130174 final File insituDataFile = getTAOProduct ();
@@ -201,7 +245,69 @@ public void testReadRaw_TRITON_3x3() throws IOException, InvalidRangeException {
201245 }
202246
203247 @ Test
204- public void testReadScale_TRITON () throws IOException , InvalidRangeException {
248+ public void testReadRaw_RAMA () throws IOException , InvalidRangeException {
249+ final File insituDataFile = getRamaProduct ();
250+
251+ reader .open (insituDataFile );
252+
253+ final Interval singlePx = new Interval (1 , 1 );
254+
255+ // x is ignored
256+ Array array = reader .readRaw (8 , 452 , singlePx , "time" );
257+ assertEquals (DataType .INT , array .getDataType ());
258+ assertEquals (1524168000 , array .getInt (0 ));
259+
260+ array = reader .readRaw (9 , 453 , singlePx , "longitude" );
261+ assertEquals (DataType .FLOAT , array .getDataType ());
262+ assertEquals (80.5f , array .getFloat (0 ), 1e-8 );
263+
264+ array = reader .readRaw (9 , 454 , singlePx , "latitude" );
265+ assertEquals (DataType .FLOAT , array .getDataType ());
266+ assertEquals (-8.f , array .getFloat (0 ), 1e-8 );
267+
268+ array = reader .readRaw (9 , 455 , singlePx , "SSS" );
269+ assertEquals (DataType .FLOAT , array .getDataType ());
270+ assertEquals (34.251f , array .getFloat (0 ), 1e-8 );
271+
272+ array = reader .readRaw (9 , 456 , singlePx , "SST" );
273+ assertEquals (DataType .FLOAT , array .getDataType ());
274+ assertEquals (28.6f , array .getFloat (0 ), 1e-8 );
275+
276+ array = reader .readRaw (9 , 457 , singlePx , "AIRT" );
277+ assertEquals (DataType .FLOAT , array .getDataType ());
278+ assertEquals (27.6f , array .getFloat (0 ), 1e-8 );
279+
280+ array = reader .readRaw (9 , 458 , singlePx , "RH" );
281+ assertEquals (DataType .FLOAT , array .getDataType ());
282+ assertEquals (84.1f , array .getFloat (0 ), 1e-8 );
283+
284+ array = reader .readRaw (9 , 459 , singlePx , "WSPD" );
285+ assertEquals (DataType .FLOAT , array .getDataType ());
286+ assertEquals (6.6f , array .getFloat (0 ), 1e-8 );
287+
288+ array = reader .readRaw (9 , 460 , singlePx , "WDIR" );
289+ assertEquals (DataType .FLOAT , array .getDataType ());
290+ assertEquals (295.4f , array .getFloat (0 ), 1e-8 );
291+
292+ array = reader .readRaw (9 , 461 , singlePx , "BARO" );
293+ assertEquals (DataType .FLOAT , array .getDataType ());
294+ assertEquals (1010.6f , array .getFloat (0 ), 1e-8 );
295+
296+ array = reader .readRaw (9 , 462 , singlePx , "RAIN" );
297+ assertEquals (DataType .FLOAT , array .getDataType ());
298+ assertEquals (0.f , array .getFloat (0 ), 1e-8 );
299+
300+ array = reader .readRaw (9 , 463 , singlePx , "Q" );
301+ assertEquals (DataType .INT , array .getDataType ());
302+ assertEquals (22222222 , array .getInt (0 ));
303+
304+ array = reader .readRaw (9 , 464 , singlePx , "M" );
305+ assertEquals (DataType .STRING , array .getDataType ());
306+ assertEquals ("11111111" , array .getObject (0 ));
307+ }
308+
309+ @ Test
310+ public void testReadScaled_TRITON () throws IOException , InvalidRangeException {
205311 final File insituDataFile = getTritonProduct ();
206312
207313 reader .open (insituDataFile );
@@ -262,6 +368,68 @@ public void testReadScale_TRITON() throws IOException, InvalidRangeException {
262368 assertEquals ("MMMMMMMM" , array .getObject (0 ));
263369 }
264370
371+ @ Test
372+ public void testReadScaled_PIRATA () throws IOException , InvalidRangeException {
373+ final File insituDataFile = getPirataProduct ();
374+
375+ reader .open (insituDataFile );
376+
377+ final Interval singlePx = new Interval (1 , 1 );
378+
379+ // x is ignored
380+ Array array = reader .readScaled (8 , 6 , singlePx , "time" );
381+ assertEquals (DataType .INT , array .getDataType ());
382+ assertEquals (1475301600 , array .getInt (0 ));
383+
384+ array = reader .readScaled (9 , 7 , singlePx , "longitude" );
385+ assertEquals (DataType .FLOAT , array .getDataType ());
386+ assertEquals (-35.f , array .getFloat (0 ), 1e-8 );
387+
388+ array = reader .readScaled (9 , 8 , singlePx , "latitude" );
389+ assertEquals (DataType .FLOAT , array .getDataType ());
390+ assertEquals (0.f , array .getFloat (0 ), 1e-8 );
391+
392+ array = reader .readScaled (9 , 9 , singlePx , "SSS" );
393+ assertEquals (DataType .FLOAT , array .getDataType ());
394+ assertEquals (35.649f , array .getFloat (0 ), 1e-8 );
395+
396+ array = reader .readScaled (9 , 10 , singlePx , "SST" );
397+ assertEquals (DataType .FLOAT , array .getDataType ());
398+ assertEquals (-9.999f , array .getFloat (0 ), 1e-8 );
399+
400+ array = reader .readScaled (9 , 11 , singlePx , "AIRT" );
401+ assertEquals (DataType .FLOAT , array .getDataType ());
402+ assertEquals (-9.99f , array .getFloat (0 ), 1e-8 );
403+
404+ array = reader .readScaled (9 , 12 , singlePx , "RH" );
405+ assertEquals (DataType .FLOAT , array .getDataType ());
406+ assertEquals (-9.99f , array .getFloat (0 ), 1e-8 );
407+
408+ array = reader .readScaled (9 , 13 , singlePx , "WSPD" );
409+ assertEquals (DataType .FLOAT , array .getDataType ());
410+ assertEquals (-99.9f , array .getFloat (0 ), 1e-8 );
411+
412+ array = reader .readScaled (9 , 14 , singlePx , "WDIR" );
413+ assertEquals (DataType .FLOAT , array .getDataType ());
414+ assertEquals (-99.9f , array .getFloat (0 ), 1e-8 );
415+
416+ array = reader .readScaled (9 , 15 , singlePx , "BARO" );
417+ assertEquals (DataType .FLOAT , array .getDataType ());
418+ assertEquals (-9.9f , array .getFloat (0 ), 1e-8 );
419+
420+ array = reader .readScaled (9 , 16 , singlePx , "RAIN" );
421+ assertEquals (DataType .FLOAT , array .getDataType ());
422+ assertEquals (-9.99f , array .getFloat (0 ), 1e-8 );
423+
424+ array = reader .readRaw (9 , 17 , singlePx , "Q" );
425+ assertEquals (DataType .INT , array .getDataType ());
426+ assertEquals (39999999 , array .getInt (0 ));
427+
428+ array = reader .readScaled (9 , 18 , singlePx , "M" );
429+ assertEquals (DataType .STRING , array .getDataType ());
430+ assertEquals ("5DDDDDDD" , array .getObject (0 ));
431+ }
432+
265433 @ Test
266434 public void testReadAcquisitionTime_TAO () throws IOException , InvalidRangeException {
267435 final File insituDataFile = getTAOProduct ();
@@ -272,6 +440,16 @@ public void testReadAcquisitionTime_TAO() throws IOException, InvalidRangeExcept
272440 assertEquals (1467262800 , acquisitionTime .getInt (0 ));
273441 }
274442
443+ @ Test
444+ public void testReadAcquisitionTime_RAMA () throws IOException , InvalidRangeException {
445+ final File insituDataFile = getRamaProduct ();
446+
447+ reader .open (insituDataFile );
448+
449+ ArrayInt .D2 acquisitionTime = reader .readAcquisitionTime (3 , 702 , new Interval (1 , 1 ));
450+ assertEquals (1525068000 , acquisitionTime .getInt (0 ));
451+ }
452+
275453 private static File getTAOProduct () throws IOException {
276454 final String testFilePath = TestUtil .assembleFileSystemPath (new String []{"insitu" , "tao-sss" , "v1" , "2016" , "06" , "TAO_T2S140W_DM167A-20160228_2016-06.txt" }, false );
277455 return TestUtil .getTestDataFileAsserted (testFilePath );
@@ -281,4 +459,14 @@ private static File getTritonProduct() throws IOException {
281459 final String testFilePath = TestUtil .assembleFileSystemPath (new String []{"insitu" , "tao-sss" , "v1" , "2017" , "10" , "TRITON_TR0N156E_1998_2017-10.txt" }, false );
282460 return TestUtil .getTestDataFileAsserted (testFilePath );
283461 }
462+
463+ private static File getPirataProduct () throws IOException {
464+ final String testFilePath = TestUtil .assembleFileSystemPath (new String []{"insitu" , "pirata-sss" , "v1" , "2016" , "10" , "PIRATA_0N35W_sss_2016-10.txt" }, false );
465+ return TestUtil .getTestDataFileAsserted (testFilePath );
466+ }
467+
468+ private static File getRamaProduct () throws IOException {
469+ final String testFilePath = TestUtil .assembleFileSystemPath (new String []{"insitu" , "rama-sss" , "v1" , "2018" , "04" , "RAMA_8S805E_sss_2018-04.txt" }, false );
470+ return TestUtil .getTestDataFileAsserted (testFilePath );
471+ }
284472}
0 commit comments