/** * Factory method for creating a GridTimeCoding-instance from a product. * * @param product the product to create the time coding from. Its start time must not be <code>null</code>. * * @return a TimeCoding instance */ public static TimeCoding create(Product product) { final ProductData.UTC startTime = product.getStartTime(); final ProductData.UTC endTime = product.getEndTime(); if (endTime != null) { return new GridTimeCoding(startTime, endTime); } else { return new GridTimeCoding(startTime); } }
@Override public TimeCoding getTimeCoding() { return GridTimeCoding.create(tsProduct); }
/** * Returns the central time of start and end time. * * @param pos the pixel position to retrieve time information for * * @return the time at the given pixel position */ @Override public ProductData.UTC getTime(PixelPos pos) { final ProductData.UTC startTime = getStartTime(); final ProductData.UTC endTime = getEndTime(); final double dStart = startTime.getMJD(); final double dEnd = endTime.getMJD(); final double dCentral = (dEnd - dStart) / 2; return new ProductData.UTC(dCentral); }
private void fixBandTimeCodings() { for (Band destBand : tsProduct.getBands()) { final String destBandName = destBand.getName(); final Band raster = getSourceBand(destBandName); final TimeCoding timeCoding; if (raster != null) { timeCoding = GridTimeCoding.create(raster.getProduct()); } else { ProductData.UTC time = extractUtcTime(destBandName); timeCoding = new GridTimeCoding(time, time); } rasterTimeMap.put(destBand, timeCoding); } }
List<Product> compatibleProducts = getCompatibleProducts(); for (Product product : compatibleProducts) { TimeCoding varTimeCoding = GridTimeCoding.create(product); if (autoStartTime == null) { TimeCoding tsTimeCoding = timeSeries.getTimeCoding();
@Override protected void onOK() { timeSeries.setAutoAdjustingTimeCoding(autoAdjustBox.isSelected()); final ProductData.UTC startTime = ProductData.UTC.create(startTimeBox.getDate(), 0); final ProductData.UTC endTime = ProductData.UTC.create(endTimeBox.getDate(), 0); timeSeries.setTimeCoding(new GridTimeCoding(startTime, endTime)); super.onOK(); }
private void addSpecifiedBandOfGivenProduct(String nodeName, Product product) { if (isProductCompatible(product, nodeName)) { final RasterDataNode raster = product.getRasterDataNode(nodeName); TimeCoding rasterTimeCoding = GridTimeCoding.create(product); final ProductData.UTC rasterStartTime = rasterTimeCoding.getStartTime(); final ProductData.UTC rasterEndTime = rasterTimeCoding.getEndTime(); Guardian.assertNotNull("rasterStartTime", rasterStartTime); final String bandName = variableToRasterName(nodeName, rasterTimeCoding); if (!tsProduct.containsBand(bandName)) { // band not already contained if (isAutoAdjustingTimeCoding() || !isTimeCodingSet()) { // automatically setting time coding // OR // first band to add to time series; time bounds of this band will be used // as ts-product's time bounds, no matter if auto adjust is true or false autoAdjustTimeInformation(rasterStartTime, rasterEndTime); } if (getTimeCoding().contains(rasterTimeCoding)) { // add only bands which are in the time bounds final Band addedBand = addBand(raster, rasterTimeCoding, bandName); final List<Band> bandsForVariable = getBandsForVariable(nodeName); if (!bandsForVariable.isEmpty()) { final ImageInfo imageInfo = bandsForVariable.get(0).getImageInfo(ProgressMonitor.NULL); addedBand.setImageInfo(imageInfo.createDeepCopy()); } } // todo no bands added message } } }