Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply from: '../opensha/build-common.gradle'

dependencies {

api "ghsc:nshmp-lib:1.7.10"
api "ghsc:nshmp-lib:1.7.14"

implementation 'org.apache.pdfbox:pdfbox:2.0.6'
implementation 'org.apache.commons:commons-collections4:4.1'
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/gov/usgs/earthquake/nshmp/model/NshmErf.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ private List<NshmSource> sourcesFromBranch(
? ruptureSetToSources(ruptureSet, weight, duration)
: List.of();

case INTERFACE_CLUSTER:
ClusterRuptureSet icrs = (ClusterRuptureSet) ruptureSet;
return (subInterface && faults)
? clusterRuptureSetToSources(icrs, weight, duration)
: List.of();

case INTERFACE_SYSTEM:
SystemRuptureSet isrs = (SystemRuptureSet) ruptureSet;
return (faults)
? systemRuptureSetToSources(isrs, weight, duration)
: List.of();

case SLAB:
return (subSlab && faults)
? ruptureSetToSources(ruptureSet, weight, duration)
Expand Down
24 changes: 13 additions & 11 deletions src/main/java/gov/usgs/earthquake/nshmp/model/NshmErfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ public class NshmErfTest {
// private static final Path MODEL =
// Path.of("../nshmp-lib/src/test/resources/model/test-model");
// private static final Path MODEL = Path.of("../nshm-conus-2018-5.x-maint");
private static final Path MODEL = Path.of("../nshm-conus");
private static final Path MODEL = Path.of("../nshm-prvi");

// static gov.usgs.earthquake.nshmp.geo.Location testLoc =
// gov.usgs.earthquake.nshmp.geo.Location.create(-122, 39.0);
static gov.usgs.earthquake.nshmp.geo.Location testLoc =
gov.usgs.earthquake.nshmp.geo.Location.create(-80, 33.2);
static gov.usgs.earthquake.nshmp.geo.Location testLoc =
gov.usgs.earthquake.nshmp.geo.Location.create(-66.117, 18.465);
// static gov.usgs.earthquake.nshmp.geo.Location testLoc =
// gov.usgs.earthquake.nshmp.geo.Location.create(-80, 33.2);

// static gov.usgs.earthquake.nshmp.geo.Location testLoc =
// gov.usgs.earthquake.nshmp.geo.Location.create(-110, 37.5);

public static void main(String[] args) {

Set<TectonicRegionType> trts =
EnumSet.of(TectonicRegionType.STABLE_SHALLOW);
// Set<TectonicRegionType> trts = EnumSet.noneOf(TectonicRegionType.class);
// Set<TectonicRegionType> trts =
// EnumSet.of(TectonicRegionType.STABLE_SHALLOW);
Set<TectonicRegionType> trts = EnumSet.noneOf(TectonicRegionType.class);

HazardModel model = HazardModel.load(MODEL);
NshmErf erf = new NshmErf(model, trts, IncludeBackgroundOption.EXCLUDE);
NshmErf erf = new NshmErf(model, trts, IncludeBackgroundOption.INCLUDE);
System.out.println("NSHM ERF size: " + erf.getNumSources());
erf.getTimeSpan().setDuration(1.0);
erf.updateForecast();
Expand Down Expand Up @@ -125,16 +125,18 @@ public static void main(String[] args) {
}
}

// calcHazard(erf);
calcHazard(erf);
}

private static void calcHazard(NshmErf erf) {
ScalarIMR gmpe = new ASK_2014_Wrapper();
gmpe.setParamDefaults();
gmpe.setIntensityMeasure(PGA_Param.NAME);

Site site = new Site(new Location(34, -118)); // Los Angeles
Site site = new Site(new Location(18.465, -66.117)); // San Juan
// Site site = new Site(new Location(34, -118)); // Los Angeles
// Site site = new Site(new Location(40.75, -111.90)); // Salt lake City


for (Parameter<?> param : gmpe.getSiteParams()) {
site.addParameter((Parameter<?>) param.clone());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public LocationList getEvenlyDiscritizedListOfLocsOnSurface() {
public double getAveLength() {
return delegate.length();
}

@Override public double getQuickDistance(Location siteLoc) {
return calcQuickDistance(siteLoc);
}

// Unnecessary methods for hazard calculations

Expand All @@ -168,7 +172,6 @@ public double getAveLength() {
@Override public FaultTrace getEvenlyDiscritizedUpperEdge() { throw new UnsupportedOperationException(); }
@Override public LocationList getEvenlyDiscritizedLowerEdge() { throw new UnsupportedOperationException(); }
@Override public double getAveGridSpacing() { throw new UnsupportedOperationException(); }
@Override public double getQuickDistance(Location siteLoc) { throw new UnsupportedOperationException(); }
@Override public double getAveDipDirection() { throw new UnsupportedOperationException(); }
@Override public FaultTrace getUpperEdge() { throw new UnsupportedOperationException(); }
@Override public double getFractionOfSurfaceInRegion(Region region) { throw new UnsupportedOperationException(); }
Expand Down