2222import org .opensha .sha .calc .HazardCurveCalculator ;
2323import org .opensha .sha .calc .params .filters .SourceFilterManager ;
2424import org .opensha .sha .calc .params .filters .SourceFilters ;
25+ import org .opensha .sha .earthquake .ProbEqkRupture ;
26+ import org .opensha .sha .earthquake .ProbEqkSource ;
27+ import org .opensha .sha .earthquake .faultSysSolution .FaultSystemRupSet ;
2528import org .opensha .sha .earthquake .faultSysSolution .FaultSystemSolution ;
2629import org .opensha .sha .earthquake .faultSysSolution .erf .BaseFaultSystemSolutionERF ;
30+ import org .opensha .sha .earthquake .faultSysSolution .util .FaultSectionUtils ;
31+ import org .opensha .sha .earthquake .param .AseismicityAreaReductionParam ;
2732import org .opensha .sha .earthquake .param .IncludeBackgroundOption ;
2833import org .opensha .sha .earthquake .param .IncludeBackgroundParam ;
34+ import org .opensha .sha .earthquake .param .UseProxySectionsParam ;
35+ import org .opensha .sha .earthquake .param .UseRupMFDsParam ;
36+ import org .opensha .sha .faultSurface .FaultSection ;
2937import org .opensha .sha .gui .infoTools .IMT_Info ;
3038import org .opensha .sha .imr .AttenRelRef ;
3139import org .opensha .sha .imr .ScalarIMR ;
3240import org .opensha .sha .imr .attenRelImpl .nshmp .GroundMotionLogicTreeFilter ;
3341import org .opensha .sha .imr .attenRelImpl .nshmp .NSHMP_GMM_Wrapper ;
42+ import org .opensha .sha .imr .param .IntensityMeasureParams .PGA_Param ;
3443import org .opensha .sha .imr .param .IntensityMeasureParams .SA_Param ;
3544import org .opensha .sha .imr .param .OtherParams .SigmaTruncLevelParam ;
3645import org .opensha .sha .imr .param .OtherParams .SigmaTruncTypeParam ;
3746
3847import com .google .common .base .Preconditions ;
48+ import com .google .common .collect .ImmutableList ;
3949
4050import gov .usgs .earthquake .nshmp .gmm .Gmm ;
51+ import gov .usgs .earthquake .nshmp .gmm .GmmInput ;
52+ import gov .usgs .earthquake .nshmp .gmm .GroundMotion ;
4153import gov .usgs .earthquake .nshmp .gmm .GroundMotions ;
4254import gov .usgs .earthquake .nshmp .gmm .UsgsPrviBackbone2025 ;
55+ import gov .usgs .earthquake .nshmp .gmm .GmmInput .Constraints ;
56+ import gov .usgs .earthquake .nshmp .gmm .GmmInput .Field ;
57+ import gov .usgs .earthquake .nshmp .tree .LogicTree ;
4358import net .mahdilamb .colormap .Colors ;
4459
4560public class SiteHazCompNSHMPHaz {
@@ -54,12 +69,17 @@ public static void main(String[] args) throws IOException {
5469// + "prvi-0.2s-ask14base-crustalFaultOnly-PRVI_2025_ACTIVE_CRUST_NO_EPI_SIGMA_NGA.csv"), true);
5570
5671// NSHMP_GMM_Wrapper gmm = new NSHMP_GMM_Wrapper.Single(Gmm.PRVI_2025_ACTIVE_CRUST);
72+ //// gmm.setGroundMotionTreeFilter(new GroundMotionLogicTreeFilter.StringMatching(
73+ ////// UsgsPrviBackbone2025.SIGMA_NGA_ID,
74+ //// GroundMotions.EPI_OFF
75+ //// ));
5776// CSVFile<String> inCSV = CSVFile.readFile(new File("/home/kevin/Downloads/"
5877// + "prvi-0.2s-prvi25active-crustalFaultOnly-curves.csv"), true);
5978
6079 NSHMP_GMM_Wrapper gmm = new NSHMP_GMM_Wrapper .WeightedCombination (
6180 WeightedList .of (new WeightedValue <>(Gmm .PRVI_2025_ACTIVE_CRUST , 0.5 ),
6281 new WeightedValue <>(Gmm .PRVI_2025_ACTIVE_CRUST_ADJUSTED , 0.5 )), "Name" , "Name" );
82+ // NSHMP_GMM_Wrapper gmm = new NSHMP_GMM_Wrapper.Single(Gmm.TOTAL_TREE_PRVI_ACTIVE_CRUST_2025);
6383// gmm.setGroundMotionTreeFilter(new GroundMotionLogicTreeFilter.StringMatching(
6484// UsgsPrviBackbone2025.SIGMA_NGA_ID,
6585// GroundMotions.EPI_OFF
@@ -68,20 +88,63 @@ public static void main(String[] args) throws IOException {
6888 + "prvi-0.2s-prvi25activeTotal-crustalFaultOnly-curves.csv" ), true );
6989
7090 gmm .setIntensityMeasure (SA_Param .NAME );
71- gmm .getOtherParams ().setValue (SigmaTruncTypeParam .NAME , SigmaTruncTypeParam .SIGMA_TRUNC_TYPE_1SIDED );
72- gmm .getOtherParams ().setValue (SigmaTruncLevelParam .NAME , 3d );
7391 SA_Param .setPeriodInSA_Param (gmm .getIntensityMeasure (), 0.2 );
7492 String xName = "0.2s SA (g)" ;
93+ // gmm.setIntensityMeasure(PGA_Param.NAME);
94+ // String xName = "PGA (g)";
95+ gmm .getOtherParams ().setValue (SigmaTruncTypeParam .NAME , SigmaTruncTypeParam .SIGMA_TRUNC_TYPE_1SIDED );
96+ gmm .getOtherParams ().setValue (SigmaTruncLevelParam .NAME , 3d );
97+
98+
99+ System .out .println ("Zhype used ? Gmm.PRVI_2025_ACTIVE_CRUST: " +Gmm .PRVI_2025_ACTIVE_CRUST .constraints ().get (Field .ZHYP ).isPresent ());
100+ System .out .println ("Zhype used ? Gmm.PRVI_2025_ACTIVE_CRUST: " +Gmm .TOTAL_TREE_PRVI_ACTIVE_CRUST_2025 .constraints ().get (Field .ZHYP ).isPresent ());
101+
102+ if (gmm instanceof NSHMP_GMM_Wrapper .Single ) {
103+ Gmm singleGMM = ((NSHMP_GMM_Wrapper .Single )gmm ).getGmmRef ();
104+ Constraints constraints = singleGMM .constraints ();
105+ for (Field field : Field .values ()) {
106+ if (constraints .get (field ).isPresent ()) {
107+ // this field is used
108+ System .out .println (singleGMM .name ()+" reports that " +field +" is used" );
109+ } else {
110+ System .out .println (singleGMM .name ()+" reports that " +field +" is unused" );
111+ }
112+ }
113+ }
75114
76115 FaultSystemSolution sol = FaultSystemSolution .load (new File ("/home/kevin/OpenSHA/nshm23/batch_inversions/"
77116 + "2025_08_01-prvi25_crustal_branches-dmSample10x/"
78117 + "results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded_simplified.zip" ));
118+ // + "results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip"));
79119 BaseFaultSystemSolutionERF erf = new BaseFaultSystemSolutionERF ();
80120 erf .setSolution (sol );
81121 erf .setParameter (IncludeBackgroundParam .NAME , IncludeBackgroundOption .EXCLUDE );
122+ // erf.setParameter(UseProxySectionsParam.NAME, false);
123+ // erf.setParameter(AseismicityAreaReductionParam.NAME, false);
124+ erf .setParameter (UseRupMFDsParam .NAME , false );
82125 erf .getTimeSpan ().setDuration (1d );
83126 erf .updateForecast ();
84127
128+ FaultSystemRupSet rupSet = sol .getRupSet ();
129+ int testParentID = FaultSectionUtils .findParentSectionID (rupSet .getFaultSectionDataList (), "South Lajas" );
130+ int testRupID = -1 ;
131+ double testRupMag = 0d ;
132+ for (int r : rupSet .getRupturesForParentSection (testParentID )) {
133+ boolean allMatch = true ;
134+ for (FaultSection sect : rupSet .getFaultSectionDataForRupture (r )) {
135+ if (sect .getParentSectionId () != testParentID ) {
136+ allMatch = false ;
137+ break ;
138+ }
139+ }
140+ if (allMatch && rupSet .getMagForRup (r ) > testRupMag ) {
141+ testRupID = r ;
142+ testRupMag = rupSet .getMagForRup (r );
143+ }
144+ }
145+ int testSourceID = erf .getSrcIndexForFltSysRup (testRupID );
146+ ProbEqkSource testSource = erf .getSource (testSourceID );
147+
85148 HazardCurveCalculator calc = new HazardCurveCalculator (new SourceFilterManager (SourceFilters .TRT_DIST_CUTOFFS ));
86149
87150 DiscretizedFunc xVals = new IMT_Info ().getDefaultHazardCurve (gmm .getIntensityMeasure ());
@@ -111,6 +174,19 @@ public static void main(String[] args) throws IOException {
111174 }
112175 theirs .setName ("NSHMP-Haz" );
113176
177+ System .out .println ("Site:\t " +name );
178+ gmm .setSite (site );
179+ for (int r =0 ; r <testSource .getNumRuptures (); r ++) {
180+ ProbEqkRupture rup = testSource .getRupture (r );
181+ gmm .setEqkRupture (rup );
182+ GmmInput gmmInput = gmm .getCurrentGmmInput ();
183+ LogicTree <GroundMotion > gmmTree = gmm .getGroundMotionTree ();
184+ System .out .println ("FSS rup " +testRupID +", ERF source " +testSourceID +" (" +r +")" );
185+ System .out .println (gmmInput );
186+ System .out .println (gmmTree );
187+ }
188+ System .out .println ();
189+
114190 calc .getHazardCurve (logXvalues , site , gmm , erf );
115191
116192 DiscretizedFunc ours = xVals .deepClone ();
0 commit comments