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
61218faf
Commit
61218faf
authored
6 months ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
added ability to get gmm weight
parent
aaadda42
No related branches found
No related tags found
1 merge request
!421
Magnitude curves
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/model/GmmTree.java
+16
-5
16 additions, 5 deletions
src/main/java/gov/usgs/earthquake/nshmp/model/GmmTree.java
with
16 additions
and
5 deletions
src/main/java/gov/usgs/earthquake/nshmp/model/GmmTree.java
+
16
−
5
View file @
61218faf
package
gov.usgs.earthquake.nshmp.model
;
import
static
java
.
util
.
stream
.
Collectors
.
toUnmodifiableMap
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.OptionalDouble
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
com.google.gson.JsonElement
;
...
...
@@ -37,7 +39,7 @@ public class GmmTree {
*/
private
final
LogicTree
<
Gmm
>
tree
;
private
final
Set
<
Gmm
>
gmms
;
private
final
Map
<
Gmm
,
Double
>
gmms
;
/* GmmConfig fields. */
private
final
OptionalDouble
maxDistance
;
...
...
@@ -45,8 +47,9 @@ public class GmmTree {
private
GmmTree
(
LogicTree
<
Gmm
>
tree
,
Optional
<
GmmConfig
>
config
)
{
this
.
tree
=
tree
;
this
.
gmms
=
tree
.
stream
()
.
map
(
Branch:
:
value
)
.
collect
(
Collectors
.
toUnmodifiableSet
());
.
collect
(
toUnmodifiableMap
(
Branch:
:
value
,
Branch:
:
weight
));
this
.
maxDistance
=
config
.
isPresent
()
?
OptionalDouble
.
of
(
config
.
orElseThrow
().
maxDistance
)
:
OptionalDouble
.
empty
();
...
...
@@ -64,7 +67,15 @@ public class GmmTree {
/** The set of GMMs in the logic tree. */
public
Set
<
Gmm
>
gmms
()
{
return
gmms
;
return
gmms
.
keySet
();
}
/**
* The logic tree weight of the requested GMM.
* @throws NullPointerException if the supplied GMM is not in this tree
*/
public
double
gmmWeight
(
Gmm
gmm
)
{
return
gmms
.
get
(
gmm
);
}
/** The maximum applicable distance for the GMMs in the logic tree. */
...
...
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