Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-haz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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-haz
Commits
9f5a5ed8
Commit
9f5a5ed8
authored
3 years ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
deagg epsilon updated for single model
parent
3a63cccd
No related branches found
No related tags found
1 merge request
!524
Repo docs and disagg updates
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/DeaggEpsilon.java
+14
-40
14 additions, 40 deletions
src/main/java/gov/usgs/earthquake/nshmp/DeaggEpsilon.java
with
14 additions
and
40 deletions
src/main/java/gov/usgs/earthquake/nshmp/DeaggEpsilon.java
+
14
−
40
View file @
9f5a5ed8
...
...
@@ -10,7 +10,6 @@ import java.nio.file.Path;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.EnumMap
;
import
java.util.EnumSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
...
...
@@ -91,11 +90,7 @@ public class DeaggEpsilon {
log
.
info
(
PROGRAM
+
": "
+
HazardCalc
.
VERSION
);
Path
modelPath
=
Paths
.
get
(
args
[
0
]);
Path
wusPath
=
modelPath
.
resolve
(
"Western US"
);
Path
ceusPath
=
modelPath
.
resolve
(
"Central & Eastern US"
);
HazardModel
wusModel
=
HazardModel
.
load
(
wusPath
);
HazardModel
ceusModel
=
HazardModel
.
load
(
ceusPath
);
HazardModel
model
=
HazardModel
.
load
(
modelPath
);
log
.
info
(
""
);
Path
siteFile
=
Paths
.
get
(
args
[
1
]);
...
...
@@ -105,22 +100,16 @@ public class DeaggEpsilon {
int
colsToSkip
=
headerCount
(
siteFile
);
List
<
Imt
>
imts
=
readImtList
(
siteFile
,
colsToSkip
);
CalcConfig
wusConfig
=
wusModel
.
config
();
CalcConfig
ceusConfig
=
ceusModel
.
config
();
CalcConfig
config
=
model
.
config
();
if
(
argCount
==
3
)
{
Path
userConfigPath
=
Paths
.
get
(
args
[
2
]);
wusConfig
=
CalcConfig
.
copyOf
(
wusModel
.
config
())
.
extend
(
CalcConfig
.
from
(
userConfigPath
))
.
imts
(
EnumSet
.
copyOf
(
imts
))
.
build
();
ceusConfig
=
CalcConfig
.
copyOf
(
ceusModel
.
config
())
config
=
CalcConfig
.
copyOf
(
model
.
config
())
.
extend
(
CalcConfig
.
from
(
userConfigPath
))
.
imts
(
EnumSet
.
copyOf
(
imts
))
.
build
();
}
log
.
info
(
wusC
onfig
.
toString
());
log
.
info
(
c
onfig
.
toString
());
List
<
Site
>
sites
=
ImmutableList
.
copyOf
(
Sites
.
fromCsv
(
siteFile
,
wusC
onfig
,
true
));
List
<
Site
>
sites
=
ImmutableList
.
copyOf
(
Sites
.
fromCsv
(
siteFile
,
c
onfig
,
true
));
log
.
info
(
"Sites: "
+
sites
.
size
());
log
.
info
(
"Site data columns: "
+
colsToSkip
);
...
...
@@ -129,14 +118,14 @@ public class DeaggEpsilon {
checkArgument
(
sites
.
size
()
==
imtImlMaps
.
size
(),
"Sites and spectra lists different sizes"
);
Path
out
=
calc
(
wusModel
,
wusConfig
,
ceusModel
,
ceusC
onfig
,
sites
,
imtImlMaps
,
log
);
Path
out
=
calc
(
model
,
c
onfig
,
sites
,
imtImlMaps
,
log
);
log
.
info
(
PROGRAM
+
": finished"
);
/* Transfer log and write config, windows requires fh.close() */
fh
.
close
();
Files
.
move
(
tmpLog
,
out
.
resolve
(
PROGRAM
+
".log"
));
wusC
onfig
.
write
(
out
);
c
onfig
.
write
(
out
);
return
Optional
.
empty
();
...
...
@@ -196,16 +185,14 @@ public class DeaggEpsilon {
* HazardCalc.calc() that will trigger deaggregations if the value is present.
*/
private
static
Path
calc
(
HazardModel
wusModel
,
CalcConfig
wusConfig
,
HazardModel
ceusModel
,
CalcConfig
ceusConfig
,
HazardModel
model
,
CalcConfig
config
,
List
<
Site
>
sites
,
List
<
Map
<
Imt
,
Double
>>
rtrSpectra
,
Logger
log
)
throws
IOException
{
ExecutorService
exec
=
null
;
ThreadCount
threadCount
=
wusC
onfig
.
performance
.
threadCount
;
ThreadCount
threadCount
=
c
onfig
.
performance
.
threadCount
;
if
(
threadCount
==
ThreadCount
.
ONE
)
{
exec
=
MoreExecutors
.
newDirectExecutorService
();
log
.
info
(
"Threads: Running on calling thread"
);
...
...
@@ -215,7 +202,7 @@ public class DeaggEpsilon {
}
log
.
info
(
PROGRAM
+
": calculating ..."
);
Path
outDir
=
createOutputDir
(
wusC
onfig
.
output
.
directory
);
Path
outDir
=
createOutputDir
(
c
onfig
.
output
.
directory
);
Path
siteDir
=
outDir
.
resolve
(
"vs30-"
+
(
int
)
sites
.
get
(
0
).
vs30
);
Files
.
createDirectory
(
siteDir
);
...
...
@@ -226,24 +213,11 @@ public class DeaggEpsilon {
Site
site
=
sites
.
get
(
i
);
Map
<
Imt
,
Double
>
spectrum
=
rtrSpectra
.
get
(
i
);
Hazard
wusHazard
=
null
;
if
(
site
.
location
.
longitude
<=
-
100.0
)
{
wusHazard
=
HazardCalcs
.
hazard
(
wusModel
,
wusConfig
,
site
,
exec
);
}
Hazard
ceusHazard
=
null
;
if
(
site
.
location
.
longitude
>
-
115.0
)
{
ceusHazard
=
HazardCalcs
.
hazard
(
ceusModel
,
ceusConfig
,
site
,
exec
);
}
Hazard
cousHazard
=
(
wusHazard
==
null
)
?
ceusHazard
:
(
ceusHazard
==
null
)
?
wusHazard
:
Hazard
.
merge
(
wusHazard
,
ceusHazard
);
Disaggregation
disagg
=
Disaggregation
.
atImls
(
cousHazard
,
spectrum
,
exec
);
Hazard
hazard
=
HazardCalcs
.
hazard
(
model
,
config
,
site
,
exec
);
Disaggregation
disagg
=
Disaggregation
.
atImls
(
hazard
,
spectrum
,
exec
);
List
<
Response
>
responses
=
new
ArrayList
<>(
spectrum
.
size
());
for
(
Imt
imt
:
wusC
onfig
.
hazard
.
imts
)
{
for
(
Imt
imt
:
c
onfig
.
hazard
.
imts
)
{
ResponseData
imtMetadata
=
new
ResponseData
(
ImmutableList
.
of
(),
site
,
...
...
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