Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-ws-static
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-ws-static
Commits
b04acaad
Commit
b04acaad
authored
3 years ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
Simpify read data
parent
2d959730
No related branches found
No related tags found
2 merge requests
!103
Production Release | nshmp-ws-static
,
!102
Resolves - Handle Vs30 Map Attribute
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/netcdf/reader/ReaderHazardCurves.java
+2
-22
2 additions, 22 deletions
...gs/earthquake/nshmp/netcdf/reader/ReaderHazardCurves.java
with
2 additions
and
22 deletions
src/main/java/gov/usgs/earthquake/nshmp/netcdf/reader/ReaderHazardCurves.java
+
2
−
22
View file @
b04acaad
package
gov.usgs.earthquake.nshmp.netcdf.reader
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.EnumMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.google.common.reflect.TypeToken
;
import
gov.usgs.earthquake.nshmp.gmm.Imt
;
import
gov.usgs.earthquake.nshmp.netcdf.data.NetcdfDataHazardCurves
;
import
gov.usgs.earthquake.nshmp.netcdf.data.NetcdfShape
;
...
...
@@ -41,30 +38,13 @@ public class ReaderHazardCurves extends Reader {
NetcdfDataHazardCurves
readData
(
Group
targetGroup
)
throws
IOException
{
var
coords
=
super
.
readData
(
targetGroup
);
var
vImls
=
targetGroup
.
findVariableLocal
(
Key
.
IMLS
);
var
vImts
=
targetGroup
.
findVariableLocal
(
Key
.
IMT
);
var
mapTypeToken
=
new
TypeToken
<
Map
<
String
,
String
>>()
{}.
getType
();
// get list of IMT enums
List
<
Imt
>
imtList
=
new
ArrayList
<
Imt
>();
Map
<
String
,
String
>
imtFlagKeys
=
GSON
.
fromJson
(
vImts
.
findAttribute
(
FLAG_KEY
)
.
getValues
().
toString
(),
mapTypeToken
);
var
imtArray
=
vImts
.
read
();
for
(
int
i
=
0
;
i
<
vImts
.
getSize
();
i
++)
{
var
imtInt
=
imtArray
.
getInt
(
i
);
var
imtString
=
imtFlagKeys
.
get
(
Integer
.
toString
(
imtInt
)).
toString
();
imtList
.
add
(
Imt
.
valueOf
(
imtString
));
}
var
imts
=
List
.
copyOf
(
imtList
);
// get map of IMLs
var
imls
=
mapImls
(
vImls
,
imts
);
var
imls
=
mapImls
(
vImls
,
coords
.
imts
()
);
return
NetcdfDataHazardCurves
.
builder
()
.
imls
(
imls
)
.
imts
(
imts
)
.
imts
(
coords
.
imts
()
)
.
latitudes
(
coords
.
latitudes
())
.
longitudes
(
coords
.
longitudes
())
.
scienceBaseMetadata
(
coords
.
scienceBaseMetadata
())
...
...
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