Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:opensha/opensha-dev.git
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmilner committed Nov 30, 2023
2 parents 23ad85a + 7f841b5 commit 00b2d0d
Show file tree
Hide file tree
Showing 3 changed files with 547 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/main/java/gov/usgs/earthquake/nshmp/model/NshmSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public abstract class NshmSource extends ProbEqkSource {

NshmSource(Source delegate) {
this.delegate = delegate;
this.setName(delegate.name());
}

public abstract void setDuration(double duration);
Expand Down Expand Up @@ -52,6 +53,10 @@ public LocationList getAllSourceLocs() {
public RuptureSurface getSourceSurface() {
throw new UnsupportedOperationException();
}

public Source getDelegate() {
return delegate;
}

static class Fault extends NshmSource {

Expand All @@ -63,8 +68,6 @@ static class Fault extends NshmSource {
double duration) {

super(delegate);
// this.setInfo(Integer.toString(delegate.id()));
this.setName(delegate.name());
this.ruptures = delegate.stream()
.map(rupture -> new NshmRupture(
rupture.mag(),
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/scratch/ned/nshm23/CEUS_FSS_creator.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private static ArrayList<GeoJSONFaultSection> getFaultSectionList(String nshmMod
}


private static GeoJSONFaultSection getFaultSection(String filePathString) {
static GeoJSONFaultSection getFaultSection(String filePathString) {
Feature feature=null;
try {
feature = Feature.read(new File(filePathString));
Expand Down Expand Up @@ -189,7 +189,7 @@ private static boolean areSourceRupSurfacesIdentical(ProbEqkSource src) {
}


private static boolean isPointSource(NshmSource src) {
public static boolean isPointSource(NshmSource src) {
int numLocs = src.getRupture(0).getRuptureSurface().getEvenlyDiscretizedNumLocs();
if(numLocs == 1)
return true;
Expand Down Expand Up @@ -607,7 +607,8 @@ else if (altSrcWtmap.keySet().contains(srcID)) // keep and set rateWt


/**
* This creates a fault system solution for a floating rupture source/fault
* This creates a fault system solution for a floating rupture source/fault. This assumes
* the NSHM source ID is the same as the faultSection ID
* @param rateWt
* @param faultSection
* @param erf
Expand Down Expand Up @@ -783,7 +784,7 @@ private static FaultSystemSolution getFaultSystemSolution(double rateWt,
* @param surfListForSrcIdMap
* @return
*/
private static FaultSystemSolution getFaultSystemSolution(HashMap<Integer, SummedMagFreqDist> mfdForSrcIdMap,
public static FaultSystemSolution getFaultSystemSolution(HashMap<Integer, SummedMagFreqDist> mfdForSrcIdMap,
HashMap<Integer, ArrayList<Integer>> surfListForSrcIdMap,
ArrayList<GeoJSONFaultSection> faultSectionData) {

Expand Down Expand Up @@ -852,10 +853,16 @@ private static FaultSystemSolution getFaultSystemSolution(HashMap<Integer, Summe




/**
* This returns the ERF with timespan duration set to 1.0
* @param nshmModelDirPath
* @return
*/
private static NshmErf getNshmERF(String nshmModelDirPath) {
Set<TectonicRegionType> trts = EnumSet.of(TectonicRegionType.STABLE_SHALLOW);
NshmErf erf = new NshmErf(Path.of(nshmModelDirPath), trts, IncludeBackgroundOption.EXCLUDE);
erf.getTimeSpan().setDuration(1.0);
erf.updateForecast();
return erf;
}

Expand All @@ -881,7 +888,7 @@ private static void testForPeter(String nshmModelDirPath) {
* This is for parsing Peter's cluster-set.json files
* @param filePath
*/
private static void parseClusterSetFile(String filePath, HashMap<Integer,int[]> srcFltSectsMap) {
public static void parseClusterSetFile(String filePath, HashMap<Integer,int[]> srcFltSectsMap) {
String ID = "id";
String NAME = "name";
String SECTIONS = "sections";
Expand Down Expand Up @@ -924,7 +931,7 @@ private static void parseClusterSetFile(String filePath, HashMap<Integer,int[]>
* This is for parsing Peter's rupture-set.json files
* @param filePath
*/
private static void parseRuptureSetFile(String filePath,HashMap<Integer,int[]> srcFltSectsMap) {
public static void parseRuptureSetFile(String filePath,HashMap<Integer,int[]> srcFltSectsMap) {

String ID = "id";
String NAME = "name";
Expand Down
Loading

0 comments on commit 00b2d0d

Please sign in to comment.