StatisticsOp extends Operator { static Band getBand(BandConfiguration configuration, Product product) { final Band band; if (configuration.sourceBandName != null) { band = product.getBand(configuration.sourceBandName); band.setNoDataValueUsed(true); } else { band = product.addBand(configuration.expression.replace(" ", "_"), configuration.expression, ProductData.TYPE_FLOAT64); } if (band == null) { throw new OperatorException(MessageFormat.format("Band ''{0}'' does not exist in product ''{1}''.", configuration.sourceBandName, product.getName())); } return band; }  @Override void initialize(); static String[] getAlgorithmNames(int[] percentiles); static final String DATETIME_PATTERN; static final String MAXIMUM; static final String MINIMUM; static final String MEDIAN; static final String AVERAGE; static final String SIGMA; static final String MAX_ERROR; static final String TOTAL; static final String PERCENTILE_PREFIX; static final String PERCENTILE_SUFFIX; static final String DEFAULT_PERCENTILES; static final int[] DEFAULT_PERCENTILES_INTS; }
@Test public void testGetBand() throws Exception { final BandConfiguration configuration = new BandConfiguration(); final Product testProduct = TestUtil.getTestProduct(); configuration.expression = "algal_2 * PI"; configuration.sourceBandName = null; final Band virtualBand = StatisticsOp.getBand(configuration, testProduct); assertEquals("algal_2_*_PI", virtualBand.getName()); assertTrue(virtualBand instanceof VirtualBand); assertEquals("algal_2 * PI", ((VirtualBand) virtualBand).getExpression()); }