diff --git a/src/main/java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java b/src/main/java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java index 5a4395254fe70929f84810b33bd2ab11cf525eed..16a2f45a163b0c350125a66edc166d5abffb83a2 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java @@ -688,8 +688,8 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { * Row count reflects the number of rows used in a DataTable when building * sources. Although this will likely be the same as sources.size(), it may * not be. For example, when using multi-mechs many more sources are created - * because the different focal mechs arce (can) not be combined given - * bpossibly varying rates across different magnitudes. + * because the different focal mechs are (can) not be combined given + * possibly varying rates across different magnitudes. */ private int rowCount; private int maximumSize; @@ -789,11 +789,6 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { double mMin = mags[0] - ΔmBy2; double mMax = mags[mags.length - 1] + ΔmBy2; - // table keys are specified as lowermost and uppermost bin edges - // double Δm = parent.Δm; - // double ΔmBy2 = Δm / 2.0; - // double mMin = parent.magMaster[0] - ΔmBy2; - // double mMax = parent.magMaster[parent.magMaster.length - 1] + ΔmBy2; double rMax = parent.gmmTree().maxDistance().orElseThrow(); double distanceBin = parent.distanceBin.orElseThrow(); double[] smoothingOffsets = smoothingOffsets( @@ -856,10 +851,6 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { double mMin = mags[0] - ΔmBy2; double mMax = mags[mags.length - 1] + ΔmBy2; - // double Δm = parent.Δm; - // double ΔmBy2 = Δm / 2.0; - // double mMin = parent.magMaster[0] - ΔmBy2; - // double mMax = parent.magMaster[parent.magMaster.length - 1] + ΔmBy2; double rMax = parent.gmmTree().maxDistance().orElseThrow(); double distanceBin = parent.distanceBin.orElseThrow(); double[] smoothingOffsets = smoothingOffsets( @@ -878,30 +869,13 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { .rows(0.0, rMax, distanceBin) .columns(mMin, mMax, Δm); - // XySequence srcMfdSum = null; - for (PointSource source : parent.iterableForLocation(origin)) { double r = Locations.horzDistanceFast(origin, source.loc); - // if (srcMfdSum == null) { - // srcMfdSum = XySequence.emptyCopyOf(source.mfd); - // } - // srcMfdSum.add(source.mfd); - Mfd ssMfd = Mfd.Builder.from(source.mfd).scale(source.mechWtMap.get(STRIKE_SLIP)).build(); Mfd rMfd = Mfd.Builder.from(source.mfd).scale(source.mechWtMap.get(REVERSE)).build(); Mfd nMfd = Mfd.Builder.from(source.mfd).scale(source.mechWtMap.get(NORMAL)).build(); - // XySequence ssMfd = - // MutableXySequence.copyOf(source.mfd.data()).multiply( - // source.mechWtMap.get(STRIKE_SLIP)); - // XySequence rMfd = - // MutableXySequence.copyOf(source.mfd.data()).multiply( - // source.mechWtMap.get(REVERSE)); - // XySequence nMfd = - // MutableXySequence.copyOf(source.mfd.data()).multiply( - // source.mechWtMap.get(NORMAL)); - if (smoothed && r < parent.smoothingLimit) { addSmoothed(ssTableBuilder, origin, source.loc, ssMfd, smoothingOffsets); addSmoothed(rTableBuilder, origin, source.loc, rMfd, smoothingOffsets); @@ -911,31 +885,28 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { rTableBuilder.add(r, rMfd.data()); nTableBuilder.add(r, nMfd.data()); } - parentCount++; } IntervalTable ssTable = ssTableBuilder.build(); - // System.out.println("SS Table:" + TextUtils.NEWLINE + ssTable); + // System.out.println("SS Table:" + Text.NEWLINE + ssTable); IntervalTable rTable = rTableBuilder.build(); - // System.out.println("R Table:" + TextUtils.NEWLINE + rTable); + // System.out.println("R Table:" + Text.NEWLINE + rTable); IntervalTable nTable = nTableBuilder.build(); - // System.out.println("N Table:" + TextUtils.NEWLINE + nTable); + // System.out.println("N Table:" + Text.NEWLINE + nTable); // DataTable tableSum = DataTable.Builder.fromModel(ssTable) // .add(ssTable) // .add(rTable) // .add(nTable) // .build(); - // + // XySequence tableMfdSum = // XySequence.emptyCopyOf(tableSum.row(0.1)); // for (double row : tableSum.rows()) { // tableMfdSum.add(tableSum.row(row)); // } - // System.out.println("sourcesMfd:"); - // System.out.println(srcMfdSum); - // + // System.out.println("tableMfd:"); // System.out.println(tableMfdSum); @@ -947,49 +918,46 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { boolean tableRowUsed = false; Mfd ssMfd = Mfd.create(ssTable.row(r)); - if (ssMfd.data().isClear()) { - continue; + if (ssMfd.data().y(0) > 0.0 || !ssMfd.data().isClear()) { + b.add(new PointSourceFinite( + parent, + parent.type(), + loc, + ssMfd, + parent.mechMaps.get(0), + parent.rupScaling, + parent.depthModel, + Optional.empty())); + tableRowUsed = true; } - b.add(new PointSourceFinite( - parent, - parent.type(), - loc, - ssMfd, - parent.mechMaps.get(0), - parent.rupScaling, - parent.depthModel, - Optional.empty())); - tableRowUsed = true; Mfd rMfd = Mfd.create(rTable.row(r)); - if (rMfd.data().isClear()) { - continue; + if (rMfd.data().y(0) > 0.0 || !rMfd.data().isClear()) { + b.add(new PointSourceFinite( + parent, + parent.type(), + loc, + rMfd, + parent.mechMaps.get(0), + parent.rupScaling, + parent.depthModel, + Optional.empty())); + tableRowUsed = true; } - b.add(new PointSourceFinite( - parent, - parent.type(), - loc, - rMfd, - parent.mechMaps.get(0), - parent.rupScaling, - parent.depthModel, - Optional.empty())); - tableRowUsed = true; Mfd nMfd = Mfd.create(nTable.row(r)); - if (nMfd.data().isClear()) { - continue; + if (nMfd.data().y(0) > 0.0 || !nMfd.data().isClear()) { + b.add(new PointSourceFinite( + parent, + parent.type(), + loc, + nMfd, + parent.mechMaps.get(0), + parent.rupScaling, + parent.depthModel, + Optional.empty())); + tableRowUsed = true; } - b.add(new PointSourceFinite( - parent, - parent.type(), - loc, - nMfd, - parent.mechMaps.get(0), - parent.rupScaling, - parent.depthModel, - Optional.empty())); - tableRowUsed = true; if (tableRowUsed) { rowCount++; @@ -998,14 +966,6 @@ public class GridRuptureSet extends AbstractRuptureSet<PointSource> { return List.copyOf(b); } - /* - * Return a distance dependent discretization. Currently this is fixed at - * 1km for r<400km and 5km for r>= 400km - */ - // private static double distanceDiscretization(double r) { - // return r < 400.0 ? 1.0 : 5.0; - // } - private static double[] smoothingOffsets(int density, double spacing) { return offsets(spacing, (density == 4) ? OFFSET_SCALE_4