private File getTimeSeriesDataProductLocation() { final String filename = timeSeriesDataProduct.getName() + DimapProductConstants.DIMAP_HEADER_FILE_EXTENSION; final File location; if (timeSeriesOutputDir != null) { location = new File(timeSeriesOutputDir, filename); } else { location = new File(filename); } return location; }
String generateID(Product product) { String id = product.getName(); id = id.replace(" ", "_"); id = id.replace(".", "_"); return id; }
private static String getProductLocation(Product product) { final File fileLocation = product.getFileLocation(); if (fileLocation != null) { return fileLocation.getAbsolutePath(); } else { return String.format("Not saved to disk [%s]", product.getName()); } }
private boolean containsGeocoding(Product product) { final boolean valid = product.getGeoCoding() != null; if (!valid) { logSkipped("The product '" + product.getName() + "' does not contain a geo coding."); } return valid; }
private boolean isProductOpen(final File productFile) { final Product openedProduct = visatApp.getOpenProduct(productFile); if (openedProduct != null) { visatApp.showInfoDialog("Product '" + openedProduct.getName() + "' is already opened.", null); return true; } return false; } }
private void writeFileHeader(PrintWriter out, Band[] bands) { ProductData.UTC utc = ProductData.UTC.create(new Date(), 0); out.printf("# Exported transect on %s%n", utc.format()); if (bands.length >= 0) { Product product = bands[0].getProduct(); out.printf("# Product name: %s%n", product.getName()); if (product.getFileLocation() != null) { out.printf("# Product file location: %s%n", product.getFileLocation().getAbsolutePath()); } } out.println(); }
private static String createDefaultFileName(final RasterDataNode raster, String maskName) { String productName = FileUtils.getFilenameWithoutExtension(raster.getProduct().getName()); String rasterName = raster.getName(); return productName + "_" + rasterName + "_" + maskName + "_Mask.txt"; }
private static String createDefaultFileName(ProductMetadataView productMetadataView) { return FileUtils.getFilenameWithoutExtension(productMetadataView.getProduct().getName()) + "_" + productMetadataView.getMetadataElement().getName() + ".txt"; }
private boolean intersectsTargetArea(Product product) { Area productArea = Utils.createProductArea(product); productArea.intersect(targetArea); boolean valid = !productArea.isEmpty(); if (!valid) { logSkipped("The product '" + product.getName() + "' does not intersect the target product."); } return valid; }
@Override public void selectionChanged(SelectionChangeEvent event) { String productName = ""; final Product selectedProduct = (Product) event.getSelection().getSelectedValue(); if (selectedProduct != null) { productName = FileUtils.getFilenameWithoutExtension(selectedProduct.getName()); } final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel(); targetProductSelectorModel.setProductName(productName + TARGET_PRODUCT_NAME_SUFFIX); } }
@Override public void selectionChanged(SelectionChangeEvent event) { String productName = ""; final Product selectedProduct = (Product) event.getSelection().getSelectedValue(); if (selectedProduct != null) { productName = FileUtils.getFilenameWithoutExtension(selectedProduct.getName()); } final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel(); targetProductSelectorModel.setProductName(productName + TARGET_PRODUCT_NAME_SUFFIX); } }
protected Product readProductNodes(Product sourceProduct, ProductSubsetDef subsetDef, String name, String desc) throws IOException { Guardian.assertNotNull("sourceProduct", sourceProduct); setNewProductName(name != null ? name : sourceProduct.getName()); setNewProductDesc(desc != null ? desc : sourceProduct.getDescription()); final Product product = readProductNodes(sourceProduct, subsetDef); product.setModified(true); return product; }
private ProductDescriptor createProductDescriptor(Product product) { return new ProductDescriptor(product.getName(), product.getProductType(), product.getSceneRasterWidth(), product.getSceneRasterHeight(), createBandDescriptors(), product.getDescription()); }
@Test public void testTwoNodesDirectCall() throws Exception { Map<String, Object> parameters = new HashMap<String, Object>(1); parameters.put("THR", 66.0); Product targetProduct = GPF.createProduct("SourcelessOp1Op2Graph", parameters, Collections.EMPTY_MAP); assertNotNull(targetProduct); assertEquals("Op2Name", targetProduct.getName()); OperatorProductReader operatorProductReader = (OperatorProductReader) targetProduct.getProductReader(); Operator operator = operatorProductReader.getOperatorContext().getOperator(); TestOps.Op2 op2 = (Op2) operator; assertEquals(66.0, op2.threshold, 0.00001); }
@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()); }
@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()); } }
@Override public void initialize() throws OperatorException { targetProduct = new Product(sourceProduct1.getName() + "_Add", sourceProduct1.getProductType(), sourceProduct1.getSceneRasterWidth(), sourceProduct1.getSceneRasterHeight()); Band[] bands = sourceProduct1.getBands(); for (Band sourceBand : bands) { targetProduct.addBand(sourceBand.getName(), sourceBand.getDataType()); } }
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); }