From 39e740ed563bc0a50d041dd0b7e0b10572e2a3e8 Mon Sep 17 00:00:00 2001 From: kmilner Date: Sun, 23 Jun 2024 14:09:40 -0700 Subject: [PATCH] new GridSourceProviderFactory interface, MPJ code now uses it --- .../scratch/kevin/nshm23/GridAssocDebug.java | 2 +- ..._LogicTreeInversionRunnerScriptWriter.java | 765 +++++++++--------- 2 files changed, 383 insertions(+), 384 deletions(-) diff --git a/src/main/java/scratch/kevin/nshm23/GridAssocDebug.java b/src/main/java/scratch/kevin/nshm23/GridAssocDebug.java index 33e9ee04..981be013 100644 --- a/src/main/java/scratch/kevin/nshm23/GridAssocDebug.java +++ b/src/main/java/scratch/kevin/nshm23/GridAssocDebug.java @@ -11,11 +11,11 @@ import org.opensha.commons.util.modules.OpenSHA_Module; import org.opensha.sha.earthquake.faultSysSolution.FaultSystemRupSet; import org.opensha.sha.earthquake.faultSysSolution.FaultSystemSolution; +import org.opensha.sha.earthquake.faultSysSolution.inversion.mpj.MPJ_GridSeisBranchBuilder; import org.opensha.sha.earthquake.faultSysSolution.modules.FaultGridAssociations; import org.opensha.sha.earthquake.faultSysSolution.modules.GridSourceProvider; import org.opensha.sha.earthquake.faultSysSolution.modules.ModelRegion; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.NSHM23_InvConfigFactory; -import org.opensha.sha.earthquake.rupForecastImpl.nshm23.gridded.MPJ_GridSeisBranchBuilder; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.gridded.NSHM23_FaultCubeAssociations; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.NSHM23_LogicTreeBranch; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.NSHM23_SeisSmoothingAlgorithms; diff --git a/src/main/java/scratch/kevin/nshm23/MPJ_LogicTreeInversionRunnerScriptWriter.java b/src/main/java/scratch/kevin/nshm23/MPJ_LogicTreeInversionRunnerScriptWriter.java index c5d2e073..1ad9a8b6 100644 --- a/src/main/java/scratch/kevin/nshm23/MPJ_LogicTreeInversionRunnerScriptWriter.java +++ b/src/main/java/scratch/kevin/nshm23/MPJ_LogicTreeInversionRunnerScriptWriter.java @@ -39,8 +39,10 @@ import org.opensha.sha.earthquake.faultSysSolution.hazard.mpj.MPJ_LogicTreeHazardCalc; import org.opensha.sha.earthquake.faultSysSolution.hazard.mpj.MPJ_SiteLogicTreeHazardCurveCalc; import org.opensha.sha.earthquake.faultSysSolution.inversion.ClusterSpecificInversionConfigurationFactory; +import org.opensha.sha.earthquake.faultSysSolution.inversion.GridSourceProviderFactory; import org.opensha.sha.earthquake.faultSysSolution.inversion.InversionConfigurationFactory; import org.opensha.sha.earthquake.faultSysSolution.inversion.mpj.AbstractAsyncLogicTreeWriter; +import org.opensha.sha.earthquake.faultSysSolution.inversion.mpj.MPJ_GridSeisBranchBuilder; import org.opensha.sha.earthquake.faultSysSolution.inversion.mpj.MPJ_LogicTreeBranchAverageBuilder; import org.opensha.sha.earthquake.faultSysSolution.inversion.mpj.MPJ_LogicTreeInversionRunner; import org.opensha.sha.earthquake.faultSysSolution.inversion.sa.completion.CompletionCriteria; @@ -51,7 +53,6 @@ import org.opensha.sha.earthquake.faultSysSolution.reports.ReportPageGen.PlotLevel; import org.opensha.sha.earthquake.faultSysSolution.util.TrueMeanSolutionCreator; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.NSHM23_InvConfigFactory; -import org.opensha.sha.earthquake.rupForecastImpl.nshm23.gridded.MPJ_GridSeisBranchBuilder; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.DistDependSegShift; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.MaxJumpDistModels; import org.opensha.sha.earthquake.rupForecastImpl.nshm23.logicTree.NSHM23_DeformationModels; @@ -150,8 +151,6 @@ public static void main(String[] args) throws IOException { AttenRelRef gmpe = AttenRelRef.ASK_2014; - boolean griddedJob = false; - List> individualRandomLevels = new ArrayList<>(); int samplingBranchCountMultiplier = 1; @@ -247,389 +246,202 @@ public static void main(String[] args) throws IOException { * NSHM23 logic tree * TODO (this is a just a marker to find this part quickly, not an actual todo) */ -//// List> levels = NSHM23_U3_HybridLogicTreeBranch.levels; -//// dirName += "-nshm23_u3_hybrid_branches"; -//// double avgNumRups = 325000; -// -// List> levels = NSHM23_LogicTreeBranch.levelsOnFault; -// dirName += "-nshm23_branches"; -// double avgNumRups = 600000; -// -//// List> levels = NSHM18_LogicTreeBranch.levels; -//// dirName += "-nshm18_branches-wc_94"; -//// double avgNumRups = 500000; -// -//// List> levels = NSHM18_LogicTreeBranch.levelsNewScale; -//// dirName += "-nshm18_branches-new_scale"; -//// double avgNumRups = 500000; -// -//// levels = new ArrayList<>(levels); -//// for (int i=levels.size(); --i>=0;) -//// if (levels.get(i).getType().isAssignableFrom(ShawSegmentationModels.class) -//// || levels.get(i).getType().isAssignableFrom(NSHM23_SegmentationModels.class) -//// || levels.get(i).getType().isAssignableFrom(SegmentationMFD_Adjustment.class) -//// || levels.get(i).getType().isAssignableFrom(DistDependSegShift.class)) -//// levels.remove(i); -//// dirName += "-no_seg"; -////// levels.add(NSHM23_LogicTreeBranch.RUPS_THROUGH_CREEPING); -////// dirName += "-creep_branches"; -////// levels.add(NSHM23_LogicTreeBranch.MAX_DIST); -////// dirName += "-strict_cutoff_seg"; strictSeg = true; -// -// -//// dirName += "-pre_zero_slip_parent_fix"; -//// dirName += "-reweight_seg_2_3_4"; -// -//// levels = new ArrayList<>(levels); -//// int origSize = levels.size(); -//// for (int i=levels.size(); --i>=0;) -//// if (levels.get(i).getType().isAssignableFrom(ScalingRelationships.class)) -//// levels.remove(i); -//// Preconditions.checkState(levels.size() < origSize); -//// levels.add(NSHM23_LogicTreeBranch.SCALE); -//// dirName += "-new_scale_rels"; -//// dirName += "-full_set"; -// -// Class factoryClass = NSHM23_InvConfigFactory.class; -// -//// Class factoryClass = NSHM23_InvConfigFactory.MFDUncert0p1.class; -//// dirName += "-mfd_uncert_0p1"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ConstantSlipRateStdDev0p1.class; -//// dirName += "-const_slip_sd_0p1"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ConstantSlipRateStdDev0p2.class; -//// dirName += "-const_slip_sd_0p2"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.FullSysInv.class; -//// dirName += "-full_sys_inv"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ClusterSpecific.class; -//// dirName += "-cluster_specific_inversion"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SegWeight100.class; -//// dirName += "-seg_weight_100"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SegWeight1000.class; -//// dirName += "-seg_weight_1000"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SegWeight10000.class; -//// dirName += "-seg_weight_10000"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevWeightAdjust.class; -//// dirName += "-no_reweight_use_prev"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevWeightAdjustFullSys.class; -//// dirName += "-full_sys_inv-no_reweight_use_prev"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedOrigWeights.class; -//// dirName += "-no_reweight_use_orig"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedOrigWeightsFullSys.class; -//// dirName += "-full_sys_inv-no_reweight_use_orig"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevAvgWeights.class; -//// dirName += "-no_reweight_use_prev_avg"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevAvgWeightsFullSys.class; -//// dirName += "-full_sys_inv-no_reweight_use_prev_avg"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NoPaleoParkfield.class; -//// dirName += "-no_paleo_parkfield"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NoMFDScaleAdjust.class; -//// dirName += "-no_scale_adj_mfds"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NoIncompatibleDataAdjust.class; -//// dirName += "-no_mfd_sigma_data_adj"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ScaleLowerDepth1p3.class; -//// dirName += "-scaleLowerDepth1.3"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevAsInitial.class; -//// dirName += "-prev_as_initial"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NoAvg.class; -//// dirName += "-no_avg"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ForceNewPaleo.class; -//// dirName += "-new_paleo"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NewScaleUseOrigWidths.class; -//// dirName += "-use_orig_widths"; -// -// // also set nonzero weights! -//// Class factoryClass = NSHM23_InvConfigFactory.ForceWideSegBranches.class; -//// dirName += "-wide_seg_branches"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ForceNoGhostTransient.class; -//// dirName += "-no_ghost_trans"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ScaleSurfSlipUseActualWidths.class; -//// dirName += "-surf_slip_use_actual_w"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.RemoveIsolatedFaults.class; -//// dirName += "-remove_isolated_faults"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.RemoveProxyFaults.class; -//// dirName += "-remove_proxy_faults"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NoPaleoSlip.class; -//// dirName += "-no_paleo_slip"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.PaleoSlipInequality.class; -//// dirName += "-paleo_slip_ineq"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.TenThousandItersPerRup.class; -//// dirName += "-10000ip"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OriginalWeights.class; -//// dirName += "-dm_orig_weights"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierlMinimizationWeights.class; -//// dirName += "-dm_outlier_minimize_weights"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = false; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierReplacementYc2p0.class; -//// dirName += "-dm_outlier_sub_yc_2"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierReplacementYc3p5.class; -//// dirName += "-dm_outlier_sub_yc_3p5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierReplacementYc5p0.class; -//// dirName += "-dm_outlier_sub_yc_5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierLogReplacementYc2p0.class; -//// dirName += "-dm_outlier_log_sub_yc_2"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierLogReplacementYc3p5.class; -//// dirName += "-dm_outlier_log_sub_yc_3p5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierLogReplacementYc5p0.class; -//// dirName += "-dm_outlier_log_sub_yc_5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SegModelLimitMaxLen.class; -//// dirName += "-seg_limit_max_length"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SlipRateStdDevCeil0p1.class; -//// dirName += "-slip_rate_sd_ceil_0p1"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SegModelMaxLen600.class; -//// dirName += "-seg_limit_max_length_600"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.SparseGRDontSpreadSingleToMulti.class; -//// dirName += "-sparse_gr_dont_spread_single_multi"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ModDepthGV08.class; -//// dirName += "-gv_08_mod_depth"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.OrigDraftScaling.class; -//// dirName += "-orig_draft_scaling"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ModScalingAdd4p3.class; -//// dirName += "-mod_scaling"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.NSHM18_UseU3Paleo.class; -//// dirName += "-u3_paleo"; -// -//// Class factoryClass = NSHM23_InvConfigFactory.ModPitasPointDDW.class; -//// dirName += "-mod_pitas_ddw"; -// -//// Class factoryClass = DefModSamplingEnabledInvConfig.ConnDistB0p5MidSegCorr.class; -//// dirName += "-dm_sampling"; -//// individualRandomLevels.add(new RandomDefModSampleLevel()); -// -//// Class factoryClass = DefModSamplingEnabledInvConfig.ConnDistB0p5MidSegCorrCapSigma.class; -//// dirName += "-dm_sampling_cap_sigma"; -//// individualRandomLevels.add(new RandomDefModSampleLevel()); -// -// if (!factoryClass.equals(NSHM23_InvConfigFactory.class)) { -// // try instantiate it to make sure we get any static modifiers that might change branch weights -// try { -// System.out.println("Instantiating factory class: "+factoryClass.getName()); -// factoryClass.getDeclaredConstructor().newInstance(); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } -// -//// levels = new ArrayList<>(levels); -//// boolean randB = true; -//// boolean randSeg = true; -//// int origSize = levels.size(); -//// for (int i=levels.size(); --i>=0;) { -//// if (randB && SupraSeisBValues.class.isAssignableFrom(levels.get(i).getType())) -//// levels.remove(i); -//// if (randSeg && SegmentationModelBranchNode.class.isAssignableFrom(levels.get(i).getType())) -//// levels.remove(i); -//// } -//// Preconditions.checkState(levels.size() < origSize); -//// if (randB) { -//// samplingBranchCountMultiplier *= 5; // there were originally 5 each -//// dirName += "-randB"; -//// individualRandomLevels.add(new RandomBValSampler.Level()); -//// } -//// if (randSeg) { -//// samplingBranchCountMultiplier *= 5; // there were originally 5 each -//// dirName += "-randSeg"; -//// individualRandomLevels.add(new RandomSegModelSampler.Level()); -//// } -// -//// dirName += "-mini_one_fifth"; -//// samplingBranchCountMultiplier /= 5; -// -//// dirName += "-u3_perturb"; -//// extraArgs.add("--perturb "+GenerationFunctionType.UNIFORM_0p001.name()); -//// dirName += "-exp_perturb"; -//// extraArgs.add("--perturb "+GenerationFunctionType.EXPONENTIAL_SCALE.name()); -//// dirName += "-limit_zeros"; -//// extraArgs.add("--non-negativity "+NonnegativityConstraintType.LIMIT_ZERO_RATES.name()); -//// dirName += "-classic_sa"; -//// extraArgs.add("--cooling-schedule "+CoolingScheduleType.CLASSICAL_SA.name()); -// -//// levels = new ArrayList<>(levels); -//// levels.add(NSHM23_LogicTreeBranch.SINGLE_STATES); -//// dirName += "-single_state"; -// -//// dirName += "-mod_west_valley_ddw"; -// -//// dirName += "-mod_dm_weights"; -// -// forceHazardGridSpacing = 0.1; -// -// forceRequiredNonzeroWeight = true; -// griddedJob = true; -// LogicTreeNode[] required = { -// // FAULT MODELS -//// FaultModels.FM3_1, -//// FaultModels.FM3_2, -//// NSHM18_FaultModels.NSHM18_WUS_NoCA, -//// NSHM18_FaultModels.NSHM18_WUS_PlusU3_FM_3p1, -//// NSHM23_FaultModels.FM_v1p4, -//// NSHM23_FaultModels.FM_v2, -// NSHM23_FaultModels.WUS_FM_v3, -//// PRVI25_FaultModels.PRVI_FM_INITIAL, -// -//// // SINGLE STATE -//// NSHM23_SingleStates.NM, -//// NSHM23_SingleStates.UT, -// -// // RUPTURE SETS -//// RupturePlausibilityModels.COULOMB, // default -//// RupturePlausibilityModels.COULOMB_5km, -//// RupturePlausibilityModels.AZIMUTHAL, -//// RupturePlausibilityModels.SEGMENTED, -//// RupturePlausibilityModels.UCERF3, -//// RupturePlausibilityModels.UCERF3_REDUCED, -// -// // DEFORMATION MODELS -//// U3_UncertAddDeformationModels.U3_ZENG, -//// U3_UncertAddDeformationModels.U3_MEAN, -//// NSHM18_DeformationModels.BRANCH_AVERAGED, -//// NSHM23_DeformationModels.AVERAGE, -//// NSHM23_DeformationModels.GEOLOGIC, -//// NSHM23_DeformationModels.EVANS, -//// NSHM23_DeformationModels.MEDIAN, -// -// // SCALING RELATIONSHIPS -//// ScalingRelationships.SHAW_2009_MOD, -//// ScalingRelationships.MEAN_UCERF3, -//// NSHM23_ScalingRelationships.AVERAGE, -//// NSHM23_ScalingRelationships.LOGA_C4p2_SQRT_LEN, -//// NSHM23_ScalingRelationships.WIDTH_LIMITED_CSD, -// -// // SLIP ALONG RUPTURE -//// NSHM23_SlipAlongRuptureModels.UNIFORM, -//// NSHM23_SlipAlongRuptureModels.TAPERED, -//// SlipAlongRuptureModels.UNIFORM, -//// 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-SHIFT -//// DistDependSegShift.NONE, -//// DistDependSegShift.ONE_KM, -//// DistDependSegShift.TWO_KM, -//// DistDependSegShift.THREE_KM, -// -// // 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, -// -// // CREEPING SECTION -//// RupsThroughCreepingSect.INCLUDE, -//// RupsThroughCreepingSect.EXCLUDE, -// }; -//// LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.SYSTEM_AVG }; -//// LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.FAULT_SPECIFIC }; -//// Class sortBy = SubSectConstraintModels.class; -// Class sortBy = NSHM23_SegmentationModels.class; - /* - * END NSHM23 logic tree - */ +// List> levels = NSHM23_U3_HybridLogicTreeBranch.levels; +// dirName += "-nshm23_u3_hybrid_branches"; +// double avgNumRups = 325000; - /* - * PRVI25 logic tree - * TODO (this is a just a marker to find this part quickly, not an actual todo) - */ -// List> levels = PRVI25_LogicTreeBranch.levelsOnFault; -// dirName += "-prvi25_crustal_branches"; -// double avgNumRups = 50000; + List> levels = NSHM23_LogicTreeBranch.levelsOnFault; + dirName += "-nshm23_branches"; + double avgNumRups = 600000; + +// List> levels = NSHM18_LogicTreeBranch.levels; +// dirName += "-nshm18_branches-wc_94"; +// double avgNumRups = 500000; + +// List> levels = NSHM18_LogicTreeBranch.levelsNewScale; +// dirName += "-nshm18_branches-new_scale"; +// double avgNumRups = 500000; - // random DM sampling // levels = new ArrayList<>(levels); -// int origNumLevels = levels.size(); // for (int i=levels.size(); --i>=0;) -// if (levels.get(i).getNodes().get(0) instanceof PRVI25_CrustalDeformationModels) +// if (levels.get(i).getType().isAssignableFrom(ShawSegmentationModels.class) +// || levels.get(i).getType().isAssignableFrom(NSHM23_SegmentationModels.class) +// || levels.get(i).getType().isAssignableFrom(SegmentationMFD_Adjustment.class) +// || levels.get(i).getType().isAssignableFrom(DistDependSegShift.class)) // levels.remove(i); -// 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> levels = PRVI25_LogicTreeBranch.levelsSubduction; - dirName += "-prvi25_subduction_branches"; - double avgNumRups = 10000; - gmpe = AttenRelRef.AG_2020_GLOBAL; +// dirName += "-no_seg"; +//// levels.add(NSHM23_LogicTreeBranch.RUPS_THROUGH_CREEPING); +//// dirName += "-creep_branches"; +//// levels.add(NSHM23_LogicTreeBranch.MAX_DIST); +//// dirName += "-strict_cutoff_seg"; strictSeg = true; + + +// dirName += "-pre_zero_slip_parent_fix"; +// dirName += "-reweight_seg_2_3_4"; // levels = new ArrayList<>(levels); -// levels.add(NSHM23_LogicTreeBranch.SUB_SECT_CONSTR); +// int origSize = levels.size(); +// for (int i=levels.size(); --i>=0;) +// if (levels.get(i).getType().isAssignableFrom(ScalingRelationships.class)) +// levels.remove(i); +// Preconditions.checkState(levels.size() < origSize); +// levels.add(NSHM23_LogicTreeBranch.SCALE); +// dirName += "-new_scale_rels"; +// dirName += "-full_set"; + + Class factoryClass = NSHM23_InvConfigFactory.class; + +// Class factoryClass = NSHM23_InvConfigFactory.MFDUncert0p1.class; +// dirName += "-mfd_uncert_0p1"; + +// Class factoryClass = NSHM23_InvConfigFactory.ConstantSlipRateStdDev0p1.class; +// dirName += "-const_slip_sd_0p1"; + +// Class factoryClass = NSHM23_InvConfigFactory.ConstantSlipRateStdDev0p2.class; +// dirName += "-const_slip_sd_0p2"; + +// Class factoryClass = NSHM23_InvConfigFactory.FullSysInv.class; +// dirName += "-full_sys_inv"; + +// Class factoryClass = NSHM23_InvConfigFactory.ClusterSpecific.class; +// dirName += "-cluster_specific_inversion"; + +// Class factoryClass = NSHM23_InvConfigFactory.SegWeight100.class; +// dirName += "-seg_weight_100"; + +// Class factoryClass = NSHM23_InvConfigFactory.SegWeight1000.class; +// dirName += "-seg_weight_1000"; + +// Class factoryClass = NSHM23_InvConfigFactory.SegWeight10000.class; +// dirName += "-seg_weight_10000"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevWeightAdjust.class; +// dirName += "-no_reweight_use_prev"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevWeightAdjustFullSys.class; +// dirName += "-full_sys_inv-no_reweight_use_prev"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedOrigWeights.class; +// dirName += "-no_reweight_use_orig"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedOrigWeightsFullSys.class; +// dirName += "-full_sys_inv-no_reweight_use_orig"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevAvgWeights.class; +// dirName += "-no_reweight_use_prev_avg"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevAvgWeightsFullSys.class; +// dirName += "-full_sys_inv-no_reweight_use_prev_avg"; + +// Class factoryClass = NSHM23_InvConfigFactory.NoPaleoParkfield.class; +// dirName += "-no_paleo_parkfield"; + +// Class factoryClass = NSHM23_InvConfigFactory.NoMFDScaleAdjust.class; +// dirName += "-no_scale_adj_mfds"; + +// Class factoryClass = NSHM23_InvConfigFactory.NoIncompatibleDataAdjust.class; +// dirName += "-no_mfd_sigma_data_adj"; + +// Class factoryClass = NSHM23_InvConfigFactory.ScaleLowerDepth1p3.class; +// dirName += "-scaleLowerDepth1.3"; + +// Class factoryClass = NSHM23_InvConfigFactory.HardcodedPrevAsInitial.class; +// dirName += "-prev_as_initial"; + +// Class factoryClass = NSHM23_InvConfigFactory.NoAvg.class; +// dirName += "-no_avg"; + +// Class factoryClass = NSHM23_InvConfigFactory.ForceNewPaleo.class; +// dirName += "-new_paleo"; + +// Class factoryClass = NSHM23_InvConfigFactory.NewScaleUseOrigWidths.class; +// dirName += "-use_orig_widths"; + + // also set nonzero weights! +// Class factoryClass = NSHM23_InvConfigFactory.ForceWideSegBranches.class; +// dirName += "-wide_seg_branches"; + +// Class factoryClass = NSHM23_InvConfigFactory.ForceNoGhostTransient.class; +// dirName += "-no_ghost_trans"; -// dirName += "-proxyGriddedTests"; +// Class factoryClass = NSHM23_InvConfigFactory.ScaleSurfSlipUseActualWidths.class; +// dirName += "-surf_slip_use_actual_w"; - Class factoryClass = PRVI25_InvConfigFactory.class; +// Class factoryClass = NSHM23_InvConfigFactory.RemoveIsolatedFaults.class; +// dirName += "-remove_isolated_faults"; - if (!factoryClass.equals(PRVI25_InvConfigFactory.class)) { +// Class factoryClass = NSHM23_InvConfigFactory.RemoveProxyFaults.class; +// dirName += "-remove_proxy_faults"; + +// Class factoryClass = NSHM23_InvConfigFactory.NoPaleoSlip.class; +// dirName += "-no_paleo_slip"; + +// Class factoryClass = NSHM23_InvConfigFactory.PaleoSlipInequality.class; +// dirName += "-paleo_slip_ineq"; + +// Class factoryClass = NSHM23_InvConfigFactory.TenThousandItersPerRup.class; +// dirName += "-10000ip"; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OriginalWeights.class; +// dirName += "-dm_orig_weights"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierlMinimizationWeights.class; +// dirName += "-dm_outlier_minimize_weights"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = false; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierReplacementYc2p0.class; +// dirName += "-dm_outlier_sub_yc_2"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierReplacementYc3p5.class; +// dirName += "-dm_outlier_sub_yc_3p5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierReplacementYc5p0.class; +// dirName += "-dm_outlier_sub_yc_5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierLogReplacementYc2p0.class; +// dirName += "-dm_outlier_log_sub_yc_2"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierLogReplacementYc3p5.class; +// dirName += "-dm_outlier_log_sub_yc_3p5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.DM_OutlierLogReplacementYc5p0.class; +// dirName += "-dm_outlier_log_sub_yc_5"; NSHM23_DeformationModels.ORIGINAL_WEIGHTS = true; + +// Class factoryClass = NSHM23_InvConfigFactory.SegModelLimitMaxLen.class; +// dirName += "-seg_limit_max_length"; + +// Class factoryClass = NSHM23_InvConfigFactory.SlipRateStdDevCeil0p1.class; +// dirName += "-slip_rate_sd_ceil_0p1"; + +// Class factoryClass = NSHM23_InvConfigFactory.SegModelMaxLen600.class; +// dirName += "-seg_limit_max_length_600"; + +// Class factoryClass = NSHM23_InvConfigFactory.SparseGRDontSpreadSingleToMulti.class; +// dirName += "-sparse_gr_dont_spread_single_multi"; + +// Class factoryClass = NSHM23_InvConfigFactory.ModDepthGV08.class; +// dirName += "-gv_08_mod_depth"; + +// Class factoryClass = NSHM23_InvConfigFactory.OrigDraftScaling.class; +// dirName += "-orig_draft_scaling"; + +// Class factoryClass = NSHM23_InvConfigFactory.ModScalingAdd4p3.class; +// dirName += "-mod_scaling"; + +// Class factoryClass = NSHM23_InvConfigFactory.NSHM18_UseU3Paleo.class; +// dirName += "-u3_paleo"; + +// Class factoryClass = NSHM23_InvConfigFactory.ModPitasPointDDW.class; +// dirName += "-mod_pitas_ddw"; + +// Class factoryClass = DefModSamplingEnabledInvConfig.ConnDistB0p5MidSegCorr.class; +// dirName += "-dm_sampling"; +// individualRandomLevels.add(new RandomDefModSampleLevel()); + +// Class factoryClass = DefModSamplingEnabledInvConfig.ConnDistB0p5MidSegCorrCapSigma.class; +// dirName += "-dm_sampling_cap_sigma"; +// individualRandomLevels.add(new RandomDefModSampleLevel()); + + if (!factoryClass.equals(NSHM23_InvConfigFactory.class)) { // try instantiate it to make sure we get any static modifiers that might change branch weights try { System.out.println("Instantiating factory class: "+factoryClass.getName()); @@ -639,41 +451,226 @@ public static void main(String[] args) throws IOException { } } +// levels = new ArrayList<>(levels); +// boolean randB = true; +// boolean randSeg = true; +// int origSize = levels.size(); +// for (int i=levels.size(); --i>=0;) { +// if (randB && SupraSeisBValues.class.isAssignableFrom(levels.get(i).getType())) +// levels.remove(i); +// if (randSeg && SegmentationModelBranchNode.class.isAssignableFrom(levels.get(i).getType())) +// levels.remove(i); +// } +// Preconditions.checkState(levels.size() < origSize); +// if (randB) { +// samplingBranchCountMultiplier *= 5; // there were originally 5 each +// dirName += "-randB"; +// individualRandomLevels.add(new RandomBValSampler.Level()); +// } +// if (randSeg) { +// samplingBranchCountMultiplier *= 5; // there were originally 5 each +// dirName += "-randSeg"; +// individualRandomLevels.add(new RandomSegModelSampler.Level()); +// } + +// dirName += "-mini_one_fifth"; +// samplingBranchCountMultiplier /= 5; + +// dirName += "-u3_perturb"; +// extraArgs.add("--perturb "+GenerationFunctionType.UNIFORM_0p001.name()); +// dirName += "-exp_perturb"; +// extraArgs.add("--perturb "+GenerationFunctionType.EXPONENTIAL_SCALE.name()); +// dirName += "-limit_zeros"; +// extraArgs.add("--non-negativity "+NonnegativityConstraintType.LIMIT_ZERO_RATES.name()); +// dirName += "-classic_sa"; +// extraArgs.add("--cooling-schedule "+CoolingScheduleType.CLASSICAL_SA.name()); + +// levels = new ArrayList<>(levels); +// levels.add(NSHM23_LogicTreeBranch.SINGLE_STATES); +// dirName += "-single_state"; + +// dirName += "-mod_west_valley_ddw"; + +// dirName += "-mod_dm_weights"; + forceHazardGridSpacing = 0.1; forceRequiredNonzeroWeight = true; - griddedJob = false; LogicTreeNode[] required = { // FAULT MODELS -// PRVI25_CrustalFaultModels.PRVI_FM_INITIAL, -// PRVI25_SubductionFaultModels.PRVI_SUB_FM_INITIAL, +// FaultModels.FM3_1, +// FaultModels.FM3_2, +// NSHM18_FaultModels.NSHM18_WUS_NoCA, +// NSHM18_FaultModels.NSHM18_WUS_PlusU3_FM_3p1, +// NSHM23_FaultModels.FM_v1p4, +// NSHM23_FaultModels.FM_v2, + NSHM23_FaultModels.WUS_FM_v3, +// PRVI25_FaultModels.PRVI_FM_INITIAL, + +// // SINGLE STATE +// NSHM23_SingleStates.NM, +// NSHM23_SingleStates.UT, // RUPTURE SETS // RupturePlausibilityModels.COULOMB, // default // RupturePlausibilityModels.COULOMB_5km, +// RupturePlausibilityModels.AZIMUTHAL, +// RupturePlausibilityModels.SEGMENTED, +// RupturePlausibilityModels.UCERF3, +// RupturePlausibilityModels.UCERF3_REDUCED, // DEFORMATION MODELS -// PRVI25_CrustalDeformationModels.GEOLOGIC, +// U3_UncertAddDeformationModels.U3_ZENG, +// U3_UncertAddDeformationModels.U3_MEAN, +// NSHM18_DeformationModels.BRANCH_AVERAGED, + NSHM23_DeformationModels.AVERAGE, +// NSHM23_DeformationModels.GEOLOGIC, +// NSHM23_DeformationModels.EVANS, +// NSHM23_DeformationModels.MEDIAN, // SCALING RELATIONSHIPS +// ScalingRelationships.SHAW_2009_MOD, +// ScalingRelationships.MEAN_UCERF3, +// NSHM23_ScalingRelationships.AVERAGE, +// NSHM23_ScalingRelationships.LOGA_C4p2_SQRT_LEN, +// NSHM23_ScalingRelationships.WIDTH_LIMITED_CSD, + + // SLIP ALONG RUPTURE +// NSHM23_SlipAlongRuptureModels.UNIFORM, +// NSHM23_SlipAlongRuptureModels.TAPERED, +// SlipAlongRuptureModels.UNIFORM, +// 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, + SupraSeisBValues.AVERAGE, + + // PALEO UNCERT +// NSHM23_PaleoUncertainties.EVEN_FIT, // SEGMENTATION -// NSHM23_SegmentationModels.AVERAGE, +// SegmentationModels.SHAW_R0_3, + NSHM23_SegmentationModels.AVERAGE, // NSHM23_SegmentationModels.MID, // NSHM23_SegmentationModels.CLASSIC, +// NSHM23_SegmentationModels.CLASSIC_FULL, + + // SEG-SHIFT +// DistDependSegShift.NONE, +// DistDependSegShift.ONE_KM, +// DistDependSegShift.TWO_KM, +// DistDependSegShift.THREE_KM, + + // 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, + + // CREEPING SECTION +// RupsThroughCreepingSect.INCLUDE, +// RupsThroughCreepingSect.EXCLUDE, }; // LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.SYSTEM_AVG }; // LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.FAULT_SPECIFIC }; // Class sortBy = SubSectConstraintModels.class; Class sortBy = NSHM23_SegmentationModels.class; + /* + * END NSHM23 logic tree + */ + + /* + * PRVI25 logic tree + * TODO (this is a just a marker to find this part quickly, not an actual todo) + */ +//// List> levels = PRVI25_LogicTreeBranch.levelsOnFault; +//// dirName += "-prvi25_crustal_branches"; +//// double avgNumRups = 50000; +// +// // random DM sampling +//// levels = new ArrayList<>(levels); +//// int origNumLevels = levels.size(); +//// for (int i=levels.size(); --i>=0;) +//// if (levels.get(i).getNodes().get(0) instanceof PRVI25_CrustalDeformationModels) +//// levels.remove(i); +//// 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> levels = PRVI25_LogicTreeBranch.levelsSubduction; +// dirName += "-prvi25_subduction_branches"; +// double avgNumRups = 10000; +// gmpe = AttenRelRef.AG_2020_GLOBAL; +// +//// levels = new ArrayList<>(levels); +//// levels.add(NSHM23_LogicTreeBranch.SUB_SECT_CONSTR); +// +//// dirName += "-proxyGriddedTests"; +// +// Class factoryClass = PRVI25_InvConfigFactory.class; +// +// if (!factoryClass.equals(PRVI25_InvConfigFactory.class)) { +// // try instantiate it to make sure we get any static modifiers that might change branch weights +// try { +// System.out.println("Instantiating factory class: "+factoryClass.getName()); +// factoryClass.getDeclaredConstructor().newInstance(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// forceHazardGridSpacing = 0.1; +// +// forceRequiredNonzeroWeight = true; +// LogicTreeNode[] required = { +// // FAULT MODELS +//// PRVI25_CrustalFaultModels.PRVI_FM_INITIAL, +//// PRVI25_SubductionFaultModels.PRVI_SUB_FM_INITIAL, +// +// // RUPTURE SETS +//// RupturePlausibilityModels.COULOMB, // default +//// RupturePlausibilityModels.COULOMB_5km, +// +// // DEFORMATION MODELS +//// PRVI25_CrustalDeformationModels.GEOLOGIC, +// +// // SCALING RELATIONSHIPS +// +// // SUB-SECT CONSTRAINT +//// SubSectConstraintModels.TOT_NUCL_RATE, // default +//// SubSectConstraintModels.NUCL_MFD, +// +// // SUPRA-SEIS-B +//// SupraSeisBValues.B_0p5, +//// SupraSeisBValues.AVERAGE, +// +// // SEGMENTATION +//// NSHM23_SegmentationModels.AVERAGE, +//// NSHM23_SegmentationModels.MID, +//// NSHM23_SegmentationModels.CLASSIC, +// }; +//// LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.SYSTEM_AVG }; +//// LogicTreeNode[] required = { FaultModels.FM3_1, SubSeisMoRateReductionNode.FAULT_SPECIFIC }; +//// Class sortBy = SubSectConstraintModels.class; +// Class sortBy = NSHM23_SegmentationModels.class; /* * END PRVI25 logic tree */ @@ -966,8 +963,10 @@ else if (mpjWrite instanceof FastMPJShellScriptWriter) for (String varName : envVars.keySet()) javaWrite.setEnvVar(varName, envVars.get(varName)); + boolean griddedJob = GridSourceProviderFactory.class.isAssignableFrom(factoryClass); if (griddedJob) { - argz = "--logic-tree "+ltPath; + argz = "--factory '"+factoryClass.getName()+"'"; // surround in single quotes to escape $'s + argz += " --logic-tree "+ltPath; argz += " --sol-dir "+resultsPath; String fullLTPath = dirPath+"/logic_tree_full_gridded.json"; String randLTPath = dirPath+"/logic_tree_full_gridded_sampled.json";