@Override protected Product doInBackground() throws Exception { for (String inputPath : inputPaths) { if (inputPath == null || inputPath.trim().length() == 0) { continue; } try { final TreeSet<File> fileSet = new TreeSet<>(); WildcardMatcher.glob(inputPath, fileSet); for (File file : fileSet) { final Product product = ProductIO.readProduct(file); if (product != null) { return product; } } } catch (IOException e) { Logger logger = SystemUtils.LOG; logger.severe("I/O problem occurred while scanning source product files: " + e.getMessage()); } } return null; }
public Alos2GeoTiffProductReader(ProductReaderPlugIn readerPlugIn) { super(readerPlugIn); //this.readerPlugIn = readerPlugIn; this.reader = reader; geoTiffReader = ProductIO.getProductReader("GeoTiff"); } @Override
WriterInfo(final String folderName, final String targetBandName, final Product product) { this.folderName = folderName; this.targetBandName = targetBandName.startsWith("i_") ? targetBandName.substring(2, targetBandName.length()) : targetBandName; this.product = product; productWriter = ProductIO.getProductWriter(formatName); if (productWriter == null) { throw new OperatorException("No data product writer for the '" + formatName + "' format available"); } productWriter.setIncrementalMode(false); } }
private static Boolean writeProduct(Product product, File file, String formatName, boolean incremental, ProgressMonitor pm) { Debug.assertNotNull(product); try { // todo - really add GPF dependency?!? /* if (product.getProductReader() instanceof OperatorProductReader) { GPF.writeProduct(product, file, formatName, incremental, pm); } else { ProductIO.writeProduct(product, file, formatName, incremental, pm); } */ ProductIO.writeProduct(product, file, formatName, incremental, pm); return !pm.isCanceled() ? true : null; } catch (RuntimeException e) { throw e; } catch (Exception e) { javax.swing.SwingUtilities.invokeLater(() -> Dialogs.showError("Writing failed", e.getMessage())); return false; } }
private Product openFirstProduct(String[] inputPaths) { if (inputPaths != null) { final Logger logger = SystemUtils.LOG; for (String inputPath : inputPaths) { if (inputPath == null || inputPath.trim().length() == 0) { continue; } try { final TreeSet<File> fileSet = new TreeSet<>(); WildcardMatcher.glob(inputPath, fileSet); for (File file : fileSet) { final Product product = ProductIO.readProduct(file); if (product != null) { return product; } } } catch (IOException e) { logger.severe("I/O problem occurred while scanning source product files: " + e.getMessage()); } } } return null; }
public K5GeoTiff(final ProductReaderPlugIn readerPlugIn, final Kompsat5Reader reader) { this.readerPlugIn = readerPlugIn; this.reader = reader; geoTiffReader = ProductIO.getProductReader("GeoTiff"); }
subsetInfo[n].file = new File(file.getParentFile(), createName(file, n + 1)); subsetInfo[n].productWriter = ProductIO.getProductWriter(formatName); if (subsetInfo[n].productWriter == null) { throw new OperatorException("No data product writer for the '" + formatName + "' format available");
public static void main(String[] args) throws Exception { final JFrame jFrame = new JFrame("Output parameter Definition Form"); Container contentPane = jFrame.getContentPane(); if (args.length == 0) { throw new IllegalArgumentException("Missing argument to product file."); } Product sourceProduct = ProductIO.readProduct(args[0]); CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:32632"); OutputGeometryFormModel model = new OutputGeometryFormModel(sourceProduct, targetCrs); OutputGeometryForm form = new OutputGeometryForm(model); contentPane.add(form); jFrame.setSize(400, 600); jFrame.setLocationRelativeTo(null); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jFrame.setVisible(true); } }); } }
public RapidEyeL1Reader(ProductReaderPlugIn readerPlugIn, Path colorPaletteFilePath) { super(readerPlugIn); this.gdalReader = ProductIO.getProductReader("GDAL-NITF-READER"); this.colorPaletteFilePath = colorPaletteFilePath; this.readerMap = new HashMap<>(); }
private Boolean exportProduct(Product product, String formatName) { final ProductWriter productWriter = ProductIO.getProductWriter(formatName); if (productWriter == null) { Dialogs.showError(getDisplayName(), MessageFormat.format("No writer found for format {0}.", formatName));
@Override protected void addGeoCoding(final Product product) { try { Product imageProduct = ProductIO.readProduct(imageFile); if (imageProduct != null) { product.setSceneGeoCoding(imageProduct.getSceneGeoCoding()); } } catch (IOException e) { //e.printStackTrace(); } }
static Product getClimatologiesProduct(String auxDataDir) throws IOException { final File climatologiesFile = new File(auxDataDir, CLIMATOLOGY_FILE_NAME); final ProductReader netCDFReader = ProductIO.getProductReader("NetCDF"); return netCDFReader.readProductNodes(climatologiesFile, null); }
subsetInfo.productWriter = ProductIO.getProductWriter(formatName); if (subsetInfo.productWriter == null) { throw new OperatorException("No data product writer for the '" + formatName + "' format available");
@Override protected Product doInBackground() throws Exception { Product product = null; try { defaultCursor = window.getCursor(); window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); file = chooser.getSelectedFile(); product = ProductIO.readProduct(file); } catch (IOException e) { handleError(e.getMessage()); } return product; }
File fakeTileFile = new File(tileFolder, subTileFilename.replace(TILE_TOKEN, SUPER_TILE_TOKEN)); File subTileArchive = new File(tileFolder, fakeTileFile.getName().replace(FILE_EXT, ARCHIVE_EXT)); final ProductReader reader = ProductIO.getProductReader(JAXA_FORMAT); if (!subTileArchive.exists()) { tile = new FileLandCoverTile(this, fakeTileFile, reader, ARCHIVE_EXT);
subsetInfo.file = new File(targetFolder, targetProduct.getName()); subsetInfo.productWriter = ProductIO.getProductWriter(formatName); if (subsetInfo.productWriter == null) { throw new OperatorException("No data product writer for the '" + formatName + "' format available");
/** * Get GIM product. */ private void getGIMProduct() { try { if(sourceProduct.getFileLocation() == null) { useIncidenceAngleFromGIM = false; return; } File sourceGIMFile = new File(sourceProduct.getFileLocation().getParentFile(), "AUXRASTER" + File.separator + "GIM.tif"); if (sourceGIMFile.exists()) { sourceGIMProduct = ProductIO.readProduct(sourceGIMFile); } else { useIncidenceAngleFromGIM = false; } } catch (Exception e) { throw new OperatorException("TerraSARXCalibrator: " + e); } }
private void attachNewDimapReaderInstance(Product product, File newFile) throws IOException { DimapProductReader productReader = (DimapProductReader) ProductIO.getProductReader(DimapProductConstants.DIMAP_FORMAT_NAME); productReader.bindProduct(newFile, product); product.setProductReader(productReader); Band[] bands = product.getBands(); for (Band band : bands) { if (band.isSourceImageSet() && band.getSourceImage().getImage(0) instanceof BandOpImage) { band.setSourceImage(null); } } }
return ProductIO.readProduct(newFile[0]); } catch (IOException e) {
Product product = sourceProductMap.get(file); if (product == null) { product = ProductIO.readProduct(file); sourceProductMap.put(file, product); if (Boolean.TRUE.equals(getPropertyValue(PROPERTY_SHOW_SOURCE_PRODUCTS))) {