示例#1
0
 /**
  * Get rupture probability within a region. It first checks whether the end points are within
  * region. If yes, then rupture is considered within the region Else It finds the fraction of
  * rupture FAULT TRACE (not the surface) points within the region and then adjusts the probability
  * accordingly.
  *
  * @param tempRup
  * @param region
  * @return
  */
 private double getApproxRupProbWithinRegion(ProbEqkRupture tempRup, Region region) {
   int numLocsInside = 0;
   int totPoints = 0;
   if (region != null) {
     // get num surface points inside region
     EvenlyGriddedSurfaceAPI rupSurface = tempRup.getRuptureSurface();
     Location loc1 = rupSurface.getLocation(0, 0);
     Location loc2 = rupSurface.getLocation(0, rupSurface.getNumCols() - 1);
     // if both surface points are within region, rupture is considered
     // within region
     if (region.contains(loc1) && region.contains(loc2)) {
       numLocsInside = 1;
       totPoints = numLocsInside;
     } else { // if both points are not within region, calculate rupProb
       Iterator locIt = rupSurface.getColumnIterator(0);
       while (locIt.hasNext()) {
         if (region.contains((Location) locIt.next())) ++numLocsInside;
         ++totPoints;
       }
     }
   } else {
     numLocsInside = 1;
     totPoints = numLocsInside;
   }
   if (isPoissonian)
     return Math.log(1 - tempRup.getProbability() * numLocsInside / (double) totPoints);
   else return tempRup.getProbability() * numLocsInside / (double) totPoints;
 }
示例#2
0
 public EqkRuptureDataForNrml(EqkRupture rup) {
   averageRake = rup.getAveRake();
   if (rup.getTectRegType() != null) {
     tectonicRegion = rup.getTectRegType().toString();
   } else {
     tectonicRegion = unknownTectonicRegionType;
   }
   magRupture = rup.getMag();
   EvenlyGriddedSurfaceAPI grid = rup.getRuptureSurface();
   /*
    * the site data
    */
   numberOfColumns = grid.getNumCols();
   numberOfRows = grid.getNumRows();
   int countSites = numberOfColumns * numberOfRows;
   latGrid = new double[countSites];
   lonGrid = new double[countSites];
   depthGrid = new double[countSites];
   for (int row = 0; row < numberOfRows; row++) {
     for (int col = 0; col < numberOfColumns; col++) {
       Location l = grid.get(row, col);
       int index = (row) * numberOfColumns + (col);
       latGrid[index] = l.getLatitude();
       lonGrid[index] = l.getLongitude();
       depthGrid[index] = l.getDepth();
     } // for columns
   } // for rows
 } // constructor()