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
fb3b1243
Commit
fb3b1243
authored
3 years ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
simplified hazardExport
parent
b76e202e
No related branches found
No related tags found
1 merge request
!244
Program edits
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
+5
-34
5 additions, 34 deletions
...ain/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
src/main/java/gov/usgs/earthquake/nshmp/calc/Sites.java
+1
-1
1 addition, 1 deletion
src/main/java/gov/usgs/earthquake/nshmp/calc/Sites.java
with
6 additions
and
35 deletions
src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
+
5
−
34
View file @
fb3b1243
...
...
@@ -22,10 +22,8 @@ import java.util.Map;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.logging.Logger
;
import
java.util.stream.IntStream
;
import
com.google.common.base.Stopwatch
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.collect.Iterables
;
import
com.google.common.collect.Maps
;
...
...
@@ -66,7 +64,6 @@ public final class HazardExport {
private
static
final
String
CURVE_FILE_ASCII_TRUNCATED
=
"curves-truncated.csv"
;
private
static
final
String
VALUE_FMT
=
"%.8e"
;
private
final
Logger
log
;
private
final
Path
dir
;
private
final
HazardModel
model
;
private
final
CalcConfig
config
;
...
...
@@ -75,9 +72,6 @@ public final class HazardExport {
private
final
Function
<
Double
,
String
>
valueFormatter
;
private
final
Stopwatch
batchWatch
;
private
final
Stopwatch
totalWatch
;
private
int
batchCount
=
0
;
private
int
resultCount
=
0
;
private
final
boolean
namedSites
;
...
...
@@ -86,10 +80,8 @@ public final class HazardExport {
private
HazardExport
(
HazardModel
model
,
CalcConfig
config
,
List
<
Site
>
sites
,
Logger
log
)
throws
IOException
{
List
<
Site
>
sites
)
throws
IOException
{
this
.
log
=
log
;
this
.
dir
=
createOutputDir
(
config
.
output
.
directory
);
this
.
model
=
model
;
this
.
config
=
config
;
...
...
@@ -104,9 +96,6 @@ public final class HazardExport {
Site
demoSite
=
sites
.
get
(
0
);
this
.
namedSites
=
demoSite
.
name
()
!=
Site
.
NO_NAME
;
this
.
batchWatch
=
Stopwatch
.
createStarted
();
this
.
totalWatch
=
Stopwatch
.
createStarted
();
init
(
sites
);
}
...
...
@@ -121,10 +110,9 @@ public final class HazardExport {
public
static
HazardExport
create
(
HazardModel
model
,
CalcConfig
config
,
List
<
Site
>
sites
,
Logger
log
)
throws
IOException
{
List
<
Site
>
sites
)
throws
IOException
{
return
new
HazardExport
(
model
,
config
,
sites
,
log
);
return
new
HazardExport
(
model
,
config
,
sites
);
}
/* Initialize output directories. */
...
...
@@ -195,13 +183,6 @@ public final class HazardExport {
checkState
(!
used
,
"This result handler is expired"
);
writeHazard
(
hazard
);
resultCount
++;
if
(
resultCount
%
10
==
0
)
{
batchCount
++;
log
.
info
(
String
.
format
(
" batch: %s in %s – %s sites in %s"
,
batchCount
,
batchWatch
,
resultCount
,
totalWatch
));
batchWatch
.
reset
().
start
();
}
}
/**
...
...
@@ -209,26 +190,16 @@ public final class HazardExport {
* 'used'; no more results may be added.
*/
public
void
expire
()
{
batchWatch
.
stop
();
totalWatch
.
stop
();
used
=
true
;
}
/**
* The number of hazard
[and disagg]
results passed to this handler thus far.
* The number of hazard results passed to this handler thus far.
*/
public
int
resultCount
()
{
return
resultCount
;
}
/**
* A string representation of the time duration that this result handler has
* been running.
*/
public
String
elapsedTime
()
{
return
totalWatch
.
toString
();
}
/**
* The target output directory established by this handler.
*/
...
...
@@ -236,7 +207,7 @@ public final class HazardExport {
return
dir
;
}
/* Write the supplied hazard
and possible disagg
results to file(s). */
/* Write the supplied hazard results to file(s). */
private
void
writeHazard
(
Hazard
hazard
)
throws
IOException
{
Set
<
Gmm
>
gmms
=
hazard
.
model
.
gmms
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/gov/usgs/earthquake/nshmp/calc/Sites.java
+
1
−
1
View file @
fb3b1243
...
...
@@ -71,7 +71,7 @@ public final class Sites {
* If a sites file contains columns for basin depths, a 'null' value string
* indicates a GMM should do whatever it defines as default behavior and
* will override values that may be included in the site data of a model. If
* the value is empty, then whatever
default
s from (2) or (3) will be used.
* the value is empty, then whatever
value
s from (2) or (3) will be used.
*/
Location
loc
=
Location
.
create
(
...
...
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