Esempio n. 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);
  }
Esempio n. 2
0
  private static BinningContext createValidCtx(int superSampling, DataPeriod dataPeriod) {
    VariableContextImpl variableContext = new VariableContextImpl();
    variableContext.setMaskExpr("!invalid");
    variableContext.defineVariable("invalid", "0");
    variableContext.defineVariable("a", "2.4");
    variableContext.defineVariable("b", "1.8");

    PlanetaryGrid planetaryGrid = new SEAGrid(6);
    BinManager binManager =
        new BinManager(
            variableContext,
            new AggregatorAverage(variableContext, "a", 0.0),
            new AggregatorAverage(variableContext, "b", 0.0));

    return new BinningContextImpl(
        planetaryGrid, binManager, CompositingType.BINNING, superSampling, dataPeriod, null);
  }