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
3b98411e
Commit
3b98411e
authored
3 years ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
hazard export takes path instead of optional vs30
parent
3923bee9
No related branches found
No related tags found
1 merge request
!251
Export updates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
+11
-9
11 additions, 9 deletions
...ain/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java
+1
-1
1 addition, 1 deletion
...est/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java
with
12 additions
and
10 deletions
src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
+
11
−
9
View file @
3b98411e
...
...
@@ -65,7 +65,7 @@ public final class HazardExport {
private
static
final
String
CURVE_FILE_ASCII_TRUNCATED
=
"curves-truncated.csv"
;
private
static
final
String
VALUE_FMT
=
"%.8e"
;
private
final
Path
dir
;
private
final
Path
out
;
private
final
HazardModel
model
;
private
final
CalcConfig
config
;
private
final
boolean
exportGmm
;
...
...
@@ -82,9 +82,9 @@ public final class HazardExport {
HazardModel
model
,
CalcConfig
config
,
List
<
Site
>
sites
,
OptionalDouble
vs30
)
throws
IOException
{
Path
out
)
throws
IOException
{
this
.
dir
=
createOutputDir
(
config
.
output
.
directory
,
vs30
)
;
this
.
out
=
out
;
this
.
model
=
model
;
this
.
config
=
config
;
this
.
exportGmm
=
config
.
output
.
dataTypes
.
contains
(
DataType
.
GMM
);
...
...
@@ -107,16 +107,17 @@ public final class HazardExport {
* @param model being run
* @param config that specifies output options and formats
* @param sites reference to the sites to be processed (not retained)
* @param vs30 optional vs30 value used when running multiple site classes
* @param out results directory; this may have been been modified from
* {@code config.output.directory} by calling program
* @param log shared logging instance from calling class
*/
public
static
HazardExport
create
(
HazardModel
model
,
CalcConfig
config
,
List
<
Site
>
sites
,
OptionalDouble
vs30
)
throws
IOException
{
Path
out
)
throws
IOException
{
return
new
HazardExport
(
model
,
config
,
sites
,
vs30
);
return
new
HazardExport
(
model
,
config
,
sites
,
out
);
}
/* Initialize output directories. */
...
...
@@ -124,7 +125,7 @@ public final class HazardExport {
for
(
Imt
imt
:
config
.
hazard
.
imts
)
{
Path
imtDir
=
dir
.
resolve
(
imt
.
name
());
Path
imtDir
=
out
.
resolve
(
imt
.
name
());
Files
.
createDirectory
(
imtDir
);
Path
totalFile
=
imtDir
.
resolve
(
CURVE_FILE_ASCII
);
Path
totalFileTruncated
=
imtDir
.
resolve
(
CURVE_FILE_ASCII_TRUNCATED
);
...
...
@@ -176,6 +177,7 @@ public final class HazardExport {
}
if
(
vs30
.
isPresent
())
{
String
vs30dir
=
"vs30-"
+
((
int
)
vs30
.
getAsDouble
());
outDir
=
outDir
.
resolve
(
vs30dir
);
}
Files
.
createDirectories
(
outDir
);
...
...
@@ -212,7 +214,7 @@ public final class HazardExport {
* The target output directory established by this handler.
*/
public
Path
outputDir
()
{
return
dir
;
return
out
;
}
/* Write the supplied hazard results to file(s). */
...
...
@@ -240,7 +242,7 @@ public final class HazardExport {
String
emptyLine
=
locStr
+
"0.0"
+
",0.0"
.
repeat
(
totalCurve
.
size
()
-
1
);
Imt
imt
=
imtEntry
.
getKey
();
Path
imtDir
=
dir
.
resolve
(
imt
.
name
());
Path
imtDir
=
out
.
resolve
(
imt
.
name
());
String
totalLine
=
locStr
+
valueStr
(
totalCurve
,
valueFormatter
);
String
totalLineTrunc
=
locStr
+
truncValueStr
(
totalCurve
,
valueFormatter
,
TRUNCATION_LIMIT
);
...
...
This diff is collapsed.
Click to expand it.
src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java
+
1
−
1
View file @
3b98411e
...
...
@@ -214,7 +214,7 @@ class LoaderTests {
List
<
Site
>
sites
)
throws
IOException
{
ExecutorService
exec
=
initExecutor
(
config
.
performance
.
threadCount
);
HazardExport
handler
=
HazardExport
.
create
(
model
,
config
,
sites
,
OptionalDouble
.
empty
()
);
HazardExport
handler
=
HazardExport
.
create
(
model
,
config
,
sites
,
config
.
output
.
directory
);
for
(
Site
site
:
sites
)
{
Hazard
hazard
=
HazardCalcs
.
hazard
(
model
,
config
,
site
,
exec
);
handler
.
write
(
hazard
);
...
...
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