コード例 #1
0
ファイル: UpdateGeoRefOp.java プロジェクト: fpl/s1tbx
  /**
   * Compute DEM traversal step sizes (in degree) in latitude and longitude.
   *
   * @throws Exception The exceptions.
   */
  private void computeDEMTraversalSampleInterval() throws Exception {

    double[] latLonMinMax = new double[4];
    computeImageGeoBoundary(0, sourceImageWidth - 1, 0, sourceImageHeight - 1, latLonMinMax);

    final double groundRangeSpacing = SARGeocoding.getRangePixelSpacing(sourceProduct);
    final double azimuthPixelSpacing = SARGeocoding.getAzimuthPixelSpacing(sourceProduct);
    final double spacing = Math.min(groundRangeSpacing, azimuthPixelSpacing);
    // final double spacing = (groundRangeSpacing + azimuthPixelSpacing)/2.0;
    final double latMin = latLonMinMax[0];
    final double latMax = latLonMinMax[1];
    double minAbsLat;
    if (latMin * latMax > 0) {
      minAbsLat = Math.min(Math.abs(latMin), Math.abs(latMax)) * Constants.DTOR;
    } else {
      minAbsLat = 0.0;
    }
    delLat = spacing / Constants.MeanEarthRadius * Constants.RTOD;
    delLon = spacing / (Constants.MeanEarthRadius * FastMath.cos(minAbsLat)) * Constants.RTOD;
    delLat = Math.min(delLat, delLon); // (delLat + delLon)/2.0;
    delLon = delLat;
  }
コード例 #2
0
ファイル: UpdateGeoRefOp.java プロジェクト: fpl/s1tbx
  /**
   * Retrieve required data from Abstracted Metadata
   *
   * @throws Exception if metadata not found
   */
  private void getMetadata() throws Exception {

    srgrFlag = AbstractMetadata.getAttributeBoolean(absRoot, AbstractMetadata.srgr_flag);
    wavelength = SARUtils.getRadarFrequency(absRoot);
    rangeSpacing = AbstractMetadata.getAttributeDouble(absRoot, AbstractMetadata.range_spacing);
    firstLineUTC = absRoot.getAttributeUTC(AbstractMetadata.first_line_time).getMJD(); // in days
    lastLineUTC = absRoot.getAttributeUTC(AbstractMetadata.last_line_time).getMJD(); // in days
    lineTimeInterval =
        absRoot.getAttributeDouble(AbstractMetadata.line_time_interval)
            / Constants.secondsInDay; // s to day
    orbitStateVectors = AbstractMetadata.getOrbitStateVectors(absRoot);

    if (srgrFlag) {
      srgrConvParams = AbstractMetadata.getSRGRCoefficients(absRoot);
    } else {
      nearEdgeSlantRange =
          AbstractMetadata.getAttributeDouble(absRoot, AbstractMetadata.slant_range_to_first_pixel);
    }

    final TiePointGrid incidenceAngle = OperatorUtils.getIncidenceAngle(sourceProduct);
    nearRangeOnLeft = SARGeocoding.isNearRangeOnLeft(incidenceAngle, sourceImageWidth);
  }
コード例 #3
0
ファイル: UpdateGeoRefOp.java プロジェクト: fpl/s1tbx
  private boolean getPosition(
      final double lat,
      final double lon,
      final double alt,
      final int x0,
      final int y0,
      final int w,
      final int h,
      final PositionData data) {

    GeoUtils.geo2xyzWGS84(lat, lon, alt, data.earthPoint);

    /*final double zeroDopplerTime = SARGeocoding.getEarthPointZeroDopplerTimeNewton(
    firstLineUTC, lineTimeInterval, wavelength, data.earthPoint,
    orbit.sensorPosition, orbit.sensorVelocity);*/

    final double zeroDopplerTime =
        SARGeocoding.getEarthPointZeroDopplerTimeNewton(
            firstLineUTC, lineTimeInterval, wavelength, data.earthPoint, orbit);

    if (zeroDopplerTime == SARGeocoding.NonValidZeroDopplerTime) {
      return false;
    }

    data.slantRange =
        SARGeocoding.computeSlantRange(zeroDopplerTime, orbit, data.earthPoint, data.sensorPos);

    final double zeroDopplerTimeWithoutBias =
        zeroDopplerTime + data.slantRange / Constants.lightSpeedInMetersPerDay;

    data.azimuthIndex = (zeroDopplerTimeWithoutBias - firstLineUTC) / lineTimeInterval;

    if (!(data.azimuthIndex > y0 - 1 && data.azimuthIndex <= y0 + h)) {
      return false;
    }

    data.slantRange =
        SARGeocoding.computeSlantRange(
            zeroDopplerTimeWithoutBias, orbit, data.earthPoint, data.sensorPos);

    if (!srgrFlag) {
      data.rangeIndex = (data.slantRange - nearEdgeSlantRange) / rangeSpacing;
    } else {
      data.rangeIndex =
          SARGeocoding.computeRangeIndex(
              srgrFlag,
              sourceImageWidth,
              firstLineUTC,
              lastLineUTC,
              rangeSpacing,
              zeroDopplerTimeWithoutBias,
              data.slantRange,
              nearEdgeSlantRange,
              srgrConvParams);
    }

    if (data.rangeIndex <= 0.0) {
      return false;
    }

    if (!nearRangeOnLeft) {
      data.rangeIndex = sourceImageWidth - 1 - data.rangeIndex;
    }

    if (!(data.rangeIndex >= x0 && data.rangeIndex < x0 + w)) {
      return false;
    }
    return true;
  }
コード例 #4
0
ファイル: UpdateGeoRefOp.java プロジェクト: fpl/s1tbx
  private void computeTileOverlapPercentage(
      final int x0, final int y0, final int w, final int h, double[] overlapPercentages)
      throws Exception {

    final PixelPos pixPos = new PixelPos();
    final GeoPos geoPos = new GeoPos();
    final PosVector earthPoint = new PosVector();
    final PosVector sensorPos = new PosVector();
    double tileOverlapPercentageMax = -Double.MAX_VALUE;
    double tileOverlapPercentageMin = Double.MAX_VALUE;
    for (int y = y0; y < y0 + h; y += 20) {
      for (int x = x0; x < x0 + w; x += 20) {
        pixPos.setLocation(x, y);
        sourceGeoCoding.getGeoPos(pixPos, geoPos);
        final double alt = dem.getElevation(geoPos);
        GeoUtils.geo2xyzWGS84(geoPos.getLat(), geoPos.getLon(), alt, earthPoint);

        final double zeroDopplerTime =
            SARGeocoding.getEarthPointZeroDopplerTime(
                firstLineUTC,
                lineTimeInterval,
                wavelength,
                earthPoint,
                orbit.sensorPosition,
                orbit.sensorVelocity);

        if (zeroDopplerTime == SARGeocoding.NonValidZeroDopplerTime) {
          continue;
        }

        final double slantRange =
            SARGeocoding.computeSlantRange(zeroDopplerTime, orbit, earthPoint, sensorPos);

        final double zeroDopplerTimeWithoutBias =
            zeroDopplerTime + slantRange / Constants.lightSpeedInMetersPerDay;

        final int azimuthIndex =
            (int) ((zeroDopplerTimeWithoutBias - firstLineUTC) / lineTimeInterval + 0.5);

        double tileOverlapPercentage = (double) (azimuthIndex - y) / (double) tileSize;

        if (tileOverlapPercentage > tileOverlapPercentageMax) {
          tileOverlapPercentageMax = tileOverlapPercentage;
        }
        if (tileOverlapPercentage < tileOverlapPercentageMin) {
          tileOverlapPercentageMin = tileOverlapPercentage;
        }
      }
    }

    if (tileOverlapPercentageMin != Double.MAX_VALUE && tileOverlapPercentageMin < 0.0) {
      overlapPercentages[0] = tileOverlapPercentageMin - 0.5;
    } else {
      overlapPercentages[0] = 0.0;
    }

    if (tileOverlapPercentageMax != -Double.MAX_VALUE && tileOverlapPercentageMax > 0.0) {
      overlapPercentages[1] = tileOverlapPercentageMax + 0.5;
    } else {
      overlapPercentages[1] = 0.0;
    }
  }