Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-lib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-lib
Commits
9b680ae0
Commit
9b680ae0
authored
1 year ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
removed continue statements
parent
a91a7297
No related branches found
No related tags found
1 merge request
!401
Grid optimizer fix for 2023 NSHM
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java
+40
-80
40 additions, 80 deletions
.../java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java
with
40 additions
and
80 deletions
src/main/java/gov/usgs/earthquake/nshmp/model/GridRuptureSet.java
+
40
−
80
View file @
9b680ae0
...
...
@@ -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 ar
c
e (can) not be combined given
*
b
possibly 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:" + Text
Utils
.NEWLINE + ssTable);
// System.out.println("SS Table:" + Text.NEWLINE + ssTable);
IntervalTable
rTable
=
rTableBuilder
.
build
();
// System.out.println("R Table:" + Text
Utils
.NEWLINE + rTable);
// System.out.println("R Table:" + Text.NEWLINE + rTable);
IntervalTable
nTable
=
nTableBuilder
.
build
();
// System.out.println("N Table:" + Text
Utils
.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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment