Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-apps
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-apps
Commits
b3713b7b
Commit
b3713b7b
authored
5 months ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
fix horizontal and vertical lines
parent
116d93b0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!499
RTGM: Lines
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/nshmp-apps/src/app/designmaps/rtgm/services/app.service.ts
+39
-25
39 additions, 25 deletions
...shmp-apps/src/app/designmaps/rtgm/services/app.service.ts
with
39 additions
and
25 deletions
projects/nshmp-apps/src/app/designmaps/rtgm/services/app.service.ts
+
39
−
25
View file @
b3713b7b
...
@@ -9,7 +9,7 @@ import {
...
@@ -9,7 +9,7 @@ import {
}
from
'
@ghsc/nshmp-lib-ng/nshmp
'
;
}
from
'
@ghsc/nshmp-lib-ng/nshmp
'
;
import
{
NshmpPlot
,
PlotOptions
,
plotUtils
}
from
'
@ghsc/nshmp-lib-ng/plot
'
;
import
{
NshmpPlot
,
PlotOptions
,
plotUtils
}
from
'
@ghsc/nshmp-lib-ng/plot
'
;
import
{
import
{
Rtgm
Calc
,
Rtgm
,
RtgmCalcResponse
,
RtgmCalcResponse
,
RtgmIteration
,
RtgmIteration
,
RtgmUsageParameters
,
RtgmUsageParameters
,
...
@@ -316,10 +316,11 @@ export class AppService
...
@@ -316,10 +316,11 @@ export class AppService
}
}
private
createFragilityPlot
(
private
createFragilityPlot
(
rtgm
Calc
:
Rtgm
Calc
,
rtgm
:
Rtgm
,
iterations
:
IterationPlotData
iterations
:
IterationPlotData
):
NshmpPlot
{
):
NshmpPlot
{
const
plots
=
this
.
state
().
plots
;
const
plots
=
this
.
state
().
plots
;
const
{
condCollapseProb
}
=
rtgm
.
riskTargets
;
return
{
return
{
...
plots
.
fragility
,
...
plots
.
fragility
,
...
@@ -329,12 +330,13 @@ export class AppService
...
@@ -329,12 +330,13 @@ export class AppService
...
iterations
.
fragilityPlotData
,
...
iterations
.
fragilityPlotData
,
this
.
linePlotData
(
this
.
linePlotData
(
iterations
.
integralHazardFragilityPlotData
,
iterations
.
integralHazardFragilityPlotData
,
0.1
,
condCollapseProb
,
'
10
% Conditional Probability of Collapse
'
`
${
condCollapseProb
*
100
}
% Conditional Probability of Collapse
`
),
),
...
this
.
createFragilitySlices
(
...
this
.
createFragilitySlices
(
rtgmCalc
.
iterations
,
condCollapseProb
,
rtgmCalc
.
upsampledHazCurve
.
imlUP
,
rtgm
.
rtgmCalc
.
iterations
,
rtgm
.
rtgmCalc
.
upsampledHazCurve
.
imlUP
,
[
0
,
1
]
[
0
,
1
]
),
),
],
],
...
@@ -343,12 +345,12 @@ export class AppService
...
@@ -343,12 +345,12 @@ export class AppService
}
}
private
createFragilitySlices
(
private
createFragilitySlices
(
condCollapseProb
:
number
,
iterations
:
RtgmIteration
[],
iterations
:
RtgmIteration
[],
imls
:
number
[],
imls
:
number
[],
yRange
:
number
[]
yRange
:
number
[]
):
Partial
<
PlotData
>
[]
{
):
Partial
<
PlotData
>
[]
{
const
fragilitySlices
:
Partial
<
PlotData
>
[]
=
[];
const
fragilitySlices
:
Partial
<
PlotData
>
[]
=
[];
const
percent
=
0.1
;
const
colors
=
d3Color
.
schemeCategory10
;
const
colors
=
d3Color
.
schemeCategory10
;
iterations
.
forEach
((
iteration
,
index
)
=>
{
iterations
.
forEach
((
iteration
,
index
)
=>
{
...
@@ -359,7 +361,7 @@ export class AppService
...
@@ -359,7 +361,7 @@ export class AppService
ys
:
iteration
.
frCDF
,
ys
:
iteration
.
frCDF
,
};
};
const
slice
=
Maths
.
interpolate
(
fragilityXy
,
percent
);
const
slice
=
Maths
.
interpolate
(
fragilityXy
,
condCollapseProb
);
fragilitySlices
.
push
({
fragilitySlices
.
push
({
line
:
{
line
:
{
...
@@ -388,20 +390,23 @@ export class AppService
...
@@ -388,20 +390,23 @@ export class AppService
};
};
}
}
private
createHazardPlot
(
rtgm
Calc
:
Rtgm
Calc
):
NshmpPlot
{
private
createHazardPlot
(
rtgm
:
Rtgm
):
NshmpPlot
{
const
plots
=
this
.
state
().
plots
;
const
plots
=
this
.
state
().
plots
;
const
values
=
this
.
formGroup
.
getRawValue
();
const
imls
=
rtgmCalc
.
upsampledHazCurve
.
imlUP
;
const
imls
=
rtgm
.
rtgmCalc
.
upsampledHazCurve
.
imlUP
;
const
afes
=
rtgmCalc
.
upsampledHazCurve
.
afeUP
;
const
afes
=
rtgm
.
rtgmCalc
.
upsampledHazCurve
.
afeUP
;
const
hazardPlotData
:
Partial
<
PlotData
>
=
{
const
hazardPlotData
:
Partial
<
PlotData
>
=
{
hovertemplate
:
'
%{x} g, %{y} AFE
'
,
hovertemplate
:
'
%{x} g, %{y} AFE
'
,
mode
:
'
lines+markers
'
,
mode
:
'
lines+markers
'
,
name
:
this
.
formGroup
.
getRawV
alue
()
.
label
,
name
:
v
alue
s
.
label
,
x
:
imls
,
x
:
imls
,
y
:
afes
,
y
:
afes
,
};
};
const
percent
=
values
.
buildingCode
===
'
ASCE7
'
?
'
2%
'
:
'
7%
'
;
return
{
return
{
...
plots
.
hazard
,
...
plots
.
hazard
,
plotData
:
{
plotData
:
{
...
@@ -410,20 +415,28 @@ export class AppService
...
@@ -410,20 +415,28 @@ export class AppService
hazardPlotData
,
hazardPlotData
,
this
.
linePlotData
(
this
.
linePlotData
(
[
hazardPlotData
],
[
hazardPlotData
],
1
/
2475
,
1
/
rtgm
.
riskTargets
.
UH_retPeriod
,
'
2% Probability of Exceedance in 50 years
'
`
${
percent
}
Probability of Exceedance in
${
rtgm
.
riskTargets
.
timeHorizon_Yr
}
years`
),
...
this
.
createFragilitySlices
(
rtgm
.
riskTargets
.
condCollapseProb
,
rtgm
.
rtgmCalc
.
iterations
,
imls
,
[
Math
.
min
(...
afes
),
Math
.
max
(...
afes
)]
),
),
...
this
.
createFragilitySlices
(
rtgmCalc
.
iterations
,
imls
,
[
Math
.
min
(...
afes
),
Math
.
max
(...
afes
),
]),
],
],
},
},
};
};
}
}
private
createIntegralPlot
(
iterations
:
IterationPlotData
):
NshmpPlot
{
private
createIntegralPlot
(
rtgm
:
Rtgm
,
iterations
:
IterationPlotData
):
NshmpPlot
{
const
plots
=
this
.
state
().
plots
;
const
plots
=
this
.
state
().
plots
;
const
riskTargets
=
rtgm
.
riskTargets
;
const
percent
=
riskTargets
.
tgtCollapseRisk_T
;
const
year
=
riskTargets
.
timeHorizon_Yr
;
return
{
return
{
...
plots
.
integralHazardFragility
,
...
plots
.
integralHazardFragility
,
...
@@ -433,8 +446,8 @@ export class AppService
...
@@ -433,8 +446,8 @@ export class AppService
...
iterations
.
integralHazardFragilityPlotData
,
...
iterations
.
integralHazardFragilityPlotData
,
this
.
linePlotData
(
this
.
linePlotData
(
iterations
.
integralHazardFragilityPlotData
,
iterations
.
integralHazardFragilityPlotData
,
1
/
4975
,
riskTargets
.
riskTgt_Annual
,
'
1
% Probability of Collapse in
50
years
'
`
${
percent
*
100
}
% Probability of Collapse in
${
year
}
years
`
),
),
],
],
},
},
...
@@ -704,16 +717,17 @@ export class AppService
...
@@ -704,16 +717,17 @@ export class AppService
throw
Error
(
`[
${
values
.
label
}
] not in response.`
);
throw
Error
(
`[
${
values
.
label
}
] not in response.`
);
}
}
const
rtgmCalc
=
serviceResponse
.
response
.
RTGM
[
values
.
label
].
rtgmCalc
;
const
rtgm
=
serviceResponse
.
response
.
RTGM
[
values
.
label
];
const
rtgmCalc
=
rtgm
.
rtgmCalc
;
const
imls
=
rtgmCalc
.
upsampledHazCurve
.
imlUP
;
const
imls
=
rtgmCalc
.
upsampledHazCurve
.
imlUP
;
const
iterations
=
this
.
createIterationPlotData
(
rtgmCalc
.
iterations
,
imls
);
const
iterations
=
this
.
createIterationPlotData
(
rtgmCalc
.
iterations
,
imls
);
return
{
return
{
derivativeFragility
:
this
.
createDerivativeFragilityPlot
(
iterations
),
derivativeFragility
:
this
.
createDerivativeFragilityPlot
(
iterations
),
fragility
:
this
.
createFragilityPlot
(
rtgm
Calc
,
iterations
),
fragility
:
this
.
createFragilityPlot
(
rtgm
,
iterations
),
hazard
:
this
.
createHazardPlot
(
rtgm
Calc
),
hazard
:
this
.
createHazardPlot
(
rtgm
),
hazardFragility
:
this
.
createHazardFragilityPlot
(
iterations
),
hazardFragility
:
this
.
createHazardFragilityPlot
(
iterations
),
integralHazardFragility
:
this
.
createIntegralPlot
(
iterations
),
integralHazardFragility
:
this
.
createIntegralPlot
(
rtgm
,
iterations
),
};
};
}
}
...
...
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