Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Milner committed May 22, 2024
1 parent 7d99e78 commit 8212088
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public static void main(String[] args) throws IOException {

/*
* NSHM23 logic tree
* TODO (this is a just a marker to find this part quickly)
* TODO (this is a just a marker to find this part quickly, not an actual todo)
*/
//// List<LogicTreeLevel<? extends LogicTreeNode>> levels = NSHM23_U3_HybridLogicTreeBranch.levels;
//// dirName += "-nshm23_u3_hybrid_branches";
Expand Down Expand Up @@ -598,7 +598,7 @@ public static void main(String[] args) throws IOException {

/*
* PRVI25 logic tree
* TODO (this is a just a marker to find this part quickly)
* TODO (this is a just a marker to find this part quickly, not an actual todo)
*/
List<LogicTreeLevel<? extends LogicTreeNode>> levels = PRVI25_LogicTreeBranch.levelsOnFault;
dirName += "-prvi25_crustal_branches";
Expand All @@ -613,6 +613,9 @@ public static void main(String[] args) throws IOException {
// Preconditions.checkState(levels.size() == origNumLevels -1);
// individualRandomLevels.add(new PRVI25_CrustalRandomlySampledDeformationModelLevel());
// samplingBranchCountMultiplier = 5; // 5 for each branch
// dirName += "-dmSample";
// if (samplingBranchCountMultiplier > 1)
// dirName += samplingBranchCountMultiplier+"x";

// List<LogicTreeLevel<? extends LogicTreeNode>> levels = PRVI25_LogicTreeBranch.levelsSubduction;
// dirName += "-prvi25_subduction_branches";
Expand All @@ -622,6 +625,8 @@ public static void main(String[] args) throws IOException {
// levels = new ArrayList<>(levels);
// levels.add(NSHM23_LogicTreeBranch.SUB_SECT_CONSTR);

// dirName += "-proxyGriddedTests";

Class<? extends InversionConfigurationFactory> factoryClass = PRVI25_InvConfigFactory.class;

if (!factoryClass.equals(PRVI25_InvConfigFactory.class)) {
Expand All @@ -646,54 +651,24 @@ public static void main(String[] args) throws IOException {
// RUPTURE SETS
// RupturePlausibilityModels.COULOMB, // default
// RupturePlausibilityModels.COULOMB_5km,
// RupturePlausibilityModels.AZIMUTHAL,
// RupturePlausibilityModels.SEGMENTED,
// RupturePlausibilityModels.UCERF3,
// RupturePlausibilityModels.UCERF3_REDUCED,

// DEFORMATION MODELS
PRVI25_CrustalDeformationModels.GEOLOGIC,
// PRVI25_CrustalDeformationModels.GEOLOGIC,

// SCALING RELATIONSHIPS

// SLIP ALONG RUPTURE
// NSHM23_SlipAlongRuptureModels.UNIFORM,
// NSHM23_SlipAlongRuptureModels.TAPERED,

// SUB-SECT CONSTRAINT
// SubSectConstraintModels.TOT_NUCL_RATE, // default
// SubSectConstraintModels.NUCL_MFD,

// SUB-SEIS MO REDUCTION
// SubSeisMoRateReductions.SUB_B_1,
// SubSeisMoRateReductions.NONE, // default
// SubSeisMoRateReductions.SYSTEM_AVG,
// SubSeisMoRateReductions.SYSTEM_AVG_SUB_B_1,

// SUPRA-SEIS-B
// SupraSeisBValues.B_0p5,
// SupraSeisBValues.AVERAGE,

// PALEO UNCERT
// NSHM23_PaleoUncertainties.EVEN_FIT,

// SEGMENTATION
// SegmentationModels.SHAW_R0_3,
// NSHM23_SegmentationModels.AVERAGE,
// NSHM23_SegmentationModels.MID,
// NSHM23_SegmentationModels.CLASSIC,
// NSHM23_SegmentationModels.CLASSIC_FULL,

// SEG ADJUSTMENT
// SegmentationMFD_Adjustment.NONE,
// SegmentationMFD_Adjustment.JUMP_PROB_THRESHOLD_AVG,
// SegmentationMFD_Adjustment.REL_GR_THRESHOLD_AVG_SINGLE_ITER,
// SegmentationMFD_Adjustment.REL_GR_THRESHOLD_AVG, // default
// SegmentationMFD_Adjustment.CAPPED_REDIST,
// SegmentationMFD_Adjustment.CAPPED_REDIST_SELF_CONTAINED,
// SegmentationMFD_Adjustment.GREEDY,
// SegmentationMFD_Adjustment.GREEDY_SELF_CONTAINED,
// SegmentationMFD_Adjustment.JUMP_PROB_THRESHOLD_AVG_MATCH_STRICT,
};
// LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.SYSTEM_AVG };
// LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.FAULT_SPECIFIC };
Expand Down
64 changes: 63 additions & 1 deletion src/main/java/scratch/kevin/ucerf3/PureScratch.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,12 @@
import scratch.UCERF3.enumTreeBranches.ScalingRelationships;
import scratch.UCERF3.enumTreeBranches.TotalMag5Rate;
import scratch.UCERF3.erf.FaultSystemSolutionERF;
import scratch.UCERF3.erf.ETAS.FaultSystemSolutionERF_ETAS;
import scratch.UCERF3.erf.ETAS.launcher.ETAS_Config;
import scratch.UCERF3.erf.ETAS.launcher.ETAS_Launcher;
import scratch.UCERF3.erf.ETAS.launcher.TriggerRupture;
import scratch.UCERF3.erf.ETAS.launcher.TriggerRupture.EdgeFault;
import scratch.UCERF3.griddedSeismicity.AbstractGridSourceProvider;
import scratch.UCERF3.inversion.U3InversionTargetMFDs;
import scratch.UCERF3.inversion.UCERF3InversionConfiguration;
import scratch.UCERF3.logicTree.U3LogicTreeBranch;
Expand Down Expand Up @@ -5746,12 +5749,71 @@ private static void test290() throws IOException {
System.out.println("Things in common: "+common);
}

private static void test291() throws IOException {
AbstractGridSourceProvider.SOURCE_MIN_MAG_CUTOFF = 2.55;
FaultSystemSolution sol = FaultSystemSolution.load(new File("/data/kevin/git/ucerf3-etas-launcher/inputs/"
// FaultSystemSolution sol = FaultSystemSolution.load(new File("/home/kevin/OpenSHA/UCERF3/rup_sets/orig/"
+ "2013_05_10-ucerf3p3-production-10runs_COMPOUND_SOL_FM3_1_SpatSeisU3_MEAN_BRANCH_AVG_SOL.zip"));

FaultSystemSolutionERF_ETAS erf = ETAS_Launcher.buildERF(sol, false, 500d, 2012);

erf.updateForecast();

System.out.println("RupSet is a "+sol.getRupSet().getClass().getName());
System.out.println("Sol is a "+sol.getClass().getName());
System.out.println("RupSet has ModSectMinMags? "+sol.getRupSet().hasModule(ModSectMinMags.class));
System.out.println("Sol has RupMFDs? "+sol.hasModule(RupMFDsModule.class));
System.out.println("ERF totNumRups: "+erf.getTotNumRups());
System.out.println("ERF getTotNumRupsFromFaultSystem: "+erf.getTotNumRupsFromFaultSystem());
System.out.println("ERF getNumFaultSystemSources: "+erf.getNumFaultSystemSources());
System.out.println("ERF getNumSources: "+erf.getNumSources());
}

private static void test292() throws IOException {
FaultSystemSolution sol = FaultSystemSolution.load(new File("/home/kevin/OpenSHA/nshm23/batch_inversions/"
+ "2024_05_21-prvi25_crustal_branches-GEOLOGIC/results_PRVI_FM_INITIAL_branch_averaged.zip"));
FaultSystemSolutionERF erf = new FaultSystemSolutionERF(sol);
erf.setParameter(IncludeBackgroundParam.NAME, IncludeBackgroundOption.EXCLUDE);
erf.updateForecast();

FaultSystemRupSet rupSet = sol.getRupSet();
GeographicMapMaker mapMaker = new GeographicMapMaker(rupSet.getFaultSectionDataList());

List<LocationList> lines = new ArrayList<>();
List<Double> lineMags = new ArrayList<>();
double minMag = Double.POSITIVE_INFINITY;
double maxMag = Double.NEGATIVE_INFINITY;
for (int rupIndex=0; rupIndex<rupSet.getNumRuptures(); rupIndex++) {
boolean allProxies = true;
for (FaultSection sect : rupSet.getFaultSectionDataForRupture(rupIndex))
allProxies &= sect.isProxyFault();
int sourceID = erf.getSrcIndexForFltSysRup(rupIndex);
if (sourceID > 0 && allProxies) {
double mag = rupSet.getMagForRup(rupIndex);
for (ProbEqkRupture rup : erf.getSource(sourceID)) {
RuptureSurface surf = rup.getRuptureSurface();
lines.add(surf.getUpperEdge());
lineMags.add(mag);
minMag = Double.min(minMag, mag);
maxMag = Double.max(maxMag, mag);
}
}
}
CPT cpt = GMT_CPT_Files.RAINBOW_UNIFORM.instance().rescale(minMag, maxMag);
List<Color> colors = new ArrayList<>();
for (double mag : lineMags)
colors.add(cpt.getColor((float)mag));
mapMaker.plotLines(lines, colors, 2f);

mapMaker.plot(new File("/tmp"), "proxy_finite_test", " ");
}

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
test290();
test292();
}

}

0 comments on commit 8212088

Please sign in to comment.