Skip to content

Commit

Permalink
Merge branch 'master' into critical_refl
Browse files Browse the repository at this point in the history
  • Loading branch information
crotwell committed Mar 2, 2022
2 parents bbc722d + 6bd129a commit f504b87
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/java/edu/sc/seis/TauP/SurfaceWaveTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,33 @@ public void testSurfaceWave() throws TauModelException {
0.07f,
phaseName + " time for depth " + depth + " at dist " + deg);
}

@Test
public void testDistKm() throws TauModelException {
double distKm = 100;
double phaseVel = 3.2;
String phaseName = phaseVel+"kmps";
assertEquals("3.2kmps", phaseName);
float depth = 0;
double distDeg = distKm/taup.getTauModel().getRadiusOfEarth()*180.0/Math.PI;
assertEquals(0.8993, distDeg, 0.0001);
double longWayDistDeg = 360.0-distDeg;
double longWayDistKm = longWayDistDeg*taup.getTauModel().getRadiusOfEarth()*Math.PI/180.0;
taup.setPhaseNames(new String[] {phaseName});
taup.setSourceDepth(depth);
taup.calculate(distDeg);
List<Arrival> arrivals = taup.getArrivals();
assertEquals(2, arrivals.size(),
phaseName + " has arrivals for depth " + depth + " at dist " + distDeg);
assertTrue(arrivals.get(0).getTime() < arrivals.get(1).getTime());
assertEquals(distKm/phaseVel,
arrivals.get(0).getTime(),
0.001f,
phaseName + " time for depth " + depth + " at dist " + distDeg+"/"+distKm+" "+arrivals.get(0));
// long way around
assertEquals(longWayDistKm/phaseVel,
arrivals.get(1).getTime(),
0.001f,
phaseName + " time for depth " + depth + " at dist " + longWayDistDeg+"/"+longWayDistKm+" "+arrivals.get(1));
}
}

0 comments on commit f504b87

Please sign in to comment.