예제 #1
0
  /**
   * This method applies an "uncertainty" rule to a subduction source data object
   *
   * @param subFaultSrc : source data object subject to uncertainty
   * @param rule : GEMLogicTreeRule specifing parameter uncertainty
   * @return: a new GEMSubductionSourceData object with the parameter subject to uncertainty changed
   *     according to the rule. In case the rule is not recognized an error is thrown and execution
   *     stops
   */
  private static GEMSubductionFaultSourceData applyRuleToSubductionFaultSource(
      GEMSubductionFaultSourceData subFaultSrc, LogicTreeRule rule) {

    // if uncertainties on GR Mmax or GR b value
    if (rule.getRuleName().toString().equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())
        || rule.getRuleName()
            .toString()
            .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {

      // mfd
      IncrementalMagFreqDist mfd = subFaultSrc.getMfd();

      if (mfd instanceof GutenbergRichterMagFreqDist) {

        GutenbergRichterMagFreqDist newMfdGr = null;

        // create new mfd by applying rule
        if (rule.getRuleName()
            .toString()
            .equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())) {
          newMfdGr =
              applyMmaxGrRelative(
                  (GutenbergRichterMagFreqDist) mfd, rule.getVal(), subFaultSrc.getName());
        } else if (rule.getRuleName()
            .toString()
            .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
          newMfdGr =
              applybGrRelative(
                  (GutenbergRichterMagFreqDist) mfd, rule.getVal(), subFaultSrc.getName());
        }

        // return new subduction fault source with the new mfd
        return new GEMSubductionFaultSourceData(
            subFaultSrc.getID(),
            subFaultSrc.getName(),
            subFaultSrc.getTectReg(),
            subFaultSrc.getTopTrace(),
            subFaultSrc.getBottomTrace(),
            subFaultSrc.getRake(),
            newMfdGr,
            subFaultSrc.getFloatRuptureFlag());

      } // end if mfd is GR
      // if uncertainty does not apply return unchanged object
      else {
        return subFaultSrc;
      }

    } // end if rule == mMaxGRRelative || == bGRRelative
    else {
      String msg =
          "Rule: "
              + rule.getRuleName().toString()
              + " not supported.\n"
              + "Check your input. Execution is stopped.";
      logger.info(msg);
      throw new IllegalArgumentException(msg);
    }
  } // applyRuleToSubductionFaultSource()
예제 #2
0
 /**
  * This method applies an "uncertainty" rule to a fault source data object
  *
  * @param faultSrc : source data object subject to uncertainty
  * @param rule : GEMLogicTreeRule specifing parameter uncertainty
  * @return: a new GEMFaultSourceData object with the parameter subject to the uncertainty changed
  *     according to the rule. In case the rule is not recognized an error is thrown and execution
  *     stops
  */
 private static GEMFaultSourceData applyRuleToFaultSource(
     GEMFaultSourceData faultSrc, LogicTreeRule rule) {
   // if uncertainties on GR Mmax or GR b value
   if (rule.getRuleName().toString().equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())
       || rule.getRuleName()
           .toString()
           .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
     // mfd
     IncrementalMagFreqDist mfd = faultSrc.getMfd();
     if (mfd instanceof GutenbergRichterMagFreqDist) {
       GutenbergRichterMagFreqDist newMfdGr = null;
       // create new mfd by applying rule
       if (rule.getRuleName()
           .toString()
           .equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())) {
         newMfdGr =
             applyMmaxGrRelative(
                 (GutenbergRichterMagFreqDist) mfd, rule.getVal(), faultSrc.getName());
       } else if (rule.getRuleName()
           .toString()
           .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
         newMfdGr =
             applybGrRelative(
                 (GutenbergRichterMagFreqDist) mfd, rule.getVal(), faultSrc.getName());
       }
       // return new fault source with new mfd
       return new GEMFaultSourceData(
           faultSrc.getID(),
           faultSrc.getName(),
           faultSrc.getTectReg(),
           newMfdGr,
           faultSrc.getTrace(),
           faultSrc.getDip(),
           faultSrc.getDip(),
           faultSrc.getSeismDepthLow(),
           faultSrc.getSeismDepthUpp(),
           faultSrc.getFloatRuptureFlag());
     } else {
       // mfd is not GR
       // if the uncertainty do not apply return the unchanged object
       return faultSrc;
     }
   } else {
     // not(rule == mMaxGRRelative || == bGRRelative)
     String msg =
         "Rule: "
             + rule.getRuleName().toString()
             + " not supported.\n"
             + "Check your input. Execution is stopped.";
     logger.info(msg);
     throw new IllegalArgumentException(msg);
   }
 } // applyRuleToFaultSource()
예제 #3
0
 /**
  * This method applies an "uncertainty" rule to an area source data object
  *
  * @param areaSrc : source data object subject to uncertainty
  * @param rule : GEMLogicTreeRule specifing parameter uncertainty
  * @return: a new GEMAreaSourceData object with the parameter subject to the uncertainty changed
  *     according to the rule. In case the rule is not recognized an error is thrown and execution
  *     stops
  */
 private static GEMAreaSourceData applyRuleToAreaSource(
     GEMAreaSourceData areaSrc, LogicTreeRule rule) {
   // define new area source
   GEMAreaSourceData newAreaSrc = areaSrc;
   // if uncertainties on GR Mmax or GR b value
   if (rule.getRuleName().toString().equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())
       || rule.getRuleName()
           .toString()
           .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
     // loop over mfds
     // mfd index
     int mfdIndex = 0;
     for (IncrementalMagFreqDist mfd : areaSrc.getMagfreqDistFocMech().getMagFreqDistList()) {
       if (mfd instanceof GutenbergRichterMagFreqDist) {
         // new mfd
         GutenbergRichterMagFreqDist newMfdGr = null;
         if (rule.getRuleName()
             .toString()
             .equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())) {
           // uncertainties on Mmax
           newMfdGr =
               applyMmaxGrRelative(
                   (GutenbergRichterMagFreqDist) mfd, rule.getVal(), areaSrc.getName());
         } else if (rule.getRuleName()
             .toString()
             .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
           // uncertainties on b value
           newMfdGr =
               applybGrRelative(
                   (GutenbergRichterMagFreqDist) mfd, rule.getVal(), areaSrc.getName());
         }
         // substitute old mfd with new mfd
         newAreaSrc.getMagfreqDistFocMech().getMagFreqDistList()[mfdIndex] = newMfdGr;
       } // end if mfd is GR
       mfdIndex = mfdIndex + 1;
     } // for (loop over mfds)
     // return new area source
     return newAreaSrc;
   } else {
     // not(rule == mMaxGRRelative || == bGRRelative)
     String msg =
         "Rule: "
             + rule.getRuleName().toString()
             + " not supported.\n"
             + "Check your input. Execution is stopped.";
     logger.info(msg);
     throw new IllegalArgumentException(msg);
   }
 } // applyRuleToAreaSource()
예제 #4
0
 /**
  * This method applies an "uncertainty" rule to a point source data object
  *
  * @param pntSrc : source data object subject to uncertainty
  * @param rule : GEMLogicTreeRule specifing parameter uncertainty
  * @return: a new GEMPointSourceData object with the parameter subject to the uncertainty changed
  *     according to the rule. In case the rule is not recognized an error is thrown and execution
  *     stops
  */
 private static GEMPointSourceData applyRuleToPointSource(
     GEMPointSourceData pntSrc, LogicTreeRule rule) {
   // new point source
   GEMPointSourceData newPntSource = pntSrc;
   // if uncertainties on GR Mmax or GR b value
   if (rule.getRuleName().toString().equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())
       || rule.getRuleName()
           .toString()
           .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
     // loop over mfds
     // mfd index
     int mfdIndex = 0;
     for (IncrementalMagFreqDist mfd : pntSrc.getHypoMagFreqDistAtLoc().getMagFreqDistList()) {
       if (mfd instanceof GutenbergRichterMagFreqDist) {
         GutenbergRichterMagFreqDist newMfdGr = null;
         // create new mfd by applying rule
         if (rule.getRuleName()
             .toString()
             .equalsIgnoreCase(LogicTreeRuleParam.mMaxGRRelative.toString())) {
           newMfdGr =
               applyMmaxGrRelative(
                   (GutenbergRichterMagFreqDist) mfd, rule.getVal(), pntSrc.getName());
         } else if (rule.getRuleName()
             .toString()
             .equalsIgnoreCase(LogicTreeRuleParam.bGRRelative.toString())) {
           newMfdGr =
               applybGrRelative(
                   (GutenbergRichterMagFreqDist) mfd, rule.getVal(), pntSrc.getName());
         }
         // substitute old mfd with new mfd
         newPntSource.getHypoMagFreqDistAtLoc().getMagFreqDistList()[mfdIndex] = newMfdGr;
       } // if mfd is GR
       mfdIndex = mfdIndex + 1;
     } // for (loop over mfd)
     return newPntSource;
   } else {
     // not(rule == mMaxGRRelative || == bGRRelative)
     String msg =
         "Rule: "
             + rule.getRuleName().toString()
             + " not supported.\n"
             + "Check your input. Execution is stopped.";
     logger.info(msg);
     throw new IllegalArgumentException(msg);
   }
 } // applyRuleToPointSource()