|
| 1 | +package scratch.kevin.nshm23; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | +import java.util.ArrayList; |
| 5 | +import java.util.List; |
| 6 | + |
| 7 | +import org.opensha.commons.util.FaultUtils; |
| 8 | +import org.opensha.sha.earthquake.faultSysSolution.util.FaultSectionUtils; |
| 9 | +import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.NSHM23_DeformationModels; |
| 10 | +import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.NSHM23_FaultModels; |
| 11 | +import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.NSHM23_ScalingRelationships; |
| 12 | +import org.opensha.sha.faultSurface.FaultSection; |
| 13 | + |
| 14 | +public class FullParentSectMagCalc { |
| 15 | + |
| 16 | + public static void main(String[] args) throws IOException { |
| 17 | + NSHM23_FaultModels fm = NSHM23_FaultModels.WUS_FM_v3; |
| 18 | + NSHM23_DeformationModels dm = NSHM23_DeformationModels.GEOLOGIC; |
| 19 | + NSHM23_ScalingRelationships[] scales = { |
| 20 | + NSHM23_ScalingRelationships.AVERAGE, |
| 21 | + NSHM23_ScalingRelationships.LOGA_C4p3, |
| 22 | + NSHM23_ScalingRelationships.LOGA_C4p2, |
| 23 | + NSHM23_ScalingRelationships.LOGA_C4p1, |
| 24 | + NSHM23_ScalingRelationships.WIDTH_LIMITED, |
| 25 | +// NSHM23_ScalingRelationships.LOGA_C4p2_SQRT_LEN, |
| 26 | +// NSHM23_ScalingRelationships.WIDTH_LIMITED_CSD |
| 27 | + }; |
| 28 | + |
| 29 | + List<? extends FaultSection> sects = dm.build(fm); |
| 30 | + |
| 31 | + int[] parentIDs = { |
| 32 | +// FaultSectionUtils.findParentSectionID(sects, "Compton") |
| 33 | +// FaultSectionUtils.findParentSectionID(sects, "Raymond") |
| 34 | + FaultSectionUtils.findParentSectionID(sects, "Puente Hills", "Los Angeles"), |
| 35 | + FaultSectionUtils.findParentSectionID(sects, "Puente Hills", "Santa Fe Springs"), |
| 36 | + FaultSectionUtils.findParentSectionID(sects, "Puente Hills", "Coyote Hills"), |
| 37 | + }; |
| 38 | + |
| 39 | + List<FaultSection> matchingSects = new ArrayList<>(); |
| 40 | + |
| 41 | + for (FaultSection sect : sects) |
| 42 | + for (int parentID : parentIDs) |
| 43 | + if (sect.getParentSectionId() == parentID) |
| 44 | + matchingSects.add(sect); |
| 45 | + |
| 46 | + System.out.println("Found "+matchingSects.size()+" matching sects"); |
| 47 | + for (FaultSection sect : matchingSects) |
| 48 | + System.out.println("\t"+sect.getSectionName()); |
| 49 | + |
| 50 | + double totArea = 0; |
| 51 | + double totOrigArea = 0; |
| 52 | + double totLen = 0; |
| 53 | + List<Double> rakes = new ArrayList<>(); |
| 54 | + List<Double> weights = new ArrayList<>(); |
| 55 | + for (FaultSection sect : matchingSects) { |
| 56 | + totOrigArea += sect.getArea(false); // sq-m |
| 57 | + totArea += sect.getArea(true); // sq-m |
| 58 | + totLen += sect.getTraceLength()*1e3; // km -> m |
| 59 | + rakes.add(sect.getAveRake()); |
| 60 | + weights.add(sect.getArea(true)); |
| 61 | + } |
| 62 | + double origDDW = totOrigArea / totLen; |
| 63 | + double aveRake = FaultUtils.getInRakeRange(FaultUtils.getScaledAngleAverage(weights, rakes)); |
| 64 | + |
| 65 | + for (NSHM23_ScalingRelationships scale : scales) { |
| 66 | + double mag = scale.getMag(totArea, totLen, totArea/totLen, origDDW, aveRake); |
| 67 | + System.out.println(scale.getShortName()+":\t"+(float)mag); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | +} |
0 commit comments