BinningConfig { public BinningContext createBinningContext(Geometry region, ProductData.UTC startDate, Double periodDuration) { PlanetaryGrid planetaryGridInst = createPlanetaryGrid(); VariableContext variableContext = createVariableContext(); Aggregator[] aggregators = createAggregators(variableContext); BinManager binManager = createBinManager(variableContext, aggregators); binManager.setBinTracer(BinTracer.create(binManager, planetaryGridInst, outputFile)); DataPeriod dataPeriod = createDataPeriod(startDate, periodDuration, minDataHour); return new BinningContextImpl(planetaryGridInst, binManager, compositingType, getSuperSampling() != null ? getSuperSampling() : SUPER_SAMPLING_DEFAULT, getMaxDistanceOnEarth() != null ? getMaxDistanceOnEarth() : MAX_EARTH_DISTANCE_DEFAULT, dataPeriod, region); }  String getPlanetaryGrid(); void setPlanetaryGrid(String planetaryGrid); int getNumRows(); void setNumRows(int numRows); Double getMinDataHour(); void setMinDataHour(Double minDataHour); String getMaskExpr(); void setMaskExpr(String maskExpr); Integer getSuperSampling(); void setSuperSampling(Integer superSampling); Integer getMaxDistanceOnEarth(); void setMaxDistanceOnEarth(Integer maxDistanceOnEarth); CompositingType getCompositingType(); void setCompositingType(CompositingType type); VariableConfig[] getVariableConfigs(); void setVariableConfigs(VariableConfig... variableConfigs); AggregatorConfig[] getAggregatorConfigs(); void setAggregatorConfigs(AggregatorConfig... aggregatorConfigs); CellProcessorConfig getPostProcessorConfig(); void setPostProcessorConfig(CellProcessorConfig cellProcessorConfig); String getMetadataAggregatorName(); void setMetadataAggregatorName(String metadataAggregatorName); String getStartDateTime(); void setStartDateTime(String startDateTime); Double getPeriodDuration(); void setPeriodDuration(Double periodDuration); BinningOp.TimeFilterMethod getTimeFilterMethod(); void setTimeFilterMethod(BinningOp.TimeFilterMethod timeFilterMethod); String getOutputFile(); void setOutputFile(String outputFile); Geometry getRegion(); void setRegion(Geometry region); static BinningConfig fromXml(String xml); String toXml(); BinningContext createBinningContext(Geometry region, ProductData.UTC startDate, Double periodDuration); PlanetaryGrid createPlanetaryGrid(); Aggregator[] createAggregators(VariableContext variableContext); VariableContext createVariableContext(); static DataPeriod createDataPeriod(ProductData.UTC startUtc, Double periodDuration, Double minDataHour);  }
@Test public void testCreateBinningContext() { BinManager binManager = config.createBinningContext(null, null, null).getBinManager(); assertEquals(3, binManager.getAggregatorCount()); assertEquals(AggregatorAverage.class, binManager.getAggregator(0).getClass()); assertArrayEquals(new String[]{"tsm_mean", "tsm_sigma"}, binManager.getAggregator(0).getOutputFeatureNames()); assertEquals(AggregatorOnMaxSet.class, binManager.getAggregator(1).getClass()); assertArrayEquals(new String[]{"ndvi_max", "ndvi_mjd", "reflec_3", "reflec_7", "reflec_8"}, binManager.getAggregator(1).getOutputFeatureNames()); assertEquals(AggregatorMinMax.class, binManager.getAggregator(2).getClass()); assertArrayEquals(new String[]{"chl_min", "chl_max"}, binManager.getAggregator(2).getOutputFeatureNames()); assertArrayEquals(new String[]{"tsm_mean", "tsm_sigma", "ndvi_max", "ndvi_mjd", "reflec_3", "reflec_7", "reflec_8", "chl_min", "chl_max" }, binManager.getResultFeatureNames()); assertFalse(binManager.hasPostProcessor()); }