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
64ac931f
Commit
64ac931f
authored
4 years ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
fault and cluster handling improvements
parent
e127ccf0
No related branches found
No related tags found
1 merge request
!146
Lib updates
Pipeline
#32243
failed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/model/HazardModel.java
+50
-44
50 additions, 44 deletions
...ain/java/gov/usgs/earthquake/nshmp/model/HazardModel.java
with
50 additions
and
44 deletions
src/main/java/gov/usgs/earthquake/nshmp/model/HazardModel.java
+
50
−
44
View file @
64ac931f
...
...
@@ -20,7 +20,6 @@ import com.google.common.collect.Sets;
import
com.google.common.collect.Streams
;
import
com.google.gson.annotations.SerializedName
;
import
gov.usgs.earthquake.nshmp.Maths
;
import
gov.usgs.earthquake.nshmp.calc.CalcConfig
;
import
gov.usgs.earthquake.nshmp.gmm.Gmm
;
import
gov.usgs.earthquake.nshmp.gmm.GroundMotionModel
;
...
...
@@ -268,19 +267,42 @@ public final class HazardModel implements Iterable<SourceSet<? extends Source>>
return
;
}
/* FAULT: each leaf is a FaultSource in a FaultSourceSet */
// System.out.println(tree.singleType());
if
(
tree
.
singleType
())
{
/* Check if mixed fault/cluster types */
// boolean mixed = tree.branchMap().keySet().stream()
// .map(Leaf::ruptureSet)
// .map(RuptureSet::type)
// .forEach(System.out::println);
// TODO want to get rid of this but currently needed
// to distinguish trees made up of CLUSTER and FAULT
// TODO what should this return for mixed fault/cluster ??
// @Deprecated
// public boolean singleType() {
// // leafBranches.keySet().forEach(System.out::println);
// return leafBranches.keySet().stream()
// .map(Leaf::ruptureSet)
// .map(RuptureSet::type)
// .distinct()
// .count() == 1;
// }
/*
* FAULT/CLUSTER: each FAULT leaf is a FaultSource in a FaultSourceSet,
* each CLUSTER leaf is an individual clusterSourceSet
*/
FaultSourceSet
.
Builder
fss
=
new
FaultSourceSet
.
Builder
();
fss
.
name
(
tree
.
name
());
fss
.
weight
(
1.0
);
fss
.
gmms
(
tree
.
gmms
());
FaultSourceSet
.
Builder
fss
=
new
FaultSourceSet
.
Builder
();
fss
.
name
(
tree
.
name
());
fss
.
weight
(
1.0
);
fss
.
gmms
(
tree
.
gmms
());
for
(
Leaf
leaf
:
tree
.
branchMap
().
keySet
())
{
for
(
Leaf
leaf
:
tree
.
branchMap
().
keySet
())
{
RuptureSet
rs
=
leaf
.
ruptureSet
;
// System.out.println("Flt to FaultSrcSet: " + rs.type() + " " +
// rs.name());
RuptureSet
rs
=
leaf
.
ruptureSet
;
double
branchWeight
=
tree
.
branchWeights
().
get
(
leaf
)
;
if
(
leaf
.
ruptureSet
.
type
()
==
SourceType
.
FAULT
)
{
double
leafWeight
=
tree
.
branchWeights
().
get
(
leaf
);
FaultRuptureSet
frs
=
(
FaultRuptureSet
)
rs
;
...
...
@@ -302,29 +324,12 @@ public final class HazardModel implements Iterable<SourceSet<? extends Source>>
}
else
{
System
.
out
.
println
(
" No source ruptures: "
+
faultSource
.
name
());
}
}
if
(
fss
.
sources
.
size
()
>
0
)
{
addSourceSet
(
fss
.
buildFaultSet
());
}
else
{
System
.
out
.
println
(
" Empty Source Set: "
+
fss
.
name
);
}
return
;
}
/* Otherwise types are mixed, e.g. New Madrid, Wasatch */
for
(
Leaf
leaf
:
tree
.
branchMap
().
keySet
())
{
RuptureSet
rs
=
leaf
.
ruptureSet
;
double
branchWeight
=
tree
.
branchWeights
().
get
(
leaf
);
if
(
leaf
.
ruptureSet
.
type
()
==
SourceType
.
FAULT_CLUSTER
)
{
// System.out.println("Flt to ClusterSrcSet: " + rs.type() + " " +
// rs.name());
ClusterRuptureSet
crs
=
(
ClusterRuptureSet
)
rs
;
ClusterSourceSet
.
Builder
css
=
new
ClusterSourceSet
.
Builder
();
css
.
name
(
crs
.
name
);
css
.
id
(
crs
.
id
);
...
...
@@ -336,38 +341,39 @@ public final class HazardModel implements Iterable<SourceSet<? extends Source>>
for
(
Branch
<
Double
>
rateBranch
:
rateTree
)
{
double
returnPeriod
=
rateBranch
.
value
();
double
rate
=
(
returnPeriod
<=
0.0
)
?
0.0
:
Maths
.
roundToDigits
(
1.0
/
returnPeriod
,
4
);
String
clusterLabel
=
crs
.
name
+
" : "
+
((
int
)
returnPeriod
)
+
"-yr"
;
double
rate
=
(
rateBranch
.
value
()
<=
0.0
)
?
0.0
:
rateBranch
.
value
();
String
rateLabel
=
(
rate
==
0.0
)
?
"0"
:
String
.
valueOf
((
int
)
(
1.0
/
rate
));
String
clusterLabel
=
crs
.
name
+
" : "
+
rateLabel
+
"-yr"
;
ClusterSource
.
Builder
csBuilder
=
new
ClusterSource
.
Builder
()
.
name
(
clusterLabel
)
.
id
(
crs
.
id
)
.
rate
(
rate
);
// cluster rate
FaultSourceSet
.
Builder
fss
=
new
FaultSourceSet
.
Builder
();
fss
.
name
(
clusterLabel
);
fss
.
id
(
crs
.
id
);
fss
.
gmms
(
tree
.
gmms
());
FaultSourceSet
.
Builder
c
fss
=
new
FaultSourceSet
.
Builder
();
c
fss
.
name
(
clusterLabel
);
c
fss
.
id
(
crs
.
id
);
c
fss
.
gmms
(
tree
.
gmms
());
// The weight of the fss gets called by ClusterSource.weight()
// The weight of the
c
fss gets called by ClusterSource.weight()
// and is used in HazardCurveSet.Builder.addCurves()
fss
.
weight
(
rateBranch
.
weight
());
c
fss
.
weight
(
rateBranch
.
weight
());
for
(
FaultRuptureSet
frs
:
crs
.
faultRuptureSets
)
{
fss
.
source
(
faultRuptureSetToSource
(
frs
,
1.0
),
1.0
);
c
fss
.
source
(
faultRuptureSetToSource
(
frs
,
1.0
),
1.0
);
}
csBuilder
.
faults
(
fss
.
buildFaultSet
());
csBuilder
.
faults
(
c
fss
.
buildFaultSet
());
css
.
source
(
csBuilder
.
buildClusterSource
());
}
addSourceSet
(
css
.
buildClusterSet
());
}
}
if
(
fss
.
sources
.
size
()
>
0
)
{
addSourceSet
(
fss
.
buildFaultSet
());
}
else
{
System
.
out
.
println
(
" Empty Source Set: "
+
fss
.
name
);
}
}
private
FaultSource
faultRuptureSetToSource
(
...
...
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