예제 #1
0
  @Test
  public void testProcessProductWithMaskAndSuperSampling() throws Exception {
    int superSampling = 3;
    BinningContext ctx = createValidCtx(superSampling, null);
    VariableContextImpl variableContext = (VariableContextImpl) ctx.getVariableContext();
    variableContext.setMaskExpr("floor(X) % 2");
    Product product = createProduct();

    MySpatialBinConsumer mySpatialBinConsumer = new MySpatialBinConsumer();
    SpatialBinner spatialBinner = new SpatialBinner(ctx, mySpatialBinConsumer);
    long numObservations =
        SpatialProductBinner.processProduct(
            product, spatialBinner, new HashMap<Product, List<Band>>(), ProgressMonitor.NULL);
    assertEquals(32 / 2 * 256 * superSampling * superSampling, numObservations);
    assertEquals(numObservations, mySpatialBinConsumer.numObs);
  }
예제 #2
0
  @Test
  public void testAddedBands() throws Exception {

    BinningContext ctx = createValidCtx(1, null);
    Product product = createProduct();

    HashMap<Product, List<Band>> productBandListMap = new HashMap<Product, List<Band>>();
    SpatialProductBinner.processProduct(
        product,
        new SpatialBinner(ctx, new MySpatialBinConsumer()),
        productBandListMap,
        ProgressMonitor.NULL);

    assertEquals(1, productBandListMap.size());
    List<Band> bandList = productBandListMap.get(product);
    assertNotNull(bandList);
    VariableContext variableContext = ctx.getVariableContext();
    assertEquals(variableContext.getVariableCount(), bandList.size());
    for (int i = 0; i < bandList.size(); i++) {
      assertEquals(variableContext.getVariableName(i), bandList.get(i).getName());
    }
  }