@Override public boolean accept(File fileToAccept) { if (fileToAccept.isDirectory()) { return true; } return StringHelper.endsWithIgnoreCase(fileToAccept.getName(), this.driverInfo.getExtensionName()); }
private boolean isSentinelProduct(Product product) { return StringHelper.startsWithIgnoreCase(product.getProductType(), "S2_MSI_Level"); }
while (entries.hasMoreElements()) { JarEntry currentEntry = entries.nextElement(); if (StringHelper.containsIgnoreCase(currentEntry.getName(), libraryName)) { jarEntry = currentEntry; break;
@Override public void initialize() { validateSourceProducts(); if (StringHelper.isNullOrEmpty(this.landCoverName)) { throw new OperatorException("No land cover name specified."); } if (StringHelper.isNullOrEmpty(this.landCoverMapIndices)) { throw new OperatorException("No land cover map indices specified."); } this.currentProductBandsNames = findBandNames(this.currentSourceProduct); this.previousProductBandsNames = findBandNames(this.previousSourceProduct); int sceneWidth = this.currentSourceProduct.getSceneRasterWidth(); int sceneHeight = this.currentSourceProduct.getSceneRasterHeight(); Dimension tileSize = JAI.getDefaultTileSize(); this.targetProduct = new Product("ForestCoverChange", this.currentSourceProduct.getProductType(), sceneWidth, sceneHeight); this.targetProduct.setPreferredTileSize(tileSize); ProductUtils.copyGeoCoding(this.currentSourceProduct, this.targetProduct); Band targetBand = new Band("band_1", ProductData.TYPE_INT32, sceneWidth, sceneHeight); this.targetProduct.addBand(targetBand); this.threadCount = Runtime.getRuntime().availableProcessors() - 1; this.threadPool = Executors.newCachedThreadPool(); }
private boolean isSpotProduct(Product product) { return StringHelper.startsWithIgnoreCase(product.getProductType(), "SPOTSCENE"); }
@Override public DecodeQualification getDecodeQualification(Object input) { if (GDALInstallInfo.INSTANCE.isPresent()) { String filePath = null; if (input instanceof String) { filePath = (String)input; } else if (input instanceof File) { filePath = ((File)input).getAbsolutePath(); } else if (input instanceof Path) { filePath = ((Path)input).toFile().getAbsolutePath(); } else { throw new IllegalArgumentException("Unknown type '"+input.getClass()+"' for input '"+ input.toString()+"'."); } Iterator<String> it = this.extensions.iterator(); while (it.hasNext()) { String extension = it.next(); if (StringHelper.endsWithIgnoreCase(filePath, extension)) { return DecodeQualification.SUITABLE; } } } return DecodeQualification.UNABLE; }
public static boolean isSentinelProduct(Product product) { return StringHelper.startsWithIgnoreCase(product.getProductType(), "S2_MSI_Level"); }
if (StringHelper.endsWithIgnoreCase(filePath, ".rat.hdr") || StringHelper.endsWithIgnoreCase(filePath, "bin.hdr") || StringHelper.endsWithIgnoreCase(filePath, ".snaphu.hdr")) { if (StringHelper.endsWithIgnoreCase(filePath, ".hdr")) { File hdrFile = FileUtils.exchangeExtension(inputFile, ".hdr"); File dblFile = FileUtils.exchangeExtension(inputFile, ".dbl");
for (MetadataElement element : elements) { String name = element.getName(); if (StringHelper.startsWithIgnoreCase(name, "SPOTSCENE")) { currentElement = element; break;
if (!StringHelper.endsWithIgnoreCase(fileName, this.writerDriver.getExtensionName())) { throw new IllegalArgumentException("The extension of the file name '" + fileName + "' is unknown.");
/** * Find the incidence angle of a Spot product. * @param product the Spot product * @return the incidence angle of a Spot product */ public static float extractIncidenceAngleFromSpotProduct(Product product) { MetadataElement metadataRoot = product.getMetadataRoot(); MetadataElement[] elements = metadataRoot.getElements(); MetadataElement currentElement = null; for (MetadataElement element : elements) { String name = element.getName(); if (StringHelper.startsWithIgnoreCase(name, "SPOTSCENE")) { currentElement = element; break; } } String[] pathElement = {"Dataset_Sources", "Source_Information", "Scene_Source"}; currentElement = findTreeElementByNameAttribute(currentElement, pathElement); MetadataAttribute incidenceAngleAttribute = currentElement.getAttribute("INCIDENCE_ANGLE"); ProductData data = incidenceAngleAttribute.getData(); return Float.parseFloat(data.getElemString()); }
private void copyMasks(Product sourceProduct, Product targetProduct, String...bandNames) { if (isSentinelProduct(sourceProduct)) { final ProductNodeGroup<Mask> sourceMaskGroup = sourceProduct.getMaskGroup(); int nodeCount = sourceMaskGroup.getNodeCount(); for (int i = 0; i < nodeCount; i++) { final Mask mask = sourceMaskGroup.get(i); String maskName = mask.getName(); if (!targetProduct.getMaskGroup().contains(maskName) && StringHelper.endsWithIgnoreCase(maskName, bandNames)) { if (mask.getImageType().transferMask(mask, targetProduct) == null) { Mask targetMask = new Mask(maskName, mask.getRasterWidth(), mask.getRasterHeight(), mask.getImageType()); ProductUtils.copyRasterDataNodeProperties(mask, targetMask); targetMask.setSourceImage(mask.getSourceImage()); targetProduct.getMaskGroup().add(targetMask); } } } } else { final ProductNodeGroup<Mask> sourceMaskGroup = sourceProduct.getMaskGroup(); for (int i = 0; i < sourceMaskGroup.getNodeCount(); i++) { final Mask mask = sourceMaskGroup.get(i); if (!targetProduct.getMaskGroup().contains(mask.getName())) { mask.getImageType().transferMask(mask, targetProduct); } } } }
Product selectedProduct = getSelectedProduct(); if (selectedProduct != null) { boolean isSentinel2 = StringHelper.startsWithIgnoreCase(selectedProduct.getProductType(), "S2_MSI_Level"); boolean isSpot = StringHelper.startsWithIgnoreCase(selectedProduct.getProductType(), "SPOTSCENE"); BindingContext bindingContext = getBindingContext(); PropertySet propertySet = bindingContext.getPropertySet();