コード例 #1
1
  @Test
  public void testReadBandRasterData() {
    Date startDate = Calendar.getInstance().getTime();
    // Product product = new Product("name", "desc", 100, 200);
    File file =
        TestUtil.getTestFile(
            productsFolder + "SP04_HRI1_X__1O_20050605T090007_20050605T090016_DLR_70_PREU.BIL.ZIP");
    // File rasterFile = TestUtil.getTestFile(productsFolder + "mediumImage.tif");
    System.setProperty("snap.dataio.reader.tileWidth", "100");
    System.setProperty("snap.dataio.reader.tileHeight", "200");
    try {

      Product finalProduct = reader.readProductNodes(file, null);
      ProductData data = ProductData.createInstance(ProductData.TYPE_UINT16, 20000);
      data.setElemFloatAt(3, 5);
      reader.readBandRasterData(
          finalProduct.getBandAt(0), 2000, 2000, 100, 200, data, new NullProgressMonitor());
      assertNotEquals(0, data.getElemFloatAt(0));
      assertNotEquals(-1000, data.getElemFloatAt(0));
      assertNotEquals(0, data.getElemFloatAt(1999));
      assertNotEquals(-1000, data.getElemFloatAt(1999));
      assertNotEquals(5, data.getElemFloatAt(3));
      Date endDate = Calendar.getInstance().getTime();
      assertTrue(
          "The load time for the product is too big!",
          (endDate.getTime() - startDate.getTime()) / (60 * 1000) < 30);
    } catch (IOException e) {
      e.printStackTrace();
      assertTrue(e.getMessage(), false);
    }
  }
コード例 #2
0
 @Test
 public void testReadProductNodes() {
   Date startDate = Calendar.getInstance().getTime();
   Product product = new Product("name", "desc", 100, 100);
   File file =
       TestUtil.getTestFile(
           productsFolder + "SP04_HRI1_X__1O_20050605T090007_20050605T090016_DLR_70_PREU.BIL.ZIP");
   System.setProperty("snap.dataio.reader.tileWidth", "100");
   System.setProperty("snap.dataio.reader.tileHeight", "100");
   try {
     Product finalProduct = reader.readProductNodes(file, null);
     assertEquals(4, finalProduct.getBands().length);
     assertEquals("WGS84(DD)", finalProduct.getSceneGeoCoding().getGeoCRS().getName().toString());
     assertEquals("SPOTView", finalProduct.getProductType());
     assertEquals(0, finalProduct.getMaskGroup().getNodeCount());
     assertEquals(2713, finalProduct.getSceneRasterWidth());
     assertEquals(2568, finalProduct.getSceneRasterHeight());
     Date endDate = Calendar.getInstance().getTime();
     assertTrue(
         "The load time for the product is too big!",
         (endDate.getTime() - startDate.getTime()) / (60 * 1000) < 30);
   } catch (IOException e) {
     e.printStackTrace();
     assertTrue(e.getMessage(), false);
   }
 }
コード例 #3
0
  @Before
  public void setup() {
    assumeTrue(TestUtil.testdataAvailable());

    SpotViewProductReaderPlugin plugin = new SpotViewProductReaderPlugin();
    reader = new SpotViewProductReader(plugin);
  }
コード例 #4
0
 @Test
 public void testGetProductComponentsOnFileInput() {
   File file =
       TestUtil.getTestFile(
           productsFolder
               + "SP04_HRI1_X__1O_20050605T090007_20050605T090016_DLR_70_PREU.BIL/metadata.xml");
   System.setProperty("snap.dataio.reader.tileWidth", "100");
   System.setProperty("snap.dataio.reader.tileHeight", "100");
   try {
     reader.readProductNodes(file, null);
     TreeNode<File> components = reader.getProductComponents();
     assertEquals(3, components.getChildren().length);
     String[] expectedIds = new String[] {"metadata.dim", "metadata.xml", "geolayer.bil"};
     int componentsAsExpected = 0;
     for (TreeNode<File> component : components.getChildren()) {
       for (String expectedValue : expectedIds) {
         if (component.getId().toLowerCase().equals(expectedValue.toLowerCase())) {
           componentsAsExpected++;
         }
       }
     }
     assertEquals(3, componentsAsExpected);
   } catch (IOException e) {
     e.printStackTrace();
     assertTrue(e.getMessage(), false);
   }
 }
コード例 #5
0
 @Test
 public void testDecodeQualificationForXML() throws IOException {
   Date startDate = Calendar.getInstance().getTime();
   DecodeQualification decodeQualification =
       plugIn.getDecodeQualification(
           TestUtil.getTestFile(productsFolder + "dimap/test_ST4_MT.xml"));
   assertEquals(DecodeQualification.UNABLE, decodeQualification);
   decodeQualification =
       plugIn.getDecodeQualification(
           TestUtil.getTestFile(
               productsFolder
                   + "Demo03_1B/2009-04-16T104920_RE4_1B-NAC_3436599_84303_metadata.xml"));
   assertEquals(DecodeQualification.INTENDED, decodeQualification);
   Date endDate = Calendar.getInstance().getTime();
   assertTrue(
       "The decoding time for the file is too big!",
       (endDate.getTime() - startDate.getTime()) / 1000 < 30); // 30 sec
 }
コード例 #6
0
  @Test
  public void testDecodeQualificationForXML() throws IOException {
    assumeTrue(TestUtil.testdataAvailable());

    Date startDate = Calendar.getInstance().getTime();
    DecodeQualification decodeQualification =
        plugIn.getDecodeQualification(
            TestUtil.getTestFile(productsFolder + "dimap/test_ST4_MT.xml"));
    assertEquals(DecodeQualification.UNABLE, decodeQualification);
    decodeQualification =
        plugIn.getDecodeQualification(
            TestUtil.getTestFile(productsFolder + "SPOT4_HRVIR1_XS_88888888_N1A.tgz"));
    assertEquals(DecodeQualification.INTENDED, decodeQualification);
    Date endDate = Calendar.getInstance().getTime();
    assertTrue(
        "The decoding time for the file is too big!",
        (endDate.getTime() - startDate.getTime()) / 1000 < 30); // 30 sec
  }
コード例 #7
0
 @Test
 public void testGetProductComponentsOnArchiveInput() {
   File file =
       TestUtil.getTestFile(
           productsFolder + "SP04_HRI1_X__1O_20050605T090007_20050605T090016_DLR_70_PREU.BIL.ZIP");
   System.setProperty("snap.dataio.reader.tileWidth", "100");
   System.setProperty("snap.dataio.reader.tileHeight", "100");
   try {
     reader.readProductNodes(file, null);
     TreeNode<File> components = reader.getProductComponents();
     assertEquals(1, components.getChildren().length);
     assertEquals(
         "SP04_HRI1_X__1O_20050605T090007_20050605T090016_DLR_70_PREU.BIL.ZIP",
         components.getChildren()[0].getId());
   } catch (IOException e) {
     e.printStackTrace();
     assertTrue(e.getMessage(), false);
   }
 }