Skip to content
Snippets Groups Projects
Commit 557df470 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

gridSourceSet type; zoneForLoc returns optional

parent ff9bc713
No related branches found
No related tags found
1 merge request!146Lib updates
...@@ -306,7 +306,11 @@ class GridLoader { ...@@ -306,7 +306,11 @@ class GridLoader {
? record.getOptionalDouble(Key.MMAX) ? record.getOptionalDouble(Key.MMAX)
: OptionalDouble.empty(); : OptionalDouble.empty();
String gridId = zoneForLocation(loc); Optional<String> gridIdOpt = zoneForLocation(loc);
// if (gridIdOpt.isEmpty()) {
// return;
// }
String gridId = gridIdOpt.orElseThrow();
FeatureData featureData = dataMap.get(gridId); FeatureData featureData = dataMap.get(gridId);
featureData.locations.add(loc); featureData.locations.add(loc);
...@@ -366,12 +370,15 @@ class GridLoader { ...@@ -366,12 +370,15 @@ class GridLoader {
return Map.copyOf(modelMfds); return Map.copyOf(modelMfds);
} }
private String zoneForLocation(Location location) { // TODO there are probably going to be curcumstances under which
// it is unreasonable to expect that every single point in a smoothed
// seismicity model is contained in a polygon
private Optional<String> zoneForLocation(Location location) {
return featureMap.values().stream() return featureMap.values().stream()
.filter(grid -> grid.contains(location)) .filter(grid -> grid.contains(location))
.map(grid -> grid.name) .map(grid -> grid.name)
.findFirst() .findFirst();
.orElseThrow(); // .orElseThrow();
} }
} }
...@@ -416,6 +423,7 @@ class GridLoader { ...@@ -416,6 +423,7 @@ class GridLoader {
} }
static GridSourceSet createGrid( static GridSourceSet createGrid(
SourceType type,
SourceConfig.Grid config, SourceConfig.Grid config,
Feature feature, Feature feature,
List<Location> locations, List<Location> locations,
...@@ -433,6 +441,7 @@ class GridLoader { ...@@ -433,6 +441,7 @@ class GridLoader {
.weight(weight) .weight(weight)
.gmms(gmms); .gmms(gmms);
builder.gridConfig(config); builder.gridConfig(config);
builder.type(type);
props.getDouble(Key.STRIKE).ifPresent(builder::strike); props.getDouble(Key.STRIKE).ifPresent(builder::strike);
// System.out.println(mfds.get(0).properties().type()); // System.out.println(mfds.get(0).properties().type());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment