Back when I was working in a seismology lab, I was told to write my own gridsearch procedure as a pedagogical exercise. For context, each physical station receives a seismic signal at timestamp t. However, we don't know how far away the earthquake is, along with the travel time.
To figure that out, we look at the P and S wave arrival times (example): since these two waves travel at different speeds, we can guess what the speed difference is, and hence guess the travel time.
Given 3 travel times, a guess at the difference between P and S waves, and the strong assumption that earthquakes cannot happen in the sky, we can locate the event center (hypocenter) and its event time. The guess doesn't have to be super accurate - the locations are improved iteratively.
To write a gridsearch program, I computed the theoretical timing misfit for all boxes in a large volume. I made the mistake of assuming Cartesian coordinates instead of using distance calculations for spheres (weird, I know). Subsequently, I obtained misfit contours that looked a little off.
Given that RMS error (the misfit value) is a smooth convex function of distance, it was weird that some circles would look like they have extra error.
The reason had to do with floating point division and the difference between `round` and `int` - a postdoc in my group figured this out by looking at my data files that were used to interpolate between pre-computed travel times - some of the travel times were blank (default 0).
This was not my finest moment. This meant that for my travel time computations, I had some entries which weren't filled, messing up the interpolation, and giving odd looking contours in the colourmap above.
The first lesson was to perhaps pay attention to how floats are cast. The second lesson was about the importance of code review, which was a mostly alien concept to me. It has to do with the group culture, perhaps - the way they deal with technical debt and operational efficacy.



No comments:
Post a Comment