private String writeEndTime() { if (srcProduct.getEndTime() != null) { double diff = srcProduct.getEndTime().getMJD() - dateDay.getMJD(); double seconds = diff * daysToSeconds; return seconds + tab + 's'; } return ""; }
private void getNewXCAFile() throws Exception { if (auxFile != null && auxFile.contains(CalibrationOp.EXTERNAL_AUX)) { if (externalAuxFile != null && externalAuxFile.exists()) { if (!externalAuxFile.getName().contains("ASA_XCA")) { throw new OperatorException("Invalid XCA file for ASAR product"); } newXCAFileName = externalAuxFile.getName(); newXCAFilePath = externalAuxFile.getAbsolutePath(); } else { throw new OperatorException("No external auxiliary file is specified."); } } else { final Date startDate = sourceProduct.getStartTime().getAsDate(); final Date endDate = sourceProduct.getEndTime().getAsDate(); final File localFolder = SystemUtils.getAuxDataPath().resolve("AuxCal").resolve("ENVISAT").toFile(); newXCAFileName = findXCAFile(localFolder, startDate, endDate); if(newXCAFileName == null) { final URL remotePath = new URL(Settings.getPath("AuxCal.ENVISAT.remotePath")); final File localFile = new File(localFolder, "ENVISAT_XCA.zip"); final DownloadableArchive archive = new DownloadableArchive(localFile, remotePath); archive.getContentFiles(); newXCAFileName = findXCAFile(localFolder, startDate, endDate); } newXCAFilePath = localFolder.toString() + File.separator + newXCAFileName; } }
private ProductData.UTC getSourceMeanTime() { ProductData.UTC startTime = sourceProduct.getStartTime(); ProductData.UTC endTime = sourceProduct.getEndTime(); ProductData.UTC meanTime; if (startTime != null && endTime != null) { meanTime = new ProductData.UTC(0.5 * (startTime.getMJD() + endTime.getMJD())); } else if (startTime != null) { meanTime = startTime; } else if (endTime != null) { meanTime = endTime; } else { meanTime = null; } return meanTime; }
private Product createTargetProduct(Product sourceProduct, String name, String type) { final int sceneWidth = sourceProduct.getSceneRasterWidth(); final int sceneHeight = sourceProduct.getSceneRasterHeight(); Product targetProduct = new Product(name, type, sceneWidth, sceneHeight); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); return targetProduct; }
private Product createTargetProduct() { final int sceneWidth = sourceProduct.getSceneRasterWidth(); final int sceneHeight = sourceProduct.getSceneRasterHeight(); Product targetProduct = new Product(TARGET_PRODUCT_NAME, TARGET_PRODUCT_TYPE, sceneWidth, sceneHeight); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); return targetProduct; }
private String writeCenterTime() { if (srcProduct.getStartTime() != null) { double center = (srcProduct.getStartTime().getMJD() + (srcProduct.getEndTime().getMJD() - srcProduct.getStartTime().getMJD()) / 2.0); double seconds = (center - dateDay.getMJD()) * daysToSeconds; return seconds + tab + 's'; } return ""; }
private Product createTargetProduct(String name, String type) { final int sceneWidth = s2ClassifProduct.getSceneRasterWidth(); final int sceneHeight = s2ClassifProduct.getSceneRasterHeight(); Product targetProduct = new Product(name, type, sceneWidth, sceneHeight); ProductUtils.copyGeoCoding(s2ClassifProduct, targetProduct); targetProduct.setStartTime(s2ClassifProduct.getStartTime()); targetProduct.setEndTime(s2ClassifProduct.getEndTime()); return targetProduct; }
private void updateTimeValues() { final ProductData.UTC utcStartTime = currentProduct.getStartTime(); final ProductData.UTC utcEndTime = currentProduct.getEndTime(); boolean isAvailable = currentProduct.isMultiSize() ? isSampleValueAvailableInScene() : isSampleValueAvailableInRaster() ; if (utcStartTime == null || utcEndTime == null || !isAvailable) { timeModel.updateValue("No date information", 0); timeModel.updateValue("No time information", 1); } else { final ProductData.UTC utcCurrentLine; if(currentProduct.isMultiSize()) { utcCurrentLine = ProductUtils.getPixelScanTime(currentProduct, levelZeroSceneX + 0.5, levelZeroSceneY + 0.5); } else { utcCurrentLine = ProductUtils.getPixelScanTime(currentRaster, levelZeroRasterX + 0.5, levelZeroRasterY + 0.5); } Assert.notNull(utcCurrentLine, "utcCurrentLine"); final Calendar currentLineTime = utcCurrentLine.getAsCalendar(); final String dateString = String.format("%1$tF", currentLineTime); final String timeString = String.format("%1$tI:%1$tM:%1$tS:%1$tL %1$Tp", currentLineTime); timeModel.updateValue(dateString, 0); timeModel.updateValue(timeString, 1); } }
private void createTargetProduct() { targetProduct = new Product(sourceProduct.getName() + PRODUCT_SUFFIX, sourceProduct.getProductType(), targetImageWidth, targetImageHeight); addSelectedBands(); ProductUtils.copyMetadata(sourceProduct, targetProduct); //ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyFlagCodings(sourceProduct, targetProduct); //ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); addGeoCoding(); updateTargetProductMetadata(); final int sourceImageTileWidth = sourceImageWidth; final int sourceImageTileHeight = Math.min((int) (prf + 0.5), sourceImageHeight); final int targetImageTileWidth = (int) (sourceImageTileWidth * widthRatio + 0.5f); final int targetImageTileHeight = (int) (sourceImageTileHeight * heightRatio + 0.5f); if (usePRFTileSize) { targetProduct.setPreferredTileSize(targetImageTileWidth, targetImageTileHeight); } }
ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime());
/** * Create target product. */ private void createTargetProduct() { targetProduct = new Product(sourceProduct.getName() + PRODUCT_SUFFIX, sourceProduct.getProductType(), targetImageWidth, targetImageHeight); OperatorUtils.addSelectedBands( sourceProduct, sourceBandNames, targetProduct, targetBandNameToSourceBandName, false, true); ProductUtils.copyMetadata(sourceProduct, targetProduct); ProductUtils.copyFlagCodings(sourceProduct, targetProduct); targetProduct.setStartTime(sourceProduct.getStartTime()); targetProduct.setEndTime(sourceProduct.getEndTime()); addGeoCoding(); updateTargetProductMetadata(); }
localProduct = new Product(product.getName(), product.getProductType(), product.getSceneRasterWidth(), product.getSceneRasterHeight()); localProduct.setStartTime(product.getStartTime()); localProduct.setEndTime(product.getEndTime()); localProduct.setNumResolutionsMax(product.getNumResolutionsMax()); ProductUtils.copyMetadata(product, localProduct);
addEntry("Product start time (UTC):", startTimeString, ""); final String stopTimeString = product.getEndTime() != null ? product.getEndTime().getElemString() : "Not available"; addEntry("Product end time (UTC):", stopTimeString, "");
private static Product buildLandCoverProduct(Product sourceProduct, String landCoverName) throws Exception { Product landCoverProduct = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); landCoverProduct.setStartTime(sourceProduct.getStartTime()); landCoverProduct.setEndTime(sourceProduct.getEndTime()); landCoverProduct.setNumResolutionsMax(sourceProduct.getNumResolutionsMax()); ProductUtils.copyMetadata(sourceProduct, landCoverProduct); ProductUtils.copyGeoCoding(sourceProduct, landCoverProduct); ProductUtils.copyTiePointGrids(sourceProduct, landCoverProduct); ProductUtils.copyVectorData(sourceProduct, landCoverProduct); AddLandCoverOp.LandCoverParameters param = new AddLandCoverOp.LandCoverParameters(landCoverName, ResamplingFactory.NEAREST_NEIGHBOUR_NAME); AddLandCoverOp.AddLandCover(landCoverProduct, param); return landCoverProduct; }
/** * 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()); }
public static Product extractBands(Product sourceProduct, String[] sourceBandNames, String[] sourceMaskNames) { Product product = new Product(sourceProduct.getName(), sourceProduct.getProductType(), sourceProduct.getSceneRasterWidth(), sourceProduct.getSceneRasterHeight()); product.setStartTime(sourceProduct.getStartTime()); product.setEndTime(sourceProduct.getEndTime()); product.setNumResolutionsMax(sourceProduct.getNumResolutionsMax()); ProductUtils.copyMetadata(sourceProduct, product); ProductUtils.copyGeoCoding(sourceProduct, product); ProductUtils.copyTiePointGrids(sourceProduct, product); ProductUtils.copyVectorData(sourceProduct, product); if (sourceMaskNames != null && sourceMaskNames.length > 0) { ProductHelper.copyMasks(sourceProduct, product, sourceMaskNames); } for (int i=0; i<sourceBandNames.length; i++) { Band sourceBand = sourceProduct.getBand(sourceBandNames[i]); String sourceBandName = sourceBand.getName(); String targetBandName = sourceBandName; ProductUtils.copyBand(sourceBandName, sourceProduct, targetBandName, product, true); Band targetBand = product.getBand(targetBandName); ProductUtils.copyGeoCoding(sourceBand, targetBand); } return product; }
@Override public void initialize() throws OperatorException { sourceRasterWidth = lowresProduct.getSceneRasterWidth(); sourceRasterHeight = lowresProduct.getSceneRasterHeight(); int targetWidth = hiresProduct.getSceneRasterWidth(); int targetHeight = hiresProduct.getSceneRasterHeight(); offset = scale / 2; String targetProductName = lowresProduct.getName(); String targetProductType = lowresProduct.getProductType(); targetProduct = new Product(targetProductName, targetProductType, targetWidth, targetHeight); targetProduct.setStartTime(hiresProduct.getStartTime()); targetProduct.setEndTime(hiresProduct.getEndTime()); targetProduct.setPointingFactory(hiresProduct.getPointingFactory()); ProductUtils.copyMetadata(lowresProduct, targetProduct); ProductUtils.copyTiePointGrids(hiresProduct, targetProduct); ProductUtils.copyGeoCoding(hiresProduct, targetProduct); copyBands(lowresProduct, targetProduct); for (int i = 0; i < lowresProduct.getMaskGroup().getNodeCount(); i++) { Mask lowresMask = lowresProduct.getMaskGroup().get(i); targetProduct.getMaskGroup().add(lowresMask); } setTargetProduct(targetProduct); }
ProductUtils.copyMasks(sourceProduct, clonedProduct); clonedProduct.setStartTime(sourceProduct.getStartTime()); clonedProduct.setEndTime(sourceProduct.getEndTime());
targetProduct.setEndTime(reflProduct.getEndTime()); ProductUtils.copyMetadata(aotOriginalResolutionProduct, targetProduct); ProductUtils.copyTiePointGrids(reflProduct, targetProduct);
targetProduct.setEndTime(sourceProduct.getEndTime()); ProductUtils.copyMetadata(sourceProduct, targetProduct);