@Test public void testGoodPixelExpressionCriterion() throws Exception { MAConfig config = new MAConfig(); config.setMacroPixelSize(1); config.setMaxTimeDifference(null); config.setGoodPixelExpression("feq(X, 1.5)"); RecordSource input = new DefaultRecordSource(new TestHeader(true, "latitude", "longitude"), RecordUtils.create(new GeoPos(0.0, 0.0), null), RecordUtils.create(new GeoPos(0.0, 1- EPS), null), RecordUtils.create(new GeoPos(0.5, 0.0), null), RecordUtils.create(new GeoPos(0.5, 1- EPS), null), RecordUtils.create(new GeoPos(1- EPS, 0.0), null), RecordUtils.create(new GeoPos(1- EPS, 1- EPS), null)); ProductRecordSource output = createProductRecordSource(2, 3, input, config); List<Record> records = getRecords(output); assertEquals(6, records.size()); int goodRecords = 0; int allMaskedRecords = 0; for (Record record : records) { String reason = (String) record.getAnnotationValues()[EXCLUSION_REASON_INDEX]; if (reason.isEmpty()) { goodRecords++; } else if (reason.equals(PixelExtractor.EXCLUSION_REASON_ALL_MASKED)) { allMaskedRecords++; } } assertEquals(3, goodRecords); assertEquals(3, allMaskedRecords); }
@Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } ProductRecordSource(Product product,
                               Header referenceRecordHeader,
                               Iterable<PixelPosProvider.PixelPosRecord> pixelPosRecords,
                               MAConfig config,
                               AffineTransform transform); }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } ProductRecordSource(Product product,
                               Header referenceRecordHeader,
                               Iterable<PixelPosProvider.PixelPosRecord> pixelPosRecords,
                               MAConfig config,
                               AffineTransform transform); @Override Header getHeader(); @Override Iterable<Record> getRecords(); @Override String getTimeAndLocationColumnDescription(); }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } ProductRecordSource(Product product,
                               Header referenceRecordHeader,
                               Iterable<PixelPosProvider.PixelPosRecord> pixelPosRecords,
                               MAConfig config,
                               AffineTransform transform); @Override Header getHeader(); @Override Iterable<Record> getRecords(); @Override String getTimeAndLocationColumnDescription(); static final String SOURCE_NAME_ATT_NAME; static final String PIXEL_X_ATT_NAME; static final String PIXEL_Y_ATT_NAME; static final String PIXEL_LAT_ATT_NAME; static final String PIXEL_LON_ATT_NAME; static final String PIXEL_TIME_ATT_NAME; static final String PIXEL_MASK_ATT_NAME; }