@Override public void initialize() throws OperatorException { targetProduct = new Product("N", "T", sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); targetProduct.addBand("c", ProductData.TYPE_FLOAT32); }
/** * Adds the metadat to the product. */ private void addMetadata(Product prodRet) { _file.getMetadata(prodRet.getMetadataRoot()); }
@Override public void initialize() throws OperatorException { sourceBand = sourceProduct.getBand(bandName); targetProduct = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); targetBand = targetProduct.addBand(bandName, sourceBand.getDataType()); }
private static void removeGeoCodingAndTiePointGrids(Product product) { product.setGeoCoding(null); final TiePointGrid[] pointGrids = product.getTiePointGrids(); for (TiePointGrid pointGrid : pointGrids) { product.removeTiePointGrid(pointGrid); } }
void removeAllVariableConfigBands(Product contextProduct) { Band[] bands = contextProduct.getBands(); for (Band band : bands) { if(band instanceof VariableConfigBand) { contextProduct.removeBand(band); } } }
public static GeoTIFFMetadata createGeoTIFFMetadata(final Product product) { final GeoCoding geoCoding = product.getGeoCoding(); final int w = product.getSceneRasterWidth(); final int h = product.getSceneRasterHeight(); return createGeoTIFFMetadata(geoCoding, w, h); }
@Override public void initialize() throws OperatorException { targetProduct = new Product(sourceProduct.getName() + "_MulConst", sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); Band[] bands = sourceProduct.getBands(); for (Band sourceBand : bands) { targetProduct.addBand(sourceBand.getName(), sourceBand.getDataType()); } }
@Test public void testDestWithoutLatLonBands() { final ProductSubsetDef subsetDef = null; final Product destP = new Product("dest", "dest", sourceP.getSceneRasterWidth(), sourceP.getSceneRasterHeight()); assertEquals(true, sourceP.transferGeoCodingTo(destP, subsetDef)); final GeoCoding destGeoCoding = destP.getGeoCoding(); assertNotNull(destGeoCoding); assertEquals(true, destGeoCoding instanceof BasicPixelGeoCoding); }
private Product createSourceProduct() throws FactoryException, TransformException { Product sourceProduct = new Product("MERIS", "MARCO", 10, 10); sourceProduct.addBand("x", "5.1"); sourceProduct.setGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 10, 10, 0, 0, 1, 1)); return sourceProduct; }
@Test public void testWriteReadVirtualBandIsNotExcludedInProduct() throws IOException { final VirtualBand virtualBand = new VirtualBand("VB", ProductData.TYPE_FLOAT32, outProduct.getSceneRasterWidth(), outProduct.getSceneRasterHeight(), "X * Y"); outProduct.addBand(virtualBand); final Product inProduct = writeReadProduct(); assertEquals(2, inProduct.getNumBands()); assertNotNull(inProduct.getBand("VB")); }
@Override public void customizeProduct(Product product) { product.removeBand(product.getBand("num_passes")); Band const3 = product.addBand("const3", ProductData.TYPE_INT32); int width = product.getSceneRasterWidth(); int height = product.getSceneRasterHeight(); const3.setSourceImage(ConstantDescriptor.create((float) width, (float) height, new Integer[]{3}, null)); } }
@Override protected void setUp() throws Exception { new File(FILENAME).delete(); _productWriter = new GeoTiffProductWriter(new GeoTiffProductWriterPlugIn()); _product = new Product("temp", "type", 10, 20); _product.addBand("b1", ProductData.TYPE_UINT32); fillBandWithData(_product.getBand("b1"), 1); }
private ProductDescriptor createProductDescriptor(Product product) { return new ProductDescriptor(product.getName(), product.getProductType(), product.getSceneRasterWidth(), product.getSceneRasterHeight(), createBandDescriptors(), product.getDescription()); }
@Before public void setup() { Product product = new Product("P", "T", 10, 10); product.setFileLocation(new File(String.format("out/%s.dim", product.getName()))); band = new VirtualBand("V", ProductData.TYPE_INT32, 10, 10, "42"); product.addBand(band); productManager = new ProductManager(); productManager.addProduct(product); }
public static void main(String[] args) throws TransformException, FactoryException { Product product1 = new Product("A", "B", 360, 180); product1.setGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 360, 180, -180.0, 90.0, 1.0, 1.0, 0.0, 0.0)); PinDescriptor descriptor = PinDescriptor.getInstance(); Placemark pin1 = Placemark.createPointPlacemark(descriptor, "pin_1", "Pin 1", "Schnatter!", new PixelPos(0, 0), new GeoPos(), product1.getGeoCoding()); product1.getPinGroup().add(pin1); showEditPlacemarkDialog(null, product1, pin1, descriptor); } }
@Test public void testGeoLatLon() throws IOException { parameterMap.put("crs", WGS84_CODE); final Product targetPoduct = createReprojectedProduct(); assertNotNull(targetPoduct); // because source is rectangular the size of source is preserved assertEquals(50, targetPoduct.getSceneRasterWidth()); assertEquals(50, targetPoduct.getSceneRasterHeight()); assertNotNull(targetPoduct.getGeoCoding()); assertPixelValue(targetPoduct.getBand(FLOAT_BAND_NAME), 23.5f, 13.5f, (double) 299, EPS); }
private void performTest(float accuracy) throws IOException { final Product inProduct = writeReadProduct(); assertEquals(outProduct.getName(), inProduct.getName()); assertEquals(outProduct.getProductType(), inProduct.getProductType()); assertEquals(outProduct.getNumBands(), inProduct.getNumBands()); for (int i = 0; i < outProduct.getNumBands(); i++) { assertEquality(outProduct.getBandAt(i), inProduct.getBandAt(i)); } assertEquals(location, inProduct.getFileLocation()); assertNotNull(inProduct.getGeoCoding()); assertEquality(outProduct.getGeoCoding(), inProduct.getGeoCoding(), accuracy); }
@Override public void initialize() throws OperatorException { Product targetProduct = new Product("target", "target", 100, 100); for (Band srcBand : source.getBands()) { Band band = targetProduct.addBand(srcBand.getName(), srcBand.getDataType()); band.setSourceImage(srcBand.getSourceImage()); } setTargetProduct(targetProduct); }
private static Product createDummyProduct() { Product dummyProduct = new Product("blah", "blahType", 360, 180); dummyProduct.setGeoCoding(new VectorDataNodeReaderTest.DummyGeoCoding()); return dummyProduct; }