Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-ws
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
Admin message
Maintenance scheduled for Thursday, April 10, from 5 PM to 6 PM ET.
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-ws
Commits
07158eee
Commit
07158eee
authored
1 year ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
add optional imt for y label
parent
a036e7ee
No related branches found
No related tags found
1 merge request
!218
Optional IMT
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/www/gmm/GmmService.java
+16
-11
16 additions, 11 deletions
...in/java/gov/usgs/earthquake/nshmp/www/gmm/GmmService.java
with
16 additions
and
11 deletions
src/main/java/gov/usgs/earthquake/nshmp/www/gmm/GmmService.java
+
16
−
11
View file @
07158eee
...
...
@@ -59,11 +59,15 @@ class GmmService {
XyDataGroup
means
;
XyDataGroup
sigmas
;
private
Response
(
Id
service
)
{
private
Response
(
Id
service
,
Optional
<
Imt
>
imt
)
{
String
yLabelMedian
=
imt
.
isPresent
()
?
String
.
format
(
"%s (%s)"
,
service
.
yLabelMedian
,
imt
.
get
().
units
())
:
service
.
yLabelMedian
;
means
=
XyDataGroup
.
create
(
service
.
groupNameMean
,
service
.
xLabel
,
service
.
yLabelMedian
);
yLabelMedian
);
sigmas
=
XyDataGroup
.
create
(
service
.
groupNameSigma
,
...
...
@@ -73,9 +77,10 @@ class GmmService {
static
Response
create
(
Id
service
,
Map
<
Gmm
,
GmmData
>
result
)
{
Map
<
Gmm
,
GmmData
>
result
,
Optional
<
Imt
>
imt
)
{
Response
response
=
new
Response
(
service
);
Response
response
=
new
Response
(
service
,
imt
);
for
(
Entry
<
Gmm
,
GmmData
>
entry
:
result
.
entrySet
())
{
Gmm
gmm
=
entry
.
getKey
();
...
...
@@ -90,7 +95,6 @@ class GmmService {
// If we have a GMM with a single GroundMotion branch,
// then the DataGroup branch list is empty
if
(!
data
.
tree
.
isEmpty
())
{
boolean
hasSigmaBranches
=
data
.
tree
.
get
(
0
).
id
.
contains
(
" : "
);
μEpi
=
data
.
tree
.
stream
()
...
...
@@ -109,6 +113,7 @@ class GmmService {
response
.
means
.
add
(
gmm
.
name
(),
gmm
.
toString
(),
μTotal
,
μEpi
);
response
.
sigmas
.
add
(
gmm
.
name
(),
gmm
.
toString
(),
σTotal
,
sigmaEpi
);
}
return
response
;
}
}
...
...
@@ -117,7 +122,7 @@ class GmmService {
static
HttpResponse
<
String
>
process
(
Request
request
)
{
Map
<
Gmm
,
GmmData
>
spectra
=
GmmCalc
.
spectra
(
request
,
false
);
Response
response
=
Response
.
create
(
request
.
serviceId
,
spectra
);
Response
response
=
Response
.
create
(
request
.
serviceId
,
spectra
,
Optional
.
empty
()
);
var
body
=
ResponseBody
.
success
()
.
name
(
request
.
serviceId
.
name
)
.
url
(
request
.
http
.
getUri
().
getPath
())
...
...
@@ -142,7 +147,7 @@ class GmmService {
double
[]
rArray
=
distanceArray
(
request
);
Map
<
Gmm
,
GmmData
>
gmvr
=
GmmCalc
.
distance
(
request
,
rArray
);
Response
response
=
Response
.
create
(
request
.
serviceId
,
gmvr
);
Response
response
=
Response
.
create
(
request
.
serviceId
,
gmvr
,
Optional
.
of
(
request
.
imt
)
);
var
body
=
ResponseBody
.
success
()
.
name
(
request
.
serviceId
.
name
)
.
url
(
request
.
http
.
getUri
().
getPath
())
...
...
@@ -199,7 +204,7 @@ class GmmService {
request
.
mMin
,
request
.
mMax
,
request
.
step
);
Map
<
Gmm
,
GmmData
>
gmvm
=
GmmCalc
.
magnitude
(
request
,
mArray
,
request
.
distance
);
Response
response
=
Response
.
create
(
request
.
serviceId
,
gmvm
);
Response
response
=
Response
.
create
(
request
.
serviceId
,
gmvm
,
Optional
.
of
(
request
.
imt
)
);
var
body
=
ResponseBody
.
success
()
.
name
(
request
.
serviceId
.
name
)
.
url
(
request
.
http
.
getUri
().
getPath
())
...
...
@@ -293,7 +298,7 @@ class GmmService {
"Means"
,
"Sigmas"
,
"Distance (km)"
,
"Median ground motion
(g)
"
,
"Median ground motion"
,
"Standard deviation"
),
HW_FW
(
...
...
@@ -303,7 +308,7 @@ class GmmService {
"Means"
,
"Sigmas"
,
"Distance (km)"
,
"Median ground motion
(g)
"
,
"Median ground motion"
,
"Standard deviation"
),
MAGNITUDE
(
...
...
@@ -313,7 +318,7 @@ class GmmService {
"Means"
,
"Sigmas"
,
"Magnitude"
,
"Median ground motion
(g)
"
,
"Median ground motion"
,
"Standard deviation"
),
SPECTRA
(
...
...
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