Search in sources :

Example 1 with Product

use of org.esa.snap.core.datamodel.Product in project s1tbx by senbox-org.

the class TestERSEnvisatProductReader method read.

private Product read(final File file) throws Exception {
    final DecodeQualification canRead = readerPlugIn.getDecodeQualification(file);
    if (canRead != DecodeQualification.INTENDED) {
        throw new Exception("Reader not intended");
    }
    final ProductReader reader = readerPlugIn.createReaderInstance();
    final Product product = reader.readProductNodes(file, null);
    if (product == null) {
        throw new Exception("Unable to read product");
    }
    return product;
}
Also used : DecodeQualification(org.esa.snap.core.dataio.DecodeQualification) Product(org.esa.snap.core.datamodel.Product) ProductReader(org.esa.snap.core.dataio.ProductReader)

Example 2 with Product

use of org.esa.snap.core.datamodel.Product in project s1tbx by senbox-org.

the class TestERSEnvisatProductReader method testERS2_E2_IMP.

@Test
public void testERS2_E2_IMP() throws Exception {
    Product prod = read(ers2_envisat_imp);
    final ProductValidator validator = new ProductValidator(prod);
    validator.validateProduct();
    // validator.validateMetadata();
    validator.validateBands(new String[] { "Amplitude", "Intensity" });
}
Also used : Product(org.esa.snap.core.datamodel.Product) ProductValidator(org.esa.s1tbx.commons.test.ProductValidator) Test(org.junit.Test) ReaderTest(org.esa.s1tbx.commons.test.ReaderTest)

Example 3 with Product

use of org.esa.snap.core.datamodel.Product in project s1tbx by senbox-org.

the class TestERSEnvisatProductReader method testERS2_ENVISAT_IMM_ZIP.

@Test
public void testERS2_ENVISAT_IMM_ZIP() throws Exception {
    Product prod = read(ers2_envisat_imm_zip);
    final ProductValidator validator = new ProductValidator(prod);
    validator.validateProduct();
    // validator.validateMetadata();
    validator.validateBands(new String[] { "Amplitude", "Intensity" });
}
Also used : Product(org.esa.snap.core.datamodel.Product) ProductValidator(org.esa.s1tbx.commons.test.ProductValidator) Test(org.junit.Test) ReaderTest(org.esa.s1tbx.commons.test.ReaderTest)

Example 4 with Product

use of org.esa.snap.core.datamodel.Product in project s1tbx by senbox-org.

the class TestERSEnvisatProductReader method testERS1_E1_IMP.

@Test
public void testERS1_E1_IMP() throws Exception {
    Product prod = read(ers1_envisat_imp);
    final ProductValidator validator = new ProductValidator(prod);
    validator.validateProduct();
    // validator.validateMetadata();
    validator.validateBands(new String[] { "Amplitude", "Intensity" });
}
Also used : Product(org.esa.snap.core.datamodel.Product) ProductValidator(org.esa.s1tbx.commons.test.ProductValidator) Test(org.junit.Test) ReaderTest(org.esa.s1tbx.commons.test.ReaderTest)

Example 5 with Product

use of org.esa.snap.core.datamodel.Product in project s1tbx by senbox-org.

the class TestCreateStackOp method testForumIssue.

@Test
public void testForumIssue() throws IOException {
    Product[] products = new Product[2];
    products[0] = ProductIO.readProduct(asarBamFile1);
    products[1] = ProductIO.readProduct(asarBamFile2);
    assertNotNull(products[0]);
    assertNotNull(products[1]);
    GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis();
    final HashMap<String, Object> parameters = new HashMap<>();
    parameters.put("extent", "Master");
    parameters.put("initialOffsetMethod", "Product Geolocation");
    parameters.put("masterBands", products[0].getBandAt(0).getName() + "," + products[0].getBandAt(1).getName());
    parameters.put("resamplingType", "NEAREST_NEIGHBOUR");
    parameters.put("sourceBands", products[1].getBandAt(0).getName() + "," + products[1].getBandAt(1).getName());
    System.out.println("Creating stack...");
    Product outProduct = GPF.createProduct("CreateStack", parameters, products);
    File tmpFolder = createTmpFolder("stacks");
    ProductIO.writeProduct(outProduct, new File(tmpFolder, "target.dim"), "BEAM-DIMAP", true);
    outProduct.dispose();
    delete(tmpFolder);
}
Also used : HashMap(java.util.HashMap) Product(org.esa.snap.core.datamodel.Product) File(java.io.File) Test(org.junit.Test) ProcessorTest(org.esa.s1tbx.commons.test.ProcessorTest)

Aggregations

Product (org.esa.snap.core.datamodel.Product)372 Test (org.junit.Test)189 ReaderTest (org.esa.s1tbx.commons.test.ReaderTest)98 ProductValidator (org.esa.s1tbx.commons.test.ProductValidator)96 Band (org.esa.snap.core.datamodel.Band)95 TargetProduct (org.esa.snap.core.gpf.annotations.TargetProduct)65 SourceProduct (org.esa.snap.core.gpf.annotations.SourceProduct)50 File (java.io.File)45 MetadataElement (org.esa.snap.core.datamodel.MetadataElement)42 IOException (java.io.IOException)23 Path (java.nio.file.Path)20 ProductData (org.esa.snap.core.datamodel.ProductData)16 ArrayList (java.util.ArrayList)15 OperatorException (org.esa.snap.core.gpf.OperatorException)14 VirtualBand (org.esa.snap.core.datamodel.VirtualBand)12 GeoPos (org.esa.snap.core.datamodel.GeoPos)11 ProcessorTest (org.esa.s1tbx.commons.test.ProcessorTest)10 GeoCoding (org.esa.snap.core.datamodel.GeoCoding)10 PixelPos (org.esa.snap.core.datamodel.PixelPos)10 InputProductValidator (org.esa.snap.engine_utilities.gpf.InputProductValidator)10