Example #1
0
  /**
   * @param mfdGR : original magnitude frequency distribution
   * @param deltaMmax : uncertainty on maximum magnitude
   * @param areaSrc : source
   * @return
   */
  private static GutenbergRichterMagFreqDist applyMmaxGrRelative(
      GutenbergRichterMagFreqDist mfdGR, double deltaMmax, String sourceName) {

    // minimum magnitude
    double mMin = mfdGR.getMagLower();
    // b value
    double bVal = mfdGR.get_bValue();
    // total moment rate
    double totMoRate = mfdGR.getTotalMomentRate();
    // deltaM
    double deltaM = mfdGR.getDelta();

    // calculate new mMax value
    // old mMax value
    double mMax = mfdGR.getMagUpper();
    // add uncertainty value (deltaM/2 is added because mMax
    // refers to bin center
    mMax = mMax + deltaM / 2 + deltaMmax;
    // round mMax with respect to deltaM
    mMax = Math.round(mMax / deltaM) * deltaM;
    // move back to bin center
    mMax = mMax - deltaM / 2;
    // System.out.println("New mMax: "+mMax);

    if (mMax - mMin >= deltaM) {

      // calculate number of magnitude values
      int numVal = (int) Math.round((mMax - mMin) / deltaM + 1);

      // create new GR mfd
      GutenbergRichterMagFreqDist newMfdGr = new GutenbergRichterMagFreqDist(mMin, numVal, deltaM);
      newMfdGr.setAllButTotCumRate(mMin, mMax, totMoRate, bVal);

      // return new mfd
      return newMfdGr;

    } else {
      // stop execution and return null
      logger.info(
          "Uncertaintiy value: "
              + deltaMmax
              + " on maximum magnitude for source: "
              + sourceName
              + " give maximum magnitude smaller than minimum magnitude!\n"
              + "Check your input. Execution stopped.");
      // System.out.println("Uncertaintiy value: " + deltaMmax +
      // " on maximum magnitude for source: " + sourceName
      // + " give maximum magnitude smaller than minimum magnitude!");
      // System.out.println("Check your input. Execution stopped.");
      return null;
    }
  }
Example #2
0
  private static GutenbergRichterMagFreqDist applybGrRelative(
      GutenbergRichterMagFreqDist mfdGR, double deltaB, String sourceName) {

    // minimum magnitude
    double mMin = mfdGR.getMagLower();
    // maximum magnitude
    double mMax = mfdGR.getMagUpper();
    // b value
    double bVal = mfdGR.get_bValue();
    // total moment rate
    double totMoRate = mfdGR.getTotalMomentRate();
    // deltaM
    double deltaM = mfdGR.getDelta();

    // calculate new b value
    bVal = bVal + deltaB;

    if (bVal >= 0.0) {

      // calculate number of magnitude values
      int numVal = (int) Math.round((mMax - mMin) / deltaM + 1);

      // create new GR mfd
      GutenbergRichterMagFreqDist newMfdGr = new GutenbergRichterMagFreqDist(mMin, numVal, deltaM);
      newMfdGr.setAllButTotCumRate(mMin, mMax, totMoRate, bVal);

      // return new mfd
      return newMfdGr;

    } else {
      String msg =
          "Uncertaintiy value: "
              + deltaB
              + " on b value for source: "
              + sourceName
              + " give b value smaller than 0!\n"
              + "Check your input. Execution stopped!";
      logger.info(msg);
      // System.out.println("Uncertaintiy value: " + deltaB +
      // " on b value for source: " + sourceName
      // + " give b value smaller than 0!");
      // System.out.println("Check your input. Execution stopped!");
      throw new IllegalArgumentException(msg);
    }
  } // applybGrRelative()