Skip to content

Commit

Permalink
new RSQSim catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Milner committed Oct 7, 2024
1 parent d567cf1 commit b2ef3bb
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 46 deletions.
28 changes: 26 additions & 2 deletions src/main/java/scratch/kevin/simulators/RSQSimCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipFile;

import org.dom4j.Attribute;
import org.dom4j.Document;
Expand Down Expand Up @@ -790,7 +791,16 @@ public enum Catalogs {
59, 'G'),
BRUCE_5892("rundir5892", "Bruce 5892", "Bruce Shaw", cal(2024, 8, 25),
"WUSav, delta=2.0km, sigma0=100, b=.008, alpha=0.25",
NSHM23_FaultModels.WUS_FM_v3, NSHM23_DeformationModels.AVERAGE);
NSHM23_FaultModels.WUS_FM_v3, NSHM23_DeformationModels.AVERAGE),
BRUCE_5895("rundir5895", "Bruce 5895", "Bruce Shaw", cal(2024, 9, 12),
"WUSav, delta=2.0km, sigma0=100, b=.008, alpha=0.25, dynamic",
NSHM23_FaultModels.WUS_FM_v3, NSHM23_DeformationModels.AVERAGE),
BRUCE_5932("rundir5932", "Bruce 5932", "Bruce Shaw", cal(2024, 9, 12),
"CA, delta=1.0km, sigma0=100, bdeep=.013 bshallow=.003, alpha=0.25, hload=hst=3, dynamic tcausalFactor=.60",
FaultModels.FM3_1, DeformationModels.GEOLOGIC),
BRUCE_5935("rundir5935", "Bruce 5935", "Bruce Shaw", cal(2024, 9, 12),
"CA, delta=1.0km, sigma0=100, bdeep=.013 bshallow=.003, alpha=0.25, hload=hst=3, dynamic tcausalFactor=.75",
FaultModels.FM3_1, DeformationModels.GEOLOGIC);

private String dirName;
private RSQSimCatalog catalog;
Expand Down Expand Up @@ -2013,13 +2023,27 @@ public synchronized FaultSystemSolution getComparisonSolution() throws IOExcepti
// download it
String addr = "http://data.opensha.org/ftp/kmilner/ucerf3/2013_05_10-ucerf3p3-production-10runs_fm_dm_sub_plots/"
+ fm.getFilePrefix()+"_"+dm.getFilePrefix()+"/"+solFile.getName();
boolean validate = false;
try {
FileUtils.downloadURL(addr, solFile);
validate = true;
} catch (IOException e) {
System.err.println("Failed to download comparison solution from: "+addr);
e.printStackTrace();
solFile = null;
}
if (validate) {
// make sure the file we just downloaded actually works
try {
ZipFile zip = new ZipFile(solFile);
zip.close();
} catch (Exception e) {
// failed
System.err.println("Failed to download comparison solution from: "+addr+" (bad zip file)");
solFile.delete();
solFile = null;
}
}
}
}

Expand Down Expand Up @@ -3409,7 +3433,7 @@ public static void main(String args[]) throws IOException, DocumentException {
File gitDir = new File("/home/kevin/markdown/rsqsim-analysis/catalogs");

boolean overwriteIndividual = true;
boolean replot = true;
boolean replot = false;

// File baseDir = new File("/data/kevin/simulators/catalogs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,16 @@ public static void main(String[] args) throws IOException {
// String prefix = "r5652";
// VelocityModel vm = VelocityModel.LA_BASIN_500;

RSQSimCatalog catalog = Catalogs.BRUCE_5672.instance();
File bbpDir = new File("/data/kevin/bbp/parallel/2023_11_06-rundir5672-all-m6.5-skipYears2000-noHF-vmLA_BASIN_500-griddedSites");
// RSQSimCatalog catalog = Catalogs.BRUCE_5672.instance();
// File bbpDir = new File("/data/kevin/bbp/parallel/2023_11_06-rundir5672-all-m6.5-skipYears2000-noHF-vmLA_BASIN_500-griddedSites");
// File bbpFile = new File(bbpDir, "results_rotD.zip");
// String prefix = "r5672";
// VelocityModel vm = VelocityModel.LA_BASIN_500;

RSQSimCatalog catalog = Catalogs.BRUCE_5935.instance();
File bbpDir = new File("/data/kevin/bbp/parallel/2024_10_04-rundir5935-all-m6.5-skipYears2000-maxDist300-noHF-vmLA_BASIN_500-griddedSites");
File bbpFile = new File(bbpDir, "results_rotD.zip");
String prefix = "r5672";
String prefix = "r5935";
VelocityModel vm = VelocityModel.LA_BASIN_500;

PlotType[] types = PlotType.values();
Expand All @@ -291,10 +297,19 @@ public static void main(String[] args) throws IOException {
// AttenRelRef gmmRef = AttenRelRef.ASK_2014;
// prefix += "_ask2014";

File outputDir = new File("/home/kevin/Documents/papers/2023_Bruce_GMM_Multifault/figures/checkerboards");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());
outputDir = new File(outputDir, prefix);
// File outputDir = new File("/home/kevin/Documents/papers/2023_Bruce_GMM_Multifault/figures/checkerboards");
// Preconditions.checkState(outputDir.exists() || outputDir.mkdir());
// outputDir = new File(outputDir, prefix);
// Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

File markdownDir = new File("/home/kevin/markdown/rsqsim-analysis/catalogs");
File mdCatalogDir = new File(markdownDir, catalog.getCatalogDir().getName());
Preconditions.checkState(mdCatalogDir.exists());
File mdBBPDir = new File(mdCatalogDir, "bbp_"+vm.name());
Preconditions.checkState(mdCatalogDir.exists() || mdCatalogDir.mkdir());
File outputDir = new File(mdBBPDir, "standalone_gmpe_checkerboards");
Preconditions.checkState(outputDir.exists() || outputDir.mkdir());

File resourcesDir = new File(outputDir, "resources");
Preconditions.checkState(resourcesDir.exists() || resourcesDir.mkdir());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,19 @@ public static void main(String[] args) throws ZipException, IOException {
// RSQSimCatalog catalog = Catalogs.BRUCE_5413.instance();
// RSQSimCatalog catalog = Catalogs.BRUCE_5774.instance();
// RSQSimCatalog catalog = Catalogs.BRUCE_5775_CRUSTAL.instance();
RSQSimCatalog catalog = Catalogs.BRUCE_5775_SUB.instance();
// RSQSimCatalog catalog = Catalogs.BRUCE_5775_SUB.instance();
RSQSimCatalog catalog = Catalogs.BRUCE_5935.instance();

boolean doGMPE = true;
boolean doRotD = false;

boolean doNonErgodicMaps = false;
Region siteMapRegion = null;
Region sourceMapRegion = null;

Region siteMapRegion = new CaliforniaRegions.CYBERSHAKE_MAP_REGION();
Region sourceMapRegion = bufferRegion(siteMapRegion, 200d);
// boolean doNonErgodicMaps = true;
// Region siteMapRegion = new CaliforniaRegions.CYBERSHAKE_MAP_REGION();
// Region sourceMapRegion = bufferRegion(siteMapRegion, 200d);

boolean doGridded = true;

Expand All @@ -593,13 +598,13 @@ public static void main(String[] args) throws ZipException, IOException {

// AttenRelSupplier[] gmpeRefs = { AttenRelRef.NGAWest_2014_AVG_NOIDRISS, AttenRelRef.ASK_2014,
// AttenRelRef.BSSA_2014, AttenRelRef.CB_2014, AttenRelRef.CY_2014 };
//// AttenRelRef[] gmpeRefs = { AttenRelRef.NGAWest_2014_AVG_NOIDRISS, AttenRelRef.ASK_2014 };
//// AttenRelRef[] gmpeRefs = { AttenRelRef.NGAWest_2014_AVG_NOIDRISS };
//// AttenRelRef[] gmpeRefs = { AttenRelRef.BSSA_2014, AttenRelRef.CB_2014, AttenRelRef.CY_2014 };
//// IMT[] imts = { IMT.SA3P0 };
//// AttenRelRef[] gmpeRefs = { AttenRelRef.ASK_2014 };
// IMT[] imts = { IMT.PGV, IMT.SA2P0, IMT.SA3P0, IMT.SA5P0, IMT.SA10P0 };
// AttenRelRef rotDGMPE = AttenRelRef.ASK_2014;
AttenRelRef[] gmpeRefs = { AttenRelRef.NGAWest_2014_AVG_NOIDRISS, AttenRelRef.ASK_2014 };
// AttenRelRef[] gmpeRefs = { AttenRelRef.NGAWest_2014_AVG_NOIDRISS };
// AttenRelRef[] gmpeRefs = { AttenRelRef.BSSA_2014, AttenRelRef.CB_2014, AttenRelRef.CY_2014 };
// IMT[] imts = { IMT.SA3P0 };
// AttenRelRef[] gmpeRefs = { AttenRelRef.ASK_2014 };
IMT[] imts = { IMT.PGV, IMT.SA2P0, IMT.SA3P0, IMT.SA5P0, IMT.SA10P0 };
AttenRelRef rotDGMPE = AttenRelRef.ASK_2014;

// AttenRelRef[] gmpeRefs = { AttenRelRef.AFSHARI_STEWART_2016 };
// IMT[] imts = { IMT.DUR_5_75, IMT.DUR_5_95, IMT.DUR_20_80 };
Expand All @@ -609,11 +614,11 @@ public static void main(String[] args) throws ZipException, IOException {
// IMT[] imts = { IMT.SA2P0, IMT.SA3P0, IMT.SA5P0 };
// AttenRelRef rotDGMPE = null;

AttenRelSupplier[] gmpeRefs = {
new NSHMP_AttenRelSupplier(Gmm.AG_20_GLOBAL_INTERFACE, "AG2020_Global", false)
};
IMT[] imts = { IMT.SA2P0, IMT.SA3P0, IMT.SA5P0, IMT.SA10P0 };
AttenRelRef rotDGMPE = null;
// AttenRelSupplier[] gmpeRefs = {
// new NSHMP_AttenRelSupplier(Gmm.AG_20_GLOBAL_INTERFACE, "AG2020_Global", false)
// };
// IMT[] imts = { IMT.SA2P0, IMT.SA3P0, IMT.SA5P0, IMT.SA10P0 };
// AttenRelRef rotDGMPE = null;

String[] highlightNames;
if (doGridded)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public static void main(String[] args) throws IOException {
// String catalogDirName = "rundir5597_crustal_corupture";
// String catalogDirName = "rundir5775_subduction";
// String catalogDirName = "rundir5775_crustal";
String catalogDirName = "rundir5892";
String catalogDirName = "rundir5932";

int skipYears = 20000;
// int skipYears = 20000;
// int skipYears = 5000;
// int skipYears = 2000;
int skipYears = 2000;
// int skipYears = 0;
// int skipYears = 65000;

Expand All @@ -65,26 +65,19 @@ public static void main(String[] args) throws IOException {
boolean nzStandardSites = false;

// CA
// Integer utmZone = null;
// Character utmBand = null;
// boolean standardSites = false;
// boolean csInitialLASites = false;
// boolean cs500LASites = false;
// boolean csLAMapSites = false;
// boolean griddedCASites = true;
// boolean griddedSoCalSites = false;
// boolean griddedNZSites = false;
// boolean nzStandardSites = false;
//// VelocityModel vm = VelocityModel.LA_BASIN_863; // uncomment only if you need the old 863
// VelocityModel vm = VelocityModel.LA_BASIN_500;

// NSHM23-wUS
Integer utmZone = null;
Character utmBand = null;
griddedWUSSites = true;
griddedCASites = true;
// VelocityModel vm = VelocityModel.LA_BASIN_863; // uncomment only if you need the old 863
VelocityModel vm = VelocityModel.LA_BASIN_500;

// NSHM23-wUS
// Integer utmZone = null;
// Character utmBand = null;
// griddedWUSSites = true;
//// VelocityModel vm = VelocityModel.LA_BASIN_863; // uncomment only if you need the old 863
// VelocityModel vm = VelocityModel.LA_BASIN_500;

// NZ
// Integer utmZone = 59;
// Character utmBand = 'G';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class SingleLocSlipRateVarPlot {

public static void main(String[] args) throws IOException {
RSQSimCatalog catalog = Catalogs.BRUCE_5892.instance();
int skipYears = 20000;
// RSQSimCatalog catalog = Catalogs.BRUCE_5895.instance();
// int skipYears = 5000;
List<? extends FaultSection> subSects = catalog.getSubSects();

int[] parentIDs = {
Expand Down Expand Up @@ -68,7 +71,7 @@ public static void main(String[] args) throws IOException {
DiscretizedFunc cumulativeSlipFunc = new ArbitrarilyDiscretizedFunc();
double cumulativeSlip = 0d;

List<RSQSimEvent> events = catalog.loader().skipYears(20000).forSections(false, middle.getSectionId()).minMag(5d).load();
List<RSQSimEvent> events = catalog.loader().skipYears(skipYears).forSections(false, middle.getSectionId()).minMag(5d).load();
System.out.println("Loaded "+events.size()+" events for "+middle.getSectionName());

double firstEventTime = 0d;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ public static void main(String[] args) throws IOException {
File inputDir = new File("/home/kevin/OpenSHA/UCERF3/eal/"
// + "2020_04_03-ucerf3-ngaw2-cea-100pct-consolidate-calcLEC");
// + "2020_07_08-ucerf3-ngaw2-cea-100pct-consolidate-calcLEC-gmVar");
+ "2020_09_03-ucerf3-ngaw2-cea-100pct-consolidate-calcLEC-covModel");
List<U3LogicTreeBranchNode<?>> fixedBranches = new ArrayList<>();
fixedBranches.add(U3_EAL_GMMs.BSSA_2014);
fixedBranches.add(U3_EAL_GMM_Epistemic.NONE);
// + "2020_09_03-ucerf3-ngaw2-cea-100pct-consolidate-calcLEC-covModel");
+ "2024_09_05-ucerf3-ngaw2-cea-100pct-consolidate-calcLEC-covModel");
List<U3LogicTreeBranchNode<?>> fixedBranches = null;
// List<U3LogicTreeBranchNode<?>> fixedBranches = new ArrayList<>();
// fixedBranches.add(U3_EAL_GMMs.BSSA_2014);
// fixedBranches.add(U3_EAL_GMM_Epistemic.NONE);

File outputDir = new File(inputDir, "tree_trimming");
if (fixedBranches != null && !fixedBranches.isEmpty()) {
Expand Down

0 comments on commit b2ef3bb

Please sign in to comment.