diff --git a/src/main/java/gov/usgs/earthquake/nshmp/model/GridLoader.java b/src/main/java/gov/usgs/earthquake/nshmp/model/GridLoader.java index ca45dd3f56def09122a6d764d3ef6b8c0f1124e8..f364da0cef65d52ebc44a72959728233c4eb2d77 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/model/GridLoader.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/model/GridLoader.java @@ -147,6 +147,7 @@ class GridLoader { this.mfdsPath = data.gridRateFile().orElseThrow(); this.mfdTreeKey = mfdTreeKey; this.featureData = new FeatureData(); + processNodes(); } diff --git a/src/main/java/gov/usgs/earthquake/nshmp/model/GridSourcePlanar.java b/src/main/java/gov/usgs/earthquake/nshmp/model/GridSourcePlanar.java index 6d82e218598e231f73fd60f601007c47c5599856..c3849d07ec20e65f182cd3cce69f6c8c32d07de7 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/model/GridSourcePlanar.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/model/GridSourcePlanar.java @@ -4,6 +4,7 @@ import static gov.usgs.earthquake.nshmp.Maths.PI_BY_2; import static gov.usgs.earthquake.nshmp.Maths.TO_RADIANS; import static gov.usgs.earthquake.nshmp.Maths.TWO_PI; import static gov.usgs.earthquake.nshmp.Maths.hypot; +import static java.lang.Math.abs; import static java.lang.Math.min; import static java.lang.Math.sin; import static java.lang.Math.sqrt; @@ -182,20 +183,22 @@ class GridSourcePlanar extends PointSource { // down-dip and up-dip azimuths double ddAz = (strikeRad + PI_BY_2) % TWO_PI; - double udAz = (strikeRad - PI_BY_2) % TWO_PI; // down-dip double ddΔV = zBor - location.depth; double ddΔH = ddΔV / tan(dipRad); double ddW = ddΔV / sin(dipRad); - LocationVector ddV = LocationVector.create(ddAz, ddΔH, -ddΔV); + + LocationVector ddV = LocationVector.create(ddAz, ddΔH, ddΔV); Location ddP = Locations.location(location, ddV); // up-dip - double udΔV = location.depth - zTor; + double udΔV = zTor - location.depth; double udΔH = udΔV / tan(dipRad); double udW = udΔV / sin(dipRad); - LocationVector udV = LocationVector.create(udAz, udΔH, udΔV); + // in the updip case, udΔH is negative effectively + // reversing the downdip azimuth + LocationVector udV = LocationVector.create(ddAz, udΔH, udΔV); Location udP = Locations.location(location, udV); this.p1 = Locations.location(udP, svB); @@ -203,8 +206,8 @@ class GridSourcePlanar extends PointSource { this.p3 = Locations.location(ddP, svF); this.p4 = Locations.location(ddP, svB); - this.width = ddW + udW; - this.widthH = ddΔH + udΔH; + this.width = ddW + abs(udW); + this.widthH = ddΔH + abs(udΔH); } @Override