コード例 #1
0
  /**
   * Provides an implementation of the <code>readProductNodes</code> interface method. Clients
   * implementing this method can be sure that the input object and eventually the subset
   * information has already been set.
   *
   * <p>
   *
   * <p>This method is called as a last step in the <code>readProductNodes(input, subsetInfo)</code>
   * method.
   *
   * @throws java.io.IOException if an I/O error occurs
   */
  @Override
  protected Product readProductNodesImpl() throws IOException {

    Product product;
    try {
      final File fileFromInput = ReaderUtils.getFileFromInput(getInput());
      dataDir = createDirectory(fileFromInput);
      dataDir.readProductDirectory();
      product = dataDir.createProduct();
      addCalibrationLUT(product, fileFromInput.getParentFile());
      product.getGcpGroup();
      product.setFileLocation(fileFromInput);
      product.setProductReader(this);
      product.setModified(false);

      final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product);
      isAscending = absRoot.getAttributeString(AbstractMetadata.PASS).equals("ASCENDING");
      isAntennaPointingRight =
          absRoot.getAttributeString(AbstractMetadata.antenna_pointing).equals("right");
    } catch (Exception e) {
      Debug.trace(e.toString());
      final IOException ioException = new IOException(e.getMessage());
      ioException.initCause(e);
      throw ioException;
    }

    return product;
  }
コード例 #2
0
  /**
   * Read the LUT for use in calibration
   *
   * @param product the target product
   * @param folder the folder containing the input
   * @throws IOException if can't read lut
   */
  private static void addCalibrationLUT(final Product product, final File folder)
      throws IOException {

    final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product);
    final boolean isAscending =
        absRoot.getAttributeString(AbstractMetadata.PASS).equals("ASCENDING");
    final boolean isAntennaPointingRight =
        absRoot.getAttributeString(AbstractMetadata.antenna_pointing).equals("right");
    final boolean flipLUT =
        flipToSARGeometry
            && ((isAscending && !isAntennaPointingRight)
                || (!isAscending && isAntennaPointingRight));

    final File sigmaLUT = new File(folder, lutsigma + ".xml");
    final File gammaLUT = new File(folder, lutgamma + ".xml");
    final File betaLUT = new File(folder, lutbeta + ".xml");

    final MetadataElement origProdRoot = AbstractMetadata.getOriginalProductMetadata(product);

    readCalibrationLUT(sigmaLUT, lutsigma, origProdRoot, flipLUT);
    readCalibrationLUT(gammaLUT, lutgamma, origProdRoot, flipLUT);
    readCalibrationLUT(betaLUT, lutbeta, origProdRoot, flipLUT);
  }
コード例 #3
0
ファイル: Slant2HeightOp.java プロジェクト: ppolabs/jlinda
  private void constructSourceMetadata() throws Exception {

    // define sourceMaster/sourceSlave name tags
    final String masterTag = "ifg";
    final String slaveTag = "dummy";
    final MetadataElement masterMeta = AbstractMetadata.getAbstractedMetadata(sourceProduct);
    final String slaveMetadataRoot = AbstractMetadata.SLAVE_METADATA_ROOT;
    MetadataElement[] slaveRoot;

    /* organize metadata */
    // put sourceMaster metadata into the masterMap
    metaMapPut(masterTag, masterMeta, sourceProduct, masterMap);

    // pug sourceSlave metadata into slaveDefoMap
    slaveRoot = sourceProduct.getMetadataRoot().getElement(slaveMetadataRoot).getElements();
    for (MetadataElement meta : slaveRoot) {
      metaMapPut(slaveTag, meta, sourceProduct, slaveMap);
    }
  }