@Override public void initialize() throws OperatorException { int[] radArray; try { radArray = Arrays.stream(radius.split(",")) .map(String::trim).mapToInt(Integer::parseInt).toArray(); } catch (Exception ex) { throw new OperatorException("Radius parameter not valid. Provide a list of integer values separated by comma!"); } if (radArray != null && radArray.length > 0) { targetProduct = new Product("coregistered_" + slaveProduct.getName(), slaveProduct.getProductType(), slaveProduct.getSceneRasterWidth(), slaveProduct.getSceneRasterHeight()); targetProduct.setDescription(slaveProduct.getDescription()); targetProduct.setSceneGeoCoding(slaveProduct.getSceneGeoCoding()); doExecute(masterProduct, slaveProduct, radArray); } }
private Product createComplexProduct(final File inputFile, final Header header, final int bandType) throws IOException { final int width = header.getNumSamples(); final int height = header.getNumLines(); final Product product = new Product(inputFile.getName(), "RAT", width, height); product.setProductReader(this); product.setFileLocation(inputFile); product.setDescription(header.getDescription()); product.getMetadataRoot().addElement(header.getAsMetadata()); initGeoCoding(product, header); applyBeamProperties(product, header.getBeamProperties()); final Band tgtBandI = new Band("i_band", bandType, width, height); tgtBandI.setUnit("real"); product.addBand(tgtBandI); final Band tgtBandQ = new Band("q_band", bandType, width, height); tgtBandQ.setUnit("imaginary"); product.addBand(tgtBandQ); ReaderUtils.createVirtualIntensityBand(product, tgtBandI, tgtBandQ, "_band"); isComplex = true; String ratFilePath = inputFile.getPath().substring(0, inputFile.getPath().length()-4); inStream = new FileImageInputStream(new File(ratFilePath)); inStream.setByteOrder(header.getJavaByteOrder()); return product; }
private Product createComplexProduct(final File inputFile, final Header header, final int bandType) throws IOException { final int width = header.getNumSamples(); final int height = header.getNumLines(); final Product product = new Product(inputFile.getName(), "RAT", width, height); product.setProductReader(this); product.setFileLocation(inputFile); product.setDescription(header.getDescription()); product.getMetadataRoot().addElement(header.getAsMetadata()); initGeoCoding(product, header); applyBeamProperties(product, header.getBeamProperties()); final Band tgtBandI = new Band("i_band", bandType, width, height); tgtBandI.setUnit("real"); product.addBand(tgtBandI); final Band tgtBandQ = new Band("q_band", ProductData.TYPE_FLOAT32, width, height); tgtBandQ.setUnit("imaginary"); product.addBand(tgtBandQ); ReaderUtils.createVirtualIntensityBand(product, tgtBandI, tgtBandQ, "_band"); isComplex = true; String ratFilePath = inputFile.getPath().substring(0, inputFile.getPath().length()-4); inStream = new FileImageInputStream(new File(ratFilePath)); inStream.setByteOrder(header.getJavaByteOrder()); return product; }
@Test public void testSelectProfile_6() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[0]; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription("This is some description text."); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNull(profile); }
@Test public void testNoDescriptionSet() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[] { new RGBImageProfile("p1", new String[]{"", "", ""}, new String[]{"matches", "not at", "all"}), }; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription(null); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNotNull(profile); } }
protected static void updateProduct(final Product product, final MetadataElement newRoot) { final MetadataElement root = product.getMetadataRoot(); for(MetadataElement elem : newRoot.getElements()) { root.addElement(elem); } final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product); product.setStartTime(absRoot.getAttributeUTC(AbstractMetadata.first_line_time)); product.setEndTime(absRoot.getAttributeUTC(AbstractMetadata.last_line_time)); product.setProductType(absRoot.getAttributeString(AbstractMetadata.PRODUCT_TYPE)); product.setDescription(absRoot.getAttributeString(AbstractMetadata.SPH_DESCRIPTOR)); }
product.setDescription(metadataFile.getProductDescription());
/** * Create target product. */ void createTargetProduct() { targetProduct = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); ProductUtils.copyMetadata(sourceProduct, targetProduct); ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyFlagCodings(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); ProductUtils.copyMasks(sourceProduct, targetProduct); ProductUtils.copyVectorData(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); targetProduct.setDescription(sourceProduct.getDescription()); }
@Test public void testSelectProfile_4() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[] { new RGBImageProfile("p1", new String[]{"", "", ""}, new String[]{"matches", "not at", "all"}), new RGBImageProfile("p2", new String[]{"", "", ""}, new String[]{"some_different_type", "*name_*3", null}), new RGBImageProfile("p3", new String[]{"", "", ""}, new String[]{"strange type", "*name_*3", null}), new RGBImageProfile("p4", new String[]{"", "", ""}, new String[]{"strange type", "*name_*3", "*s some*"}), }; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription("This is some description text."); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNotNull(profile); assertSame(rgbImageProfiles[3], profile); // name and description match }
product.setDescription(getProductDescription());
@Test public void testSelectProfile_1() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[] { new RGBImageProfile("p1", new String[]{"", "", ""}, new String[]{"matches", "not at", "all"}), new RGBImageProfile("p2", new String[]{"", "", ""}, new String[]{"some_different_type", "*name_*3", null}), new RGBImageProfile("p3", new String[]{"", "", ""}, new String[]{"*me_ty*", "*name_*3", null}), new RGBImageProfile("p4", new String[]{"", "", ""}, new String[]{"*me_ty*", "*name_*3", "*s some*"}), }; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription("This is some description text."); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNotNull(profile); assertSame(rgbImageProfiles[3], profile); // all patterns match }
@Test public void testSelectProfile_2() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[] { new RGBImageProfile("p1", new String[]{"", "", ""}, new String[]{"matches", "not at", "all"}), new RGBImageProfile("p2", new String[]{"", "", ""}, new String[]{"some_different_type", "*name_*3", null}), new RGBImageProfile("p3", new String[]{"", "", ""}, new String[]{"*me_ty*", null, null}), new RGBImageProfile("p4", new String[]{"", "", ""}, new String[]{null, "*name_*3", "*s some*"}), }; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription("This is some description text."); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNotNull(profile); assertSame(rgbImageProfiles[2], profile); // type matches }
@Test public void testSelectProfile_3() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[] { new RGBImageProfile("p1", new String[]{"", "", ""}, new String[]{"matches", "not at", "all"}), new RGBImageProfile("p2", new String[]{"", "", ""}, new String[]{"some_different_type", "*name_*3", null}), new RGBImageProfile("p3", new String[]{"", "", ""}, new String[]{null, "*name_*3", null}), new RGBImageProfile("p4", new String[]{"", "", ""}, new String[]{null, "*name_*3", "*s some*"}), }; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription("This is some description text."); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNotNull(profile); assertSame(rgbImageProfiles[3], profile); // name and description match }
@Test public void testSelectProfile_5() throws Exception { RGBImageProfile[] rgbImageProfiles = new RGBImageProfile[] { new RGBImageProfile("p1", new String[]{"", "", ""}, new String[]{"matches", "not at", "all"}), new RGBImageProfile("p2", new String[]{"", "", ""}, new String[]{"some_different_type", "*name_*3", null}), new RGBImageProfile("p3", new String[]{"", "", ""}, new String[]{"*me_ty*", "*name_*3", null}), new RGBImageProfile("p4", new String[]{"", "", ""}, new String[]{"*me_ty*", "*name_*3", null}), }; Product product = new Product("some_name_123", "some_type_123", 1, 1); product.setDescription("This is some description text."); RGBImageProfile profile = RGBImageProfilePane.findProfileForProductPattern(rgbImageProfiles, product); assertNotNull(profile); assertSame(rgbImageProfiles[2], profile); // equal, so earlier profile is chosen }
@Override public Product createProduct() throws IOException { final MetadataElement newRoot = addMetaData(); findImages(newRoot); final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); determineProductDimensions(absRoot); final int sceneWidth = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); final int sceneHeight = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); final Product product = new Product(getProductName(), getProductType(), sceneWidth, sceneHeight); updateProduct(product, newRoot); addBands(product); addGeoCoding(product); product.setName(getProductName()); //product.setProductType(getProductType()); product.setDescription(getProductDescription()); ReaderUtils.addMetadataIncidenceAngles(product); ReaderUtils.addMetadataProductSize(product); return product; } }
public Product createProduct() throws Exception { final MetadataElement newRoot = addMetaData(); findImages(newRoot); Dimension dim = getProductDimensions(newRoot); final Product product = new Product(getProductName(), getProductType(), dim.width, dim.height); updateProduct(product, newRoot); addBands(product); InputProductValidator validator = new InputProductValidator(product); isMapProjected = validator.isMapProjected(); addGeoCoding(product); addTiePointGrids(product); product.setName(getProductName()); product.setProductType(getProductType()); product.setDescription(getProductDescription()); ReaderUtils.addMetadataIncidenceAngles(product); ReaderUtils.addMetadataProductSize(product); return product; }
@Override public void initialize() throws OperatorException { final int rasterWidth = sourceProduct.getSceneRasterWidth(); final int rasterHeight = sourceProduct.getSceneRasterHeight(); geoCoding = sourceProduct.getSceneGeoCoding(); targetProduct = new Product("Elevation Product", "Elevation", rasterWidth, rasterHeight); targetProduct.setDescription("Elevation for " + sourceProduct.getName()); ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setPointingFactory(sourceProduct.getPointingFactory()); final ElevationModelRegistry elevationModelRegistry = ElevationModelRegistry.getInstance(); ElevationModelDescriptor demDescriptor = elevationModelRegistry.getDescriptor("GMTED2010_30"); if (demDescriptor == null || !demDescriptor.canBeDownloaded()) { demDescriptor = elevationModelRegistry.getDescriptor("GETASSE30"); if (demDescriptor == null || !demDescriptor.canBeDownloaded()) { throw new OperatorException(" No DEM installed (neither GETASSE30 nor GMTED2010_30)."); } } getLogger().info("Dsing DEM: " + demDescriptor.getName()); dem = demDescriptor.createDem(Resampling.BILINEAR_INTERPOLATION); noDataValue = dem.getDescriptor().getNoDataValue(); String elevName = "elevation"; Band elevBand = targetProduct.addBand(elevName, ProductData.TYPE_INT16); elevBand.setNoDataValue(noDataValue); elevBand.setNoDataValueUsed(true); elevBand.setUnit("meters"); elevBand.setDescription(demDescriptor.getName()); setTargetProduct(targetProduct); }
@Override protected Product readProductNodesImpl() throws IOException { SpotDimapMetadata dimapMetadata = wrappingMetadata.getComponentMetadata(0); int width = wrappingMetadata.getExpectedVolumeWidth(); int height = wrappingMetadata.getExpectedVolumeHeight(); Product rootProduct = new Product(dimapMetadata.getProductName(), SpotConstants.DIMAP_FORMAT_NAMES[0], width, height); rootProduct.getMetadataRoot().addElement(wrappingMetadata.getRootElement()); ProductData.UTC centerTime = dimapMetadata.getCenterTime(); rootProduct.setStartTime(centerTime); rootProduct.setEndTime(centerTime); rootProduct.setDescription(dimapMetadata.getProductDescription()); int numBands = dimapMetadata.getNumBands(); String[] bandNames = wrappingMetadata.getComponentMetadata(0).getBandNames(); for (int i = 0; i < numBands; i++) { ColorPaletteBand band = new ColorPaletteBand(bandNames[i], dimapMetadata.getPixelDataType(), width, height, this.colorPaletteFilePath); rootProduct.addBand(band); bandMap.put(band, new BandMatrix(wrappingMetadata.getExpectedTileComponentRows(), wrappingMetadata.getExpectedTileComponentCols())); } for (int fileIndex = 0; fileIndex < wrappingMetadata.getNumComponents(); fileIndex++) { addBands(rootProduct, wrappingMetadata.getComponentMetadata(fileIndex)); addMasks(rootProduct, wrappingMetadata.getComponentMetadata(fileIndex)); } rootProduct.setModified(false); return rootProduct; }
@Override public Product createProduct() throws IOException { final MetadataElement newRoot = addMetaData(); addBinaryDataToProduct(newRoot); findImages(newRoot); final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); final int sceneWidth = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); final int sceneHeight = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); final Product product = new Product(getProductName(), getProductType(), sceneWidth, sceneHeight); updateProduct(product, newRoot); addTiePointGrids(product); // empty addBands(product); addGeoCoding(product); product.setName(getProductName()); product.setProductType(getProductType()); product.setDescription(getProductDescription()); product.setFileLocation(getBaseDir()); ReaderUtils.addMetadataProductSize(product); return product; } }
product.setDescription(getProductDescription());