|
| 1 | +package com.bc.fiduceo.matchup; |
| 2 | + |
| 3 | +import com.bc.fiduceo.TestUtil; |
| 4 | +import com.bc.fiduceo.core.Dimension; |
| 5 | +import com.bc.fiduceo.core.SatelliteObservation; |
| 6 | +import com.bc.fiduceo.core.Sensor; |
| 7 | +import com.bc.fiduceo.core.UseCaseConfig; |
| 8 | +import com.bc.fiduceo.db.DbAndIOTestRunner; |
| 9 | +import org.apache.commons.cli.ParseException; |
| 10 | +import org.junit.Test; |
| 11 | +import org.junit.runner.RunWith; |
| 12 | + |
| 13 | +import java.io.File; |
| 14 | +import java.io.IOException; |
| 15 | +import java.sql.SQLException; |
| 16 | +import java.util.ArrayList; |
| 17 | +import java.util.List; |
| 18 | + |
| 19 | +@RunWith(DbAndIOTestRunner.class) |
| 20 | +public class MatchupToolIntegrationTest_border_overlap_bug extends AbstractUsecaseIntegrationTest { |
| 21 | + |
| 22 | + @Test |
| 23 | + public void testMatchupWithBorderOverlap() throws IOException, SQLException, ParseException { |
| 24 | + insert_AATSR(); |
| 25 | + insert_ARGO_SST(); |
| 26 | + |
| 27 | + final UseCaseConfig useCaseConfig = createUseCaseConfigBuilder() |
| 28 | + .withTimeDeltaSeconds(63072000, null) // 2 years - just for testing |
| 29 | + .withMaxPixelDistanceKm(1.f, null) |
| 30 | + .createConfig(); |
| 31 | + final File useCaseConfigFile = storeUseCaseConfig(useCaseConfig, "usecase-test_SST.xml"); |
| 32 | + |
| 33 | + final String[] args = new String[]{"-c", configDir.getAbsolutePath(), "-u", useCaseConfigFile.getName(), "-start", "2012-046", "-end", "2013-256"}; |
| 34 | + MatchupToolMain.main(args); |
| 35 | + |
| 36 | + System.out.println("args = " + args); |
| 37 | + |
| 38 | + } |
| 39 | + |
| 40 | + private MatchupToolTestUseCaseConfigBuilder createUseCaseConfigBuilder() { |
| 41 | + final List<Sensor> sensorList = new ArrayList<>(); |
| 42 | + final Sensor primary = new Sensor("argo-sst"); |
| 43 | + primary.setPrimary(true); |
| 44 | + sensorList.add(primary); |
| 45 | + sensorList.add(new Sensor("aatsr-en")); |
| 46 | + |
| 47 | + final List<Dimension> dimensions = new ArrayList<>(); |
| 48 | + dimensions.add(new Dimension("argo-sst", 1, 1)); |
| 49 | + dimensions.add(new Dimension("aatsr-en", 27, 5)); |
| 50 | + |
| 51 | + return (MatchupToolTestUseCaseConfigBuilder) new MatchupToolTestUseCaseConfigBuilder("mmd03_test") |
| 52 | + .withSensors(sensorList) |
| 53 | + .withOutputPath(new File(TestUtil.getTestDir().getPath(), "usecase-test_sst").getPath()) |
| 54 | + .withDimensions(dimensions); |
| 55 | + } |
| 56 | + |
| 57 | + private void insert_AATSR() throws IOException, SQLException { |
| 58 | + final String sensorKey = "aatsr-en"; |
| 59 | + final String version = "v3"; |
| 60 | + final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{sensorKey, version, "2012", "02", "15", "ATS_TOA_1PUUPA20120215_010547_000065273111_00361_52099_6045.N1"}, true); |
| 61 | + final String absolutePath = TestUtil.getTestDataDirectory().getAbsolutePath() + relativeArchivePath; |
| 62 | + |
| 63 | + final SatelliteObservation satelliteObservation = readSatelliteObservation(sensorKey, absolutePath, version); |
| 64 | + storage.insert(satelliteObservation); |
| 65 | + } |
| 66 | + |
| 67 | + private void insert_ARGO_SST() throws IOException, SQLException { |
| 68 | + final String processingVersion = "v04.0"; |
| 69 | + final String sensorKey = "argo-sst"; |
| 70 | + final String relativeArchivePath = TestUtil.assembleFileSystemPath(new String[]{"insitu", "argo-sst", processingVersion, "insitu_5_WMOID_5904372_20130819_20161225.nc"}, true); |
| 71 | + final String absolutePath = TestUtil.getTestDataDirectory().getAbsolutePath() + relativeArchivePath; |
| 72 | + final SatelliteObservation argoInsitu = readSatelliteObservation(sensorKey, absolutePath, processingVersion); |
| 73 | + storage.insert(argoInsitu); |
| 74 | + } |
| 75 | +} |
0 commit comments