|
| 1 | +package com.bc.fiduceo.matchup; |
| 2 | + |
| 3 | +import com.bc.fiduceo.TestUtil; |
| 4 | +import com.bc.fiduceo.core.SatelliteObservation; |
| 5 | +import com.bc.fiduceo.core.Sensor; |
| 6 | +import com.bc.fiduceo.core.UseCaseConfig; |
| 7 | +import com.bc.fiduceo.db.DbAndIOTestRunner; |
| 8 | +import org.apache.commons.cli.ParseException; |
| 9 | +import org.junit.Test; |
| 10 | +import org.junit.runner.RunWith; |
| 11 | + |
| 12 | +import java.io.File; |
| 13 | +import java.io.IOException; |
| 14 | +import java.sql.SQLException; |
| 15 | +import java.util.ArrayList; |
| 16 | +import java.util.List; |
| 17 | + |
| 18 | +@RunWith(DbAndIOTestRunner.class) |
| 19 | +public class MatchupToolIntegrationTest_SMOSL1_drifter extends AbstractUsecaseIntegrationTest { |
| 20 | + |
| 21 | + @Test |
| 22 | + public void testMatchup() throws IOException, SQLException, ParseException { |
| 23 | + final UseCaseConfig useCaseConfig = createUseCaseConfigBuilder() |
| 24 | + .withTimeDeltaSeconds(7200, null) |
| 25 | + .withMaxPixelDistanceKm(2, null) |
| 26 | + .createConfig(); |
| 27 | + final File useCaseConfigFile = storeUseCaseConfig(useCaseConfig, "usecase-43.xml"); |
| 28 | + |
| 29 | + insert_SIRDS(); |
| 30 | + insert_miras_CDF3TD(); |
| 31 | + |
| 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); |
| 35 | + } |
| 36 | + |
| 37 | + private void insert_SIRDS() throws IOException, SQLException { |
| 38 | + final String sensorKey = "drifter-sirds"; |
| 39 | + final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{"insitu", "sirds", "v1.0", "SSTCCI2_refdata_drifter_201711.nc"}, true); |
| 40 | + |
| 41 | + final SatelliteObservation satelliteObservation = readSatelliteObservation(sensorKey, relativeArchivePath, "v1.0"); |
| 42 | + storage.insert(satelliteObservation); |
| 43 | + } |
| 44 | + |
| 45 | + private void insert_miras_CDF3TD() throws IOException, SQLException { |
| 46 | + final String sensorKey = "miras-smos-CDF3TD"; |
| 47 | + final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{sensorKey, "re07", "2017", "324", "SM_RE07_MIR_CDF3TD_20171120T000000_20171120T235959_330_001_7.tgz"}, true); |
| 48 | + |
| 49 | + final SatelliteObservation satelliteObservation = readSatelliteObservation(sensorKey, relativeArchivePath, "v1"); |
| 50 | + storage.insert(satelliteObservation); |
| 51 | + } |
| 52 | + |
| 53 | + private MatchupToolTestUseCaseConfigBuilder createUseCaseConfigBuilder() { |
| 54 | + final List<Sensor> sensorList = new ArrayList<>(); |
| 55 | + final Sensor primary = new Sensor("drifter-sirds"); |
| 56 | + primary.setPrimary(true); |
| 57 | + sensorList.add(primary); |
| 58 | + sensorList.add(new Sensor("miras-smos-CDF3TD")); |
| 59 | + |
| 60 | + final List<com.bc.fiduceo.core.Dimension> dimensions = new ArrayList<>(); |
| 61 | + dimensions.add(new com.bc.fiduceo.core.Dimension("drifter-sirds", 1, 1)); |
| 62 | + dimensions.add(new com.bc.fiduceo.core.Dimension("miras-smos-CDF3TD", 3, 3)); |
| 63 | + |
| 64 | + return (MatchupToolTestUseCaseConfigBuilder) new MatchupToolTestUseCaseConfigBuilder("mmd43") |
| 65 | + .withSensors(sensorList) |
| 66 | + .withOutputPath(new File(TestUtil.getTestDir().getPath(), "usecase-43").getPath()) |
| 67 | + .withDimensions(dimensions); |
| 68 | + } |
| 69 | +} |
0 commit comments