Skip to content

Commit

Permalink
dip no longer required if lower trace supplied (will be calculated)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Milner committed Apr 2, 2024
1 parent 30f600e commit f567351
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public ApproxEvenlyGriddedSurfaceCache(FaultSection sect, FaultTrace lowerTrace)
* and ddw exactly (otherwise trimming occurs)
* @return
*/
public synchronized ApproxEvenlyGriddedSurface getStirlingGriddedSurface(
public synchronized ApproxEvenlyGriddedSurface getApproxEvenlyGriddedSurface(
double gridSpacing, boolean aseisReducesArea) {
// return cached surface?
if( (gridSpacing==lastGridSpacing && approxGriddedSurface != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,15 @@ private GeoJSONFaultSection(Feature feature) {

name = properties.get(FAULT_NAME, null); // can be null

dip = properties.getDouble(DIP, Double.NaN);
checkPropFinite(DIP, dip);
FaultUtils.assertValidDip(dip);

rake = properties.getDouble(RAKE, Double.NaN);
// checkPropFinite(RAKE, rake); // allow rakes to be attached later, don't enforce that it's specified now

upperDepth = properties.getDouble(UPPER_DEPTH, Double.NaN);
checkPropFinite(UPPER_DEPTH, dip);
checkPropFinite(UPPER_DEPTH, upperDepth);
FaultUtils.assertValidDepth(upperDepth);

lowerDepth = properties.getDouble(LOW_DEPTH, Double.NaN);
checkPropFinite(LOW_DEPTH, dip);
checkPropFinite(LOW_DEPTH, lowerDepth);
FaultUtils.assertValidDepth(lowerDepth);

dipDirection = Float.NaN;
Expand Down Expand Up @@ -143,6 +139,16 @@ private GeoJSONFaultSection(Feature feature) {
lowerTrace.addAll(line);
}

dip = properties.getDouble(DIP, Double.NaN);
if (!Double.isFinite(dip) && lowerTrace != null) {
// calculate dip from the lower trace
ApproxEvenlyGriddedSurface surf = getApproxGriddedSurface(1d, false);
dip = surf.getAveDip();
properties.set(DIP, dip);
}
checkPropFinite(DIP, dip);
FaultUtils.assertValidDip(dip);

if (!Double.isFinite(dipDirection)) {
if (lowerTrace == null) {
// use upper trace
Expand Down Expand Up @@ -630,6 +636,10 @@ public List<GeoJSONFaultSection> getSubSectionsList(double maxSubSectionLen, int
FaultTrace lowerSubTrace = equalLengthLowerSubsTrace.get(i);
subSection.properties.set(LOWER_TRACE, new LineString(lowerSubTrace));
subSection.lowerTrace = lowerSubTrace;
// calculate new dip
subSection.dip = new ApproxEvenlyGriddedSurface(subSection.trace, subSection.lowerTrace,
subSection.trace.getTraceLength()/20d).getAveDip();
subSection.properties.set(DIP, subSection.dip);
}

subSectionList.add(subSection);
Expand Down Expand Up @@ -720,7 +730,7 @@ public synchronized ApproxEvenlyGriddedSurface getApproxGriddedSurface(
boolean aseisReducesArea) {
if (approxGriddedCache == null)
approxGriddedCache = new ApproxEvenlyGriddedSurfaceCache(this, lowerTrace);
return approxGriddedCache.getStirlingGriddedSurface(gridSpacing, aseisReducesArea);
return approxGriddedCache.getApproxEvenlyGriddedSurface(gridSpacing, aseisReducesArea);
}

@Override
Expand Down

0 comments on commit f567351

Please sign in to comment.