@Test public void test3x3MacroPixelGeneratesFloatArraysWith9Elements() throws Exception { MAConfig config = new MAConfig(); config.setCopyInput(false); config.setMacroPixelSize(3); int w = 2 * 3; int h = 3 * 3; float lon = 0.0F + 1.0F / (w - 1.0F); float lat = 1.0F - 1.0F / (h - 1.0F); RecordSource input = new DefaultRecordSource(new TestHeader(true, "latitude", "longitude"), RecordUtils.create(new GeoPos(lat, lon), null)); ProductRecordSource output = createProductRecordSource(w, h, input, config); List<Record> records = getRecords(output); assertEquals(1, records.size()); final int PIXEL_X = 2; final int PIXEL_Y = 3; final int B2 = 7; Object[] firstAttributeValues = records.get(0).getAttributeValues(); Object pixelXValue = firstAttributeValues[PIXEL_X]; assertEquals(int[].class, pixelXValue.getClass()); int[] actualX = (int[]) pixelXValue; assertEquals(9, actualX.length); assertArrayEquals(new int[]{0, 1, 2, 0, 1, 2, 0, 1, 2}, actualX); Object pixelYValue = firstAttributeValues[PIXEL_Y]; assertEquals(int[].class, pixelYValue.getClass()); int[] actualY = (int[]) pixelYValue; assertEquals(9, actualY.length); assertArrayEquals(new int[]{0, 0, 0, 1, 1, 1, 2, 2, 2}, actualY); Object b2Value = firstAttributeValues[B2]; assertEquals(int[].class, b2Value.getClass()); int[] actualB2 = (int[]) b2Value; assertEquals(9, actualB2.length); assertArrayEquals(new int[]{0, 0, 0, 1, 1, 1, 2, 2, 2}, actualB2); }
@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; }