/** * 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; }
/** * Get rupture probability within a region. It finds the fraction of rupture surface points within * the region and then adjusts the probability accordingly. * * @param tempRup * @param region * @return */ private double getRupProbWithinRegion(ProbEqkRupture tempRup, Region region) { int numLocsInside = 0; int totPoints = 0; if (region != null) { // get num surface points inside region Iterator locIt = tempRup.getRuptureSurface().getLocationsIterator(); 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; }