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
f9709d15
Commit
f9709d15
authored
6 months ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
test mag curve sum equals total
parent
e36b40f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!421
Magnitude curves
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java
+22
-0
22 additions, 0 deletions
...est/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java
with
22 additions
and
0 deletions
src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java
+
22
−
0
View file @
f9709d15
...
...
@@ -14,6 +14,7 @@ import java.nio.file.Files;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.EnumMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -33,6 +34,7 @@ import gov.usgs.earthquake.nshmp.calc.HazardCalcs;
import
gov.usgs.earthquake.nshmp.calc.HazardExport
;
import
gov.usgs.earthquake.nshmp.calc.Site
;
import
gov.usgs.earthquake.nshmp.calc.Sites
;
import
gov.usgs.earthquake.nshmp.data.MutableXySequence
;
import
gov.usgs.earthquake.nshmp.data.XySequence
;
import
gov.usgs.earthquake.nshmp.geo.Location
;
import
gov.usgs.earthquake.nshmp.gmm.Gmm
;
...
...
@@ -135,6 +137,12 @@ class LoaderTests {
}
assertCurveEquals
(
magExpecteds
.
get
(
m
),
magActuals
.
get
(
m
),
tol
);
}
// Check that actual magnitude curves sum to expected total curve for IMT
XySequence
magCombinedActual
=
combineMagCurves
(
actuals
.
curves
().
get
(
imt
),
actuals
.
magCurves
().
get
(
imt
).
values
());
assertCurveEquals
(
totalExpected
,
magCombinedActual
,
tol
);
}
}
...
...
@@ -285,6 +293,20 @@ class LoaderTests {
.
toArray
();
}
/* --- mag hazard testing --- */
private
static
XySequence
combineMagCurves
(
XySequence
model
,
Collection
<
MutableXySequence
>
curves
)
{
MutableXySequence
xyOut
=
MutableXySequence
.
emptyCopyOf
(
model
);
for
(
XySequence
curve
:
curves
)
{
if
(
curve
!=
null
)
{
xyOut
.
add
(
curve
);
}
}
return
xyOut
;
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
model
=
ModelLoader
.
load
(
MODEL_PATH
);
List
<
Site
>
sites
=
Sites
.
fromCsv
(
SITES_PATH
,
model
.
siteData
(),
OptionalDouble
.
empty
());
...
...
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