コード例 #1
0
  /**
   * This method copies selected tie point grids to a rescaled target product
   *
   * @param sourceProduct - the source product
   * @param targetProduct - the target product
   * @param xScalingFactor - scaling factor in x-direction
   * @param yScalingFactor - scaling factor in y-direction
   */
  public static void copyRescaledTiePointGrids(
      Product sourceProduct, Product targetProduct, int xScalingFactor, int yScalingFactor) {
    // Add tie point grids for sun/view zenith/azimuths. Get data from AATSR bands.
    final Band szaBand =
        sourceProduct.getBand("sun_elev_nadir_" + SynergyConstants.INPUT_BANDS_SUFFIX_AATSR);
    final Band saaBand =
        sourceProduct.getBand("sun_azimuth_nadir_" + SynergyConstants.INPUT_BANDS_SUFFIX_AATSR);
    final Band latitudeBand =
        sourceProduct.getBand("latitude_" + SynergyConstants.INPUT_BANDS_SUFFIX_AATSR);
    final Band longitudeBand =
        sourceProduct.getBand("longitude_" + SynergyConstants.INPUT_BANDS_SUFFIX_AATSR);
    final Band altitudeBand =
        sourceProduct.getBand("altitude_" + SynergyConstants.INPUT_BANDS_SUFFIX_AATSR);

    final TiePointGrid szaTpg = getRescaledTpgFromBand(szaBand, xScalingFactor, yScalingFactor);
    targetProduct.addTiePointGrid(szaTpg);
    final TiePointGrid saaTpg = getRescaledTpgFromBand(saaBand, xScalingFactor, yScalingFactor);
    targetProduct.addTiePointGrid(saaTpg);
    final TiePointGrid latTpg =
        getRescaledTpgFromBand(latitudeBand, xScalingFactor, yScalingFactor);
    targetProduct.addTiePointGrid(latTpg);
    final TiePointGrid lonTpg =
        getRescaledTpgFromBand(longitudeBand, xScalingFactor, yScalingFactor);
    targetProduct.addTiePointGrid(lonTpg);
    final TiePointGrid altTpg =
        getRescaledTpgFromBand(altitudeBand, xScalingFactor, yScalingFactor);
    targetProduct.addTiePointGrid(altTpg);
  }
コード例 #2
0
  protected void addTiePointGridsToProduct(final Product product) {
    final GeoCoding geoCoding = getSourceProduct().getGeoCoding();
    final String latGridName;
    final String lonGridName;
    if (geoCoding instanceof TiePointGeoCoding) {
      final TiePointGeoCoding tiePointGeoCoding = (TiePointGeoCoding) geoCoding;
      final TiePointGrid latGrid = tiePointGeoCoding.getLatGrid();
      final TiePointGrid lonGrid = tiePointGeoCoding.getLonGrid();
      latGridName = latGrid.getName();
      lonGridName = lonGrid.getName();
    } else {
      latGridName = null;
      lonGridName = null;
    }

    for (int i = 0; i < getSourceProduct().getNumTiePointGrids(); i++) {
      final TiePointGrid sourceTiePointGrid = getSourceProduct().getTiePointGridAt(i);
      final String gridName = sourceTiePointGrid.getName();

      if (isNodeAccepted(gridName)
          || (gridName.equals(latGridName) || gridName.equals(lonGridName))) {
        final TiePointGrid tiePointGrid =
            TiePointGrid.createSubset(sourceTiePointGrid, getSubsetDef());
        if (isFullScene(getSubsetDef()) && sourceTiePointGrid.isStxSet()) {
          copyStx(sourceTiePointGrid, tiePointGrid);
        }
        product.addTiePointGrid(tiePointGrid);
        copyImageInfo(sourceTiePointGrid, tiePointGrid);
      }
    }
  }
コード例 #3
0
 private static Product createProduct() throws Exception {
   Product product = new Product("p", "t", 32, 256);
   final TiePointGrid lat =
       new TiePointGrid("lat", 2, 2, 0f, 0f, 32f, 256f, new float[] {+40f, +40f, -40f, -40f});
   final TiePointGrid lon =
       new TiePointGrid("lon", 2, 2, 0f, 0f, 32f, 256f, new float[] {-80f, +80f, -80f, +80f});
   product.addTiePointGrid(lat);
   product.addTiePointGrid(lon);
   product.setGeoCoding(new TiePointGeoCoding(lat, lon));
   product.setPreferredTileSize(32, 16);
   product.setStartTime(ProductData.UTC.parse("2003-01-01", "yyyy-MM-dd"));
   product.setEndTime(ProductData.UTC.parse("2003-01-02", "yyyy-MM-dd"));
   return product;
 }
コード例 #4
0
 private static void addTpg(Product targetProduct, Band scaledBand, String name) {
   DataBuffer dataBuffer;
   float[] tpgData;
   TiePointGrid tpg;
   dataBuffer = scaledBand.getSourceImage().getData().getDataBuffer();
   tpgData = new float[dataBuffer.getSize()];
   for (int i = 0; i < dataBuffer.getSize(); i++) {
     tpgData[i] = dataBuffer.getElemFloat(i);
   }
   tpg =
       new TiePointGrid(
           name,
           scaledBand.getSceneRasterWidth(),
           scaledBand.getSceneRasterHeight(),
           0.0f,
           0.0f,
           1.0f,
           1.0f,
           tpgData);
   targetProduct.addTiePointGrid(tpg);
 }