11package com .bc .fiduceo .matchup ;
22
3+ import com .bc .fiduceo .FiduceoConstants ;
4+ import com .bc .fiduceo .NCTestUtils ;
35import com .bc .fiduceo .TestUtil ;
46import com .bc .fiduceo .core .SatelliteObservation ;
57import com .bc .fiduceo .core .Sensor ;
68import com .bc .fiduceo .core .UseCaseConfig ;
79import com .bc .fiduceo .db .DbAndIOTestRunner ;
10+ import com .bc .fiduceo .util .NetCDFUtils ;
811import org .apache .commons .cli .ParseException ;
912import org .junit .Test ;
1013import org .junit .runner .RunWith ;
14+ import ucar .ma2 .InvalidRangeException ;
15+ import ucar .nc2 .NetcdfFile ;
1116
1217import java .io .File ;
1318import java .io .IOException ;
1419import java .sql .SQLException ;
1520import java .util .ArrayList ;
1621import java .util .List ;
1722
23+ import static org .junit .Assert .assertEquals ;
24+ import static org .junit .Assert .assertTrue ;
25+
1826@ RunWith (DbAndIOTestRunner .class )
1927public class MatchupToolIntegrationTest_SMOSL1_drifter extends AbstractUsecaseIntegrationTest {
2028
2129 @ Test
22- public void testMatchup () throws IOException , SQLException , ParseException {
30+ public void testMatchup () throws IOException , SQLException , ParseException , InvalidRangeException {
2331 final UseCaseConfig useCaseConfig = createUseCaseConfigBuilder ()
2432 .withTimeDeltaSeconds (7200 , null )
2533 .withMaxPixelDistanceKm (2 , null )
@@ -29,9 +37,47 @@ public void testMatchup() throws IOException, SQLException, ParseException {
2937 insert_SIRDS ();
3038 insert_miras_CDF3TD ();
3139
32- // @todo 1 tb/tb continue here 2022-10-14
33- // final String[] args = new String[]{"-c", configDir.getAbsolutePath(), "-u", useCaseConfigFile.getName(), "-start", "2017-324", "-end", "2017-324"};
34- // MatchupToolMain.main(args);
40+ final String [] args = new String []{"-c" , configDir .getAbsolutePath (), "-u" , useCaseConfigFile .getName (), "-start" , "2017-324" , "-end" , "2017-324" };
41+ MatchupToolMain .main (args );
42+
43+ final File mmdFile = getMmdFilePath (useCaseConfig , "2017-324" , "2017-324" );
44+ assertTrue (mmdFile .isFile ());
45+
46+ try (NetcdfFile mmd = NetcdfFile .open (mmdFile .getAbsolutePath ())) {
47+ final int matchupCount = NetCDFUtils .getDimensionLength (FiduceoConstants .MATCHUP_COUNT , mmd );
48+ assertEquals (15 , matchupCount );
49+
50+ NCTestUtils .assert3DVariable ("drifter-sirds_acquisition_time" , 0 , 0 , 0 , 1511146800 , mmd );
51+ NCTestUtils .assert3DVariable ("drifter-sirds_collection" , 0 , 0 , 1 , 1 , mmd );
52+ NCTestUtils .assert3DVariable ("drifter-sirds_depth" , 0 , 0 , 2 , 0.2 , mmd );
53+ NCTestUtils .assert3DVariable ("drifter-sirds_depth_corr" , 0 , 0 , 3 , 0.0 , mmd );
54+ NCTestUtils .assert3DVariable ("drifter-sirds_latitude" , 0 , 0 , 4 , -25.63 , mmd );
55+ NCTestUtils .assert3DVariable ("drifter-sirds_longitude" , 0 , 0 , 5 , -151.32001 , mmd );
56+ NCTestUtils .assert3DVariable ("drifter-sirds_prof_id" , 0 , 0 , 6 , 633946 , mmd );
57+ NCTestUtils .assert3DVariable ("drifter-sirds_qc1" , 0 , 0 , 7 , 0 , mmd );
58+ NCTestUtils .assert3DVariable ("drifter-sirds_qc2" , 0 , 0 , 8 , -99 , mmd );
59+ NCTestUtils .assert3DVariable ("drifter-sirds_sst" , 0 , 0 , 9 , 30.100000381469727 , mmd );
60+ NCTestUtils .assert3DVariable ("drifter-sirds_sst_comb_unc" , 0 , 0 , 10 , 0.3895 , mmd );
61+ NCTestUtils .assert3DVariable ("drifter-sirds_sst_plat_corr" , 0 , 0 , 11 , 0.0 , mmd );
62+ NCTestUtils .assert3DVariable ("drifter-sirds_sst_plat_corr" , 0 , 0 , 12 , 0.0 , mmd );
63+ NCTestUtils .assert3DVariable ("drifter-sirds_sst_plat_corr_unc" , 0 , 0 , 12 , 0.29 , mmd );
64+ NCTestUtils .assert3DVariable ("drifter-sirds_sst_rand_unc" , 0 , 0 , 13 , 0.26 , mmd );
65+
66+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Azimuth_Angle_025" , 0 , 0 , 0 , -32768 , mmd );
67+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_BT_3_075" , 1 , 0 , 1 , -32768 , mmd );
68+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_BT_4_125" , 2 , 0 , 2 , -32768 , mmd );
69+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_BT_H_175" , 0 , 1 , 3 , -32768 , mmd );
70+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_BT_V_225" , 1 , 1 , 4 , -32768 , mmd );
71+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Days_275" , 2 , 1 , 5 , 6533 , mmd );
72+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Eta_325" , 0 , 2 , 6 , -10148 , mmd );
73+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Footprint_Axis1_375" , 1 , 2 , 7 , -16670 , mmd );
74+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Footprint_Axis2_400" , 2 , 2 , 8 , -19158 , mmd );
75+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Incidence_Angle_425" , 0 , 0 , 9 , -2487 , mmd );
76+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Nb_RFI_Flags_475" , 1 , 0 , 10 , 0 , mmd );
77+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Nb_SUN_Flags_525" , 2 , 0 , 11 , 0 , mmd );
78+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Nviews_575" , 0 , 1 , 12 , 14 , mmd );
79+ NCTestUtils .assert3DVariable ("miras-smos-CDF3TD_Pixel_BT_Standard_Deviation_3_625" , 1 , 1 , 13 , -32768 , mmd );
80+ }
3581 }
3682
3783 private void insert_SIRDS () throws IOException , SQLException {
@@ -46,7 +92,7 @@ private void insert_miras_CDF3TD() throws IOException, SQLException {
4692 final String sensorKey = "miras-smos-CDF3TD" ;
4793 final String relativeArchivePath = TestUtil .assembleFileSystemPath (new String []{sensorKey , "re07" , "2017" , "324" , "SM_RE07_MIR_CDF3TD_20171120T000000_20171120T235959_330_001_7.tgz" }, true );
4894
49- final SatelliteObservation satelliteObservation = readSatelliteObservation (sensorKey , relativeArchivePath , "v1 " );
95+ final SatelliteObservation satelliteObservation = readSatelliteObservation (sensorKey , relativeArchivePath , "re07 " );
5096 storage .insert (satelliteObservation );
5197 }
5298
0 commit comments