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 {
? record.getOptionalDouble(Key.MMAX)
: 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.locations.add(loc);
......@@ -366,12 +370,15 @@ class GridLoader {
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()
.filter(grid -> grid.contains(location))
.map(grid -> grid.name)
.findFirst()
.orElseThrow();
.findFirst();
// .orElseThrow();
}
}
......@@ -416,6 +423,7 @@ class GridLoader {
}
static GridSourceSet createGrid(
SourceType type,
SourceConfig.Grid config,
Feature feature,
List<Location> locations,
......@@ -433,6 +441,7 @@ class GridLoader {
.weight(weight)
.gmms(gmms);
builder.gridConfig(config);
builder.type(type);
props.getDouble(Key.STRIKE).ifPresent(builder::strike);
// 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