Skip to content

Commit

Permalink
centralized paths for finding PRVI solutions and directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Milner committed Dec 12, 2024
1 parent 3631589 commit e8188ab
Show file tree
Hide file tree
Showing 20 changed files with 157 additions and 93 deletions.
20 changes: 9 additions & 11 deletions src/main/java/scratch/kevin/prvi25/figures/CombinedMFDsPlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@
import org.opensha.sha.magdist.SummedMagFreqDist;
import org.opensha.sha.util.TectonicRegionType;

import com.google.common.base.Preconditions;

import net.mahdilamb.colormap.Colors;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class CombinedMFDsPlot {

public static void main(String[] args) throws IOException {
File crustalDir = new File("/home/kevin/OpenSHA/nshm23/batch_inversions/"
+ "2024_11_19-prvi25_crustal_branches-dmSample5x");
FaultSystemSolution crustalSol = FaultSystemSolution.load(new File(crustalDir,
"results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip"));
FaultSystemSolution crustalSol = FaultSystemSolution.load(CRUSTAL_SOL_GRIDDED);

File subductionDir = new File("/home/kevin/OpenSHA/nshm23/batch_inversions/"
+ "2024_11_19-prvi25_subduction_branches");
FaultSystemSolution subductionSol1 = FaultSystemSolution.load(new File(subductionDir,
"results_PRVI_SUB_FM_LARGE_branch_averaged_gridded.zip"));
FaultSystemSolution subductionSol2 = FaultSystemSolution.load(new File(subductionDir,
"results_PRVI_SUB_FM_SMALL_branch_averaged_gridded.zip"));
FaultSystemSolution subductionSol1 = FaultSystemSolution.load(SUBDUCTION_SOL_LARGE);
FaultSystemSolution subductionSol2 = FaultSystemSolution.load(SUBDUCTION_SOL_SMALL);

File outputDir = new File(FIGURES_DIR, "combined_mfds");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

EvenlyDiscretizedFunc refMFD = FaultSysTools.initEmptyMFD(9.45);

Expand Down Expand Up @@ -122,7 +121,6 @@ public static void main(String[] args) throws IOException {

HeadlessGraphPanel gp = PlotUtils.initHeadless();

File outputDir = new File("/tmp");
Range yRange = new Range(1e-6, 1e1);
Range xRange = new Range(5d, 9.5d);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;

import org.opensha.commons.geo.Location;
import org.opensha.commons.geo.Region;
import org.opensha.commons.gui.plot.GeographicMapMaker;
import org.opensha.sha.earthquake.faultSysSolution.FaultSystemRupSet;
import org.opensha.sha.earthquake.faultSysSolution.FaultSystemSolution;
Expand All @@ -17,15 +15,18 @@
import org.opensha.sha.earthquake.faultSysSolution.ruptures.util.ConnectivityCluster;
import org.opensha.sha.faultSurface.FaultSection;

import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

class ConnectivityClusterPlot {

public static void main(String[] args) throws IOException {
FaultSystemSolution sol = FaultSystemSolution.load(new File("/data/kevin/nshm23/batch_inversions/"
+ "2024_11_19-prvi25_crustal_branches-dmSample5x/results_PRVI_CRUSTAL_FM_V1p1_branch_averaged.zip"));
FaultSystemSolution sol = FaultSystemSolution.load(CRUSTAL_SOL_SUPRA_ONLY);

File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/crustal_fm");
File outputDir = new File(FIGURES_DIR, "crustal_fm");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

FaultSystemRupSet rupSet = sol.getRupSet();
if (!rupSet.hasModule(ConnectivityClusters.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

import net.mahdilamb.colormap.Colors;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class CrustalCarveoutSmallerRegionMFDPlot {

public static void main(String[] args) throws IOException {
Expand All @@ -47,8 +49,7 @@ public static void main(String[] args) throws IOException {
names.add("Smaller Map Region");
prefixes.add("smaller_map_region");

FaultSystemSolution sol = FaultSystemSolution.load(new File("/home/kevin/OpenSHA/nshm23/batch_inversions/"
+ "2024_10_24-prvi25_crustal_branches-dmSample5x/results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip"));
FaultSystemSolution sol = FaultSystemSolution.load(CRUSTAL_SOL_SUPRA_ONLY);

EvenlyDiscretizedFunc refMFD = FaultSysTools.initEmptyMFD(2.55, sol.getRupSet().getMaxMag());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@
import org.opensha.sha.faultSurface.FaultSection;
import org.opensha.sha.faultSurface.FaultTrace;

import com.google.common.base.Preconditions;

import net.mahdilamb.colormap.Colors;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

class CrustalFaultNamesFigure {

public static void main(String[] args) throws IOException {
File ouutputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/crustal_fm");
File outputDir = new File(FIGURES_DIR, "crustal_fm");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

PRVI25_CrustalFaultModels fm = PRVI25_CrustalFaultModels.PRVI_CRUSTAL_FM_V1p1;

Expand All @@ -42,7 +47,7 @@ public static void main(String[] args) throws IOException {

mapMaker.setSectTraceChar(new PlotCurveCharacterstics(PlotLineType.SOLID, 3f, Colors.tab_blue));

mapMaker.plot(ouutputDir, "crustal_sect_names", " ");
mapMaker.plot(outputDir, "crustal_sect_names", " ");
}

static void addStandardFaultLabels(GeographicMapMaker mapMaker, List<? extends FaultSection> sects) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@
import scratch.kevin.prvi25.FaultSystemLineIntegralCalculator.LineIntegralResult;
import scratch.kevin.prvi25.FaultSystemLineIntegralCalculator.VectorComponent;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class DefModelSampleLineIntegralsPlot {

public static void main(String[] args) throws IOException {
// File outputDir = new File("/tmp");
File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/crustal_dm");
File outputDir = new File(FIGURES_DIR, "crustal_dm");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());
String prefix = "prvi_dm_sample_line_integrals";

LogicTree<?> randTree = LogicTree.read(new File(
"/home/kevin/OpenSHA/nshm23/batch_inversions/2024_10_24-prvi25_crustal_branches-dmSample5x/logic_tree.json"));
LogicTree<?> randTree = LogicTree.read(new File(CRUSTAL_DIR, "logic_tree.json"));

PRVI25_CrustalFaultModels fm = PRVI25_CrustalFaultModels.PRVI_CRUSTAL_FM_V1p1;
// VectorComponent[] components = VectorComponent.values();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@

import com.google.common.base.Preconditions;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class FaultParticipationPlots {

public static void main(String[] args) throws IOException {
File solFile = new File("/data/kevin/nshm23/batch_inversions/"
+ "2024_11_19-prvi25_crustal_branches-dmSample5x/results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip");

FaultSystemSolution sol = FaultSystemSolution.load(solFile);
FaultSystemSolution sol = FaultSystemSolution.load(CRUSTAL_SOL_SUPRA_ONLY);

CPT cpt = GMT_CPT_Files.RAINBOW_UNIFORM.instance().rescale(-5, -1);
cpt.setBelowMinColor(cpt.getMinColor());
cpt.setNanColor(Color.GRAY);

double[] minMags = { 0, 6, 6.7, 7, 7.5, 7.8 };

// File outputDir = new File("/home/kevin/Documents/papers/2023_NSHM23_Inversion/figures/partic_plot");
File outputDir = new File("/tmp");
File outputDir = new File(FIGURES_DIR, "partic_plot");
// File outputDir = new File("/tmp");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

GeographicMapMaker mapMaker = new RupSetMapMaker(sol.getRupSet(), PRVI25_RegionLoader.loadPRVI_ModelBroad());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

import scratch.UCERF3.erf.ETAS.SeisDepthDistribution;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class GridCubeRatePlot {

public static void main(String[] args) throws IOException {
Expand Down Expand Up @@ -92,7 +94,7 @@ public static void main(String[] args) throws IOException {
rake = 0d;
}

File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/crustal_grid");
File outputDir = new File(FIGURES_DIR, "crustal_grid");

Region sectReg = new Region(new Location(traceStart.lat, traceStart.lon-1d), new Location(traceEnd.lat, traceEnd.lon+1d));
GriddedRegion gridReg = new GriddedRegion(sectReg, gridSpacing, GriddedRegion.ANCHOR_0_0);
Expand Down
19 changes: 7 additions & 12 deletions src/main/java/scratch/kevin/prvi25/figures/IndividualMFDPlots.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,24 @@
import scratch.kevin.latex.LaTeXUtils;
import scratch.kevin.prvi25.SubductionCombinedModelCreator;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class IndividualMFDPlots {

public static void main(String[] args) throws IOException {
File crustalDir = new File("/home/kevin/OpenSHA/nshm23/batch_inversions/"
+ "2024_12_05-prvi25_crustal_branches-dmSample5x");
FaultSystemSolution crustalSol = FaultSystemSolution.load(new File(crustalDir,
"results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip"));
FaultSystemSolution crustalSol = FaultSystemSolution.load(CRUSTAL_SOL_GRIDDED);

EvenlyDiscretizedFunc refMFD = FaultSysTools.initEmptyMFD(4.05, 9.55);

File subductionDir = new File("/home/kevin/OpenSHA/nshm23/batch_inversions/"
+ "2024_11_19-prvi25_subduction_branches");
FaultSystemSolution subductionLargeSol = FaultSystemSolution.load(new File(subductionDir,
"results_PRVI_SUB_FM_LARGE_branch_averaged_gridded.zip"));
FaultSystemSolution subductionSmallSol = FaultSystemSolution.load(new File(subductionDir,
"results_PRVI_SUB_FM_SMALL_branch_averaged_gridded.zip"));
FaultSystemSolution subductionLargeSol = FaultSystemSolution.load(SUBDUCTION_SOL_LARGE);
FaultSystemSolution subductionSmallSol = FaultSystemSolution.load(SUBDUCTION_SOL_SMALL);
FaultSystemSolution subductionCombined = SubductionCombinedModelCreator.combine(
Map.of(PRVI25_SubductionFaultModels.PRVI_SUB_FM_LARGE, subductionLargeSol,
PRVI25_SubductionFaultModels.PRVI_SUB_FM_SMALL, subductionSmallSol));

File crustalOutputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/crustal_sol");
File crustalOutputDir = new File(FIGURES_DIR, "crustal_sol");
Preconditions.checkState(crustalOutputDir.exists() || crustalOutputDir.mkdir());
File subductionOutputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/sub_sol");
File subductionOutputDir = new File(FIGURES_DIR, "sub_sol");
Preconditions.checkState(subductionOutputDir.exists() || subductionOutputDir.mkdir());

FileWriter crustalTexFW = new FileWriter(new File(crustalOutputDir, "crustal_mfds.tex"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import com.itextpdf.text.pdf.PdfTemplate;
import com.itextpdf.text.pdf.PdfWriter;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class LogicTreeFigureWriter extends JPanel {

public static void main(String[] args) throws IOException {
Expand All @@ -53,7 +55,8 @@ public static void main(String[] args) throws IOException {
nameRemappings.put(NSHM23_ScalingRelationships.LOGA_C4p2_SQRT_LEN.getShortName(), "Sqrt-Len");
nameRemappings.put(PRVI25_CrustalRandomlySampledDeformationModelLevel.NAME, "Geologic Deformation Model Sample");

File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/logic_trees");
File outputDir = new File(FIGURES_DIR, "logic_trees");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

List<LogicTree<?>> trees = new ArrayList<>();
List<String> prefixes = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

import net.mahdilamb.colormap.Colors;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class MapSourceTypeDisagg {

enum MapType {
Expand All @@ -71,22 +73,16 @@ private MapType(String name, Color color, IncludeBackgroundOption... bgOps) {
}

public static void main(String[] args) throws IOException {
File baseDir = new File("/home/kevin/OpenSHA/nshm23/batch_inversions/");

EnumMap<MapType, File> dirs = new EnumMap<>(MapType.class);

double[] periods = {0d, 1d, 5d};
ReturnPeriods[] rps = SolHazardMapCalc.MAP_RPS;

String crustalDate = "2024_11_19";
String subductionDate = crustalDate;
String combinedDate = crustalDate;

dirs.put(MapType.COMBINED, new File(baseDir, combinedDate+"-prvi25_crustal_subduction_combined_branches-ba_only"));
dirs.put(MapType.CRUSTAL, new File(baseDir, crustalDate+"-prvi25_crustal_branches-dmSample5x-ba_only"));
dirs.put(MapType.SUBDUCTION, new File(baseDir, subductionDate+"-prvi25_subduction_branches-ba_only-both_fms"));
dirs.put(MapType.SUBDUCTION_INTERFACE, new File(baseDir, subductionDate+"-prvi25_subduction_branches-ba_only-INTERFACE_only"));
dirs.put(MapType.SUBDUCTION_SLAB, new File(baseDir, subductionDate+"-prvi25_subduction_branches-ba_only-SLAB_only"));
dirs.put(MapType.COMBINED, new File(INV_DIR, COMBINED_DIR.getName()+"-ba_only"));
dirs.put(MapType.CRUSTAL, new File(INV_DIR, CRUSTAL_DIR.getName()+"-ba_only"));
dirs.put(MapType.SUBDUCTION, new File(INV_DIR, SUBDUCTION_DIR.getName()+"-ba_only-both_fms"));
dirs.put(MapType.SUBDUCTION_INTERFACE, new File(INV_DIR, SUBDUCTION_DIR.getName()+"-ba_only-INTERFACE_only"));
dirs.put(MapType.SUBDUCTION_SLAB, new File(INV_DIR, SUBDUCTION_DIR.getName()+"-ba_only-SLAB_only"));

double debugPeriod = 5d;
ReturnPeriods debugRP = ReturnPeriods.TWO_IN_50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,18 @@
import com.google.common.collect.Table.Cell;
import com.google.common.primitives.Doubles;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class MultiTectonicParticipationMap {

public static void main(String[] args) throws IOException {
File invsDir = new File("/home/kevin/OpenSHA/nshm23/batch_inversions");

File crustalDir = new File(invsDir, "2024_11_19-prvi25_crustal_branches-dmSample5x");
File subductionDir = new File(invsDir, "2024_11_19-prvi25_subduction_branches");
File combDir = new File(invsDir, "2024_11_19-prvi25_crustal_subduction_combined_branches");

// File outputDir = new File(combDir, "misc_plots/combined_participation");
File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/combined_partic_rate_maps");
File outputDir = new File(FIGURES_DIR, "combined_partic_rate_maps");
Preconditions.checkState(outputDir.exists() || outputDir.mkdirs());

FaultSystemSolution crustalSol = FaultSystemSolution.load(new File(crustalDir,
"results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip"));
FaultSystemSolution subSmallSol = FaultSystemSolution.load(new File(subductionDir,
"results_PRVI_SUB_FM_SMALL_branch_averaged_gridded.zip"));
FaultSystemSolution subLargeSol = FaultSystemSolution.load(new File(subductionDir,
"results_PRVI_SUB_FM_LARGE_branch_averaged_gridded.zip"));
FaultSystemSolution combSol = FaultSystemSolution.load(new File(combDir,
"combined_branch_averaged_solution.zip"));
FaultSystemSolution crustalSol = FaultSystemSolution.load(CRUSTAL_SOL_GRIDDED);
FaultSystemSolution subSmallSol = FaultSystemSolution.load(SUBDUCTION_SOL_SMALL);
FaultSystemSolution subLargeSol = FaultSystemSolution.load(SUBDUCTION_SOL_LARGE);
FaultSystemSolution combSol = FaultSystemSolution.load(COMBINED_SOL);

boolean includeInterfaceGridded = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@

import net.mahdilamb.colormap.Colors;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class ObsUncertaintyBoundsFigure {

public static void main(String[] args) throws IOException {
File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures");
File outputDir = FIGURES_DIR;
String prefix = "obs_mfd_bounds";

boolean incremental = false;
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/scratch/kevin/prvi25/figures/PRVI_Paths.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package scratch.kevin.prvi25.figures;

import java.io.File;

public class PRVI_Paths {

public static final File PAPER_DIR =new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper");
public static final File FIGURES_DIR =new File(PAPER_DIR, "Figures");

public static final File INV_DIR = new File("/data/kevin/nshm23/batch_inversions/");

public static final File CRUSTAL_DIR = new File(INV_DIR, "2024_11_19-prvi25_crustal_branches-dmSample5x");
public static final File CRUSTAL_SOL_GRIDDED = new File(CRUSTAL_DIR, "results_PRVI_CRUSTAL_FM_V1p1_branch_averaged_gridded.zip");
public static final File CRUSTAL_SOL_SUPRA_ONLY = new File(CRUSTAL_DIR, "results_PRVI_CRUSTAL_FM_V1p1_branch_averaged.zip");

public static final File SUBDUCTION_DIR = new File(INV_DIR, "2024_11_19-prvi25_subduction_branches");
public static final File SUBDUCTION_SOL_LARGE = new File(SUBDUCTION_DIR, "results_PRVI_SUB_FM_LARGE_branch_averaged_gridded.zip");
public static final File SUBDUCTION_SOL_SMALL = new File(SUBDUCTION_DIR, "results_PRVI_SUB_FM_SMALL_branch_averaged_gridded.zip");

public static final File COMBINED_DIR = new File(INV_DIR, "2024_11_19-prvi25_crustal_subduction_combined_branches");
public static final File COMBINED_SOL = new File(COMBINED_DIR, "combined_branch_averaged_solution.zip");

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

import scratch.kevin.prvi25.FaultSystemLineIntegralCalculator;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class PRVI_SubductionSubSectPlots {

public static Region plotReg = new Region(new Location(16.5, -71.5), new Location(21, -60));
Expand All @@ -50,7 +52,7 @@ public static void main(String[] args) throws IOException {
PRVI25_InvConfigFactory factory = new PRVI25_InvConfigFactory();

// File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_Subduction/figures/fault_model");
File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/sub_fm");
File outputDir = new File(FIGURES_DIR, "sub_fm");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

Font font = new Font(Font.SANS_SERIF, Font.BOLD, 24);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

import com.google.common.base.Preconditions;

import static scratch.kevin.prvi25.figures.PRVI_Paths.*;

public class ProxyFaultRepresentationFigures {

private enum RupType {
Expand All @@ -60,7 +62,8 @@ public static void main(String[] args) throws IOException {
ProxyFaultSectionInstances proxyModule = ProxyFaultSectionInstances.build(rupSet, 5, 5d);
rupSet.addModule(proxyModule);

File outputDir = new File("/home/kevin/Documents/papers/2024_PRVI_ERF/prvi25-erf-paper/Figures/proxy_faults");
File outputDir = new File(FIGURES_DIR, "proxy_faults");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

boolean titles = false;

Expand Down
Loading

0 comments on commit e8188ab

Please sign in to comment.