Skip to content

Commit

Permalink
new prvi runs and plot updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Milner committed Dec 12, 2024
1 parent 69ca1c7 commit 36a8f33
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static void main(String[] args) throws IOException {

boolean linkFromBase = true;
Double vs30 = null;
Double sigmaTrunc = null;
double gridSpacing = 0.1;
boolean supersample = false;

Expand Down Expand Up @@ -62,42 +63,37 @@ public static void main(String[] args) throws IOException {
/*
* PRVI
*/
// String baseDirName = "2024_07_31-prvi25_subduction_branches";
// String baseDirName = "2024_10_24-prvi25_crustal_subduction_combined_branches";

// region = PRVI25_RegionLoader.loadPRVI_ModelBroad();
region = PRVI25_RegionLoader.loadPRVI_MapExtents();
gridSpacing = 0.01;

gmms = new AttenRelRef[] { AttenRelRef.USGS_PRVI_ACTIVE, AttenRelRef.USGS_PRVI_INTERFACE, AttenRelRef.USGS_PRVI_SLAB };
periods = new double[] { 0d, 0.2d, 1d, 5d };
supersample = true;
sigmaTrunc = 3d;

// String suffix = "ba_only-LARGE";
// String solFileName = "results_PRVI_SUB_FM_LARGE_branch_averaged_gridded.zip";

// String suffix = "ba_only-LARGE-true_pt_src";
// String solFileName = "results_PRVI_SUB_FM_LARGE_branch_averaged_gridded.zip";

// String baseDirName = "2024_12_12-prvi25_crustal_subduction_combined_branches";
// String suffix = "ba_only";
// String solFileName = "combined_branch_averaged_solution.zip";
String baseDirName = "2024_12_12-prvi25_crustal_subduction_combined_branches";
String suffix = "ba_only";
String solFileName = "combined_branch_averaged_solution.zip";

// String baseDirName = "2024_12_12-prvi25_crustal_branches-dmSample5x";
// String suffix = "ba_only";
// String solFileName = "results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip";

String baseDirName = "2024_12_12-prvi25_subduction_branches";
String suffix = "ba_only-SLAB_only";
String solFileName = "results_PRVI_SLAB_ONLY_branch_averaged_gridded.zip";
bgOps = new IncludeBackgroundOption[] { IncludeBackgroundOption.ONLY };
// String suffix = "ba_only-INTERFACE_only";
// String solFileName = "results_PRVI_INTERFACE_ONLY_branch_averaged_gridded.zip";
// String suffix = "ba_only-both_fms";
// String solFileName = "results_PRVI_SUB_FMs_combined_branch_averaged_gridded.zip";

// vs30 = 760d; suffix += "-vs760";
vs30 = 260d; suffix += "-vs260";
// String baseDirName = "2024_12_12-prvi25_subduction_branches";
// // slab (gridded only)
// String suffix = "ba_only-SLAB_only";
// String solFileName = "results_PRVI_SLAB_ONLY_branch_averaged_gridded.zip";
// bgOps = new IncludeBackgroundOption[] { IncludeBackgroundOption.ONLY };
// // interface (will do fault + gridded)
//// String suffix = "ba_only-INTERFACE_only";
//// String solFileName = "results_PRVI_INTERFACE_ONLY_branch_averaged_gridded.zip";
// // both
//// String suffix = "ba_only-both_fms";
//// String solFileName = "results_PRVI_SUB_FMs_combined_branch_averaged_gridded.zip";

vs30 = 760d; suffix += "-vs760";
// vs30 = 260d; suffix += "-vs260";

/*
* RSQSim
Expand Down Expand Up @@ -250,6 +246,8 @@ else if (gridReg.getNodeCount() > 5000)
}
if (supersample)
argz += " --supersample";
if (sigmaTrunc != null)
argz += " --gmm-sigma-trunc-one-sided "+sigmaTrunc.floatValue();
argz += " "+dispatchArgs;

File jobFile = new File(localDir, "batch_hazard_"+bgOp.name()+".slurm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ public static void main(String[] args) throws IOException {
Range xRange = new Range(5d, 9.5d);

gp.drawGraphPanel(incrSpec, false, true, xRange, yRange);
PlotUtils.writePlots(outputDir, "combined_mfds", gp, 800, 750, true, false, false);
PlotUtils.writePlots(outputDir, "combined_mfds", gp, 800, 750, true, true, false);
gp.drawGraphPanel(cmlSpec, false, true, xRange, yRange);
PlotUtils.writePlots(outputDir, "combined_mfds_cml", gp, 800, 750, true, false, false);
PlotUtils.writePlots(outputDir, "combined_mfds_cml", gp, 800, 750, true, true, false);
}

static IncrementalMagFreqDist calcFaultMFD(Region region, FaultSystemSolution sol, EvenlyDiscretizedFunc refMFD) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -34,6 +36,7 @@
import org.opensha.sha.earthquake.faultSysSolution.modules.GridSourceList.GriddedRuptureProperties;
import org.opensha.sha.earthquake.faultSysSolution.util.FaultSectionUtils;
import org.opensha.sha.earthquake.faultSysSolution.util.FaultSysTools;
import org.opensha.sha.earthquake.rupForecastImpl.prvi25.logicTree.PRVI25_CrustalFaultModels;
import org.opensha.sha.earthquake.rupForecastImpl.prvi25.logicTree.PRVI25_SubductionFaultModels;
import org.opensha.sha.earthquake.rupForecastImpl.prvi25.util.PRVI25_RegionLoader;
import org.opensha.sha.faultSurface.EvenlyGriddedSurface;
Expand Down Expand Up @@ -65,8 +68,8 @@ public static void main(String[] args) throws IOException {

double cptMin = -6d;
double cptMax = -2d;
CPT cpt = GMT_CPT_Files.RAINBOW_UNIFORM.instance().rescale(cptMin, cptMax);
// CPT cpt = GMT_CPT_Files.SEQUENTIAL_BATLOW_UNIFORM.instance().rescale(cptMin, cptMax);
// CPT cpt = GMT_CPT_Files.RAINBOW_UNIFORM.instance().rescale(cptMin, cptMax);
CPT cpt = GMT_CPT_Files.SEQUENTIAL_BATLOW_UNIFORM.instance().rescale(cptMin, cptMax);
// CPT cpt = GMT_CPT_Files.SEQUENTIAL_NAVIA_UNIFORM.instance().rescale(cptMin, cptMax);
// CPT cpt = GMT_CPT_Files.SEQUENTIAL_LAJOLLA_UNIFORM.instance().rescale(cptMin, cptMax);
// CPT cpt = GMT_CPT_Files.SEQUENTIAL_OSLO_UNIFORM.instance().rescale(cptMin, cptMax);
Expand Down Expand Up @@ -238,20 +241,40 @@ public static void main(String[] args) throws IOException {
for (int r=0; r<rates.size(); r++)
rates.set(r, Math.log10(rates.get(r)));

Region mapReg = PRVI25_RegionLoader.loadPRVI_ModelBroad();
GeographicMapMaker mapMaker = new GeographicMapMaker(mapReg);
Region gridMapReg = PRVI25_RegionLoader.loadPRVI_ModelBroad();
Region faultMapReg = new Region(new Location(16.3, gridMapReg.getMinLon()), new Location(20.4, gridMapReg.getMaxLon()));
GeographicMapMaker mapMaker = new GeographicMapMaker(faultMapReg);

mapMaker.setWriteGeoJSON(false);
mapMaker.setWritePDFs(true);
mapMaker.setFillSurfaces(true);
mapMaker.setSectOutlineChar(null);
mapMaker.setSectPolygonChar(new PlotCurveCharacterstics(PlotLineType.SHORT_DASHED, 1f, Color.DARK_GRAY));
mapMaker.setPlotSectPolysOnTop(true);
mapMaker.setReverseSort(false);
mapMaker.setAbsoluteSort(false);
mapMaker.setSectNaNChar(new PlotCurveCharacterstics(PlotLineType.SOLID, 3f, new Color(160, 160, 160, 140)));
mapMaker.setSectTraceChar(new PlotCurveCharacterstics(PlotLineType.SOLID, 1.5f, Color.DARK_GRAY));
mapMaker.setScalarThickness(4f);
mapMaker.setFaultSections(combSects);

// swap out subsection polys with full sect polys (but only for the first)
Map<Integer, Region> parentPolys = new HashMap<>();
for (FaultSection sect : PRVI25_CrustalFaultModels.PRVI_CRUSTAL_FM_V1p1.getFaultSections())
if (sect.isProxyFault() && sect.getZonePolygon() != null)
parentPolys.put(sect.getSectionId(), sect.getZonePolygon());
for (FaultSection sect : combSects) {
if (sect.isProxyFault() && sect.getZonePolygon() != null) {
int parentID = sect.getParentSectionId();
if (parentPolys.containsKey(parentID)) {
sect.setZonePolygon(parentPolys.get(parentID));
parentPolys.remove(parentID); // only do this once per parent
} else {
sect.setZonePolygon(null);
}
}
}

// write generic cpt only first
PlotUtils.writeScaleLegendOnly(outputDir, "participation_cpt",
GeographicMapMaker.buildCPTLegend(cpt, "Log10 Participation Rate (/yr)"),
Expand Down Expand Up @@ -299,6 +322,7 @@ public static void main(String[] args) throws IOException {
TectonicRegionType.SUBDUCTION_SLAB
};

mapMaker.setRegion(gridMapReg);
mapMaker.clearSectScalars();
mapMaker.setSectTraceChar(new PlotCurveCharacterstics(PlotLineType.SOLID, 1f, Color.DARK_GRAY));
GridSourceList gridProv = combSol.requireModule(GridSourceList.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ public static void main(String[] args) throws IOException {
double lengthLimit = 75d;

// RupType[] types = RupType.values();
// double lenFractBuffer = 1.05;
RupType[] types = {
RupType.PROXY,
RupType.SPLIT_PROXIES
};
double lenFractBuffer = 0.5;

CPT colors = GMT_CPT_Files.CATEGORICAL_BATLOW_UNIFORM.instance();

Expand Down Expand Up @@ -134,7 +136,7 @@ public static void main(String[] args) throws IOException {
int rupID = -1;
double maxRupMag = 0d;
List<Integer> allRups = new ArrayList<>(rupSet.getRupturesForParentSection(parentID));
Collections.reverse(allRups);
// Collections.reverse(allRups); // this makes it the left side of Anegada zones
for (int rupIndex : allRups) {
double mag = rupSet.getMagForRup(rupIndex);
if ((float)mag < (float)maxRupMag)
Expand Down Expand Up @@ -164,7 +166,7 @@ public static void main(String[] args) throws IOException {
System.out.println("Using an M"+(float)maxRupMag+" rupture, len="+(float)rupSet.getLengthForRup(rupID)*1e-3);

double rupLen = rupSet.getLengthForRup(rupID)*1e-3;
double regBuffer = Math.min(60d, Double.max(30d, rupLen+5d));
double regBuffer = Math.min(60d, Double.max(30d, rupLen*lenFractBuffer));
lowerLeft = LocationUtils.location(lowerLeft, 5d*Math.PI/4d, regBuffer);
upperRight = LocationUtils.location(upperRight, Math.PI/4d, regBuffer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public static void main(String[] args) throws IOException {
"Crustal", PRVI25_SeismicityRegions.CRUSTAL);
// plotPDFs(crustalOutputDir, "crustal_m5", 5d, avgDecluster, avgSmooth, fullGrid,
// "Crustal", PRVI25_SeismicityRegions.CRUSTAL);
plotNucleationRates(crustalOutputDir, "crustal_m5", crustalGridProv, 5d, TectonicRegionType.ACTIVE_SHALLOW, fullGrid, "Crustal", null);
plotNucleationRates(crustalOutputDir, "crustal_m7", crustalGridProv, 7d, TectonicRegionType.ACTIVE_SHALLOW, fullGrid, "Crustal", null);
plotNucleationRates(crustalOutputDir, "crustal_m5", crustalGridProv, 5d, TectonicRegionType.ACTIVE_SHALLOW, fullGrid, "Crustal Gridded", null);
plotNucleationRates(crustalOutputDir, "crustal_m7", crustalGridProv, 7d, TectonicRegionType.ACTIVE_SHALLOW, fullGrid, "Crustal Gridded", null);

plotPDFs(subOutputDir, "sub_interface_pdf", 0, avgDecluster, avgSmooth, fullGrid,
"Interface", PRVI25_SeismicityRegions.CAR_INTERFACE, PRVI25_SeismicityRegions.MUE_INTERFACE);
"Interface Gridded", PRVI25_SeismicityRegions.CAR_INTERFACE, PRVI25_SeismicityRegions.MUE_INTERFACE);
plotPDFs(subOutputDir, "sub_interface_m5", 5, avgDecluster, avgSmooth, fullGrid,
"Interface", PRVI25_SeismicityRegions.CAR_INTERFACE, PRVI25_SeismicityRegions.MUE_INTERFACE);
"Interface Gridded", PRVI25_SeismicityRegions.CAR_INTERFACE, PRVI25_SeismicityRegions.MUE_INTERFACE);
plotPDFs(subOutputDir, "sub_slab_pdf", 0, avgDecluster, avgSmooth, fullGrid,
"Intraslab", PRVI25_SeismicityRegions.CAR_INTRASLAB, PRVI25_SeismicityRegions.MUE_INTRASLAB);
plotPDFs(subOutputDir, "sub_slab_m5", 5, avgDecluster, avgSmooth, fullGrid,
Expand Down

0 comments on commit 36a8f33

Please sign in to comment.