# Step-by-step NMO correction

02/02/2017
Abstract

Corresponding author: leouieda@gmail.com

This is a part of The Leading Edge “Geophysical Tutorials” series. You can read more about it in Hall (2016).

Open any textbook about seismic data processing and you will inevitably find a section about the normal moveout (NMO) correction. There you’ll see that we can correct the measured travel-time of a reflected wave $$t$$ at a given offset $$x$$ to obtain the travel-time at normal incidence $$t_{0}$$ by applying the following equation

$$\label{eq:traveltime} \label{eq:traveltime}t_{0}^{2}=t^{2}-\dfrac{x^{2}}{v_{\mathrm{NMO}}^{2}}\\$$

in which $$v_{\mathrm{NMO}}$$ is the NMO velocity. There are variants of this equation with different degrees of accuracy, but we’ll use this one for simplicity.

When applied to a common midpoint (CMP) section, the equation above is supposed to turn the hyperbola associated with a reflection into a straight horizontal line. What most textbooks won’t tell you is how, exactly, do you apply this equation to the data?

Read on and I’ll explain step-by-step how the algorithm for NMO correction from Yilmaz (2001) works and how to implement it in Python. The accompanying Jupyter notebook (Perez et al., 2007) contains the full source code, with documentation and tests for each function. You can download the notebook at github.com/seg or github.com/pinga-lab/nmo-tutorial.

## What the equation doesn’t tell us

Equation \ref{eq:traveltime} relates travel-times: the one we can measure ($$t$$) and the one we want to know ($$t_{0}$$). But the data in our CMP gather are actually a matrix of amplitudes measured as a function of time ($$t$$) and offset. Our NMO corrected gather will also be a matrix of amplitudes as a function of time ($$t_{0}$$) and offset. So what we really have to do transform one matrix of amplitudes into the other. But the equation has no amplitudes!

This is a major divide between the formula we’ve all seen before and what actually goes on in the software that implements it. You have probably never thought about it – I certainly hadn’t – so let’s bridge this divide. Next, I’ll explain an algorithm that maps the amplitudes in the CMP to amplitudes in an NMO corrected gather.

## Doing it backwards

It’s surprisingly difficult to find a description of a method for calculating the amplitudes in the NMO correction. The only one I could find is a single paragraph in the book by Yilmaz (2001) (available on the SEG Wiki at wiki.seg.org/wiki/NMO_for_a_flat_reflector):

“The idea is to find the amplitude value at A’ on the NMO-corrected gather from the amplitude value at A on the original CMP gather. Given quantities $$t_{0}$$, $$x$$, and $$v_{\mathrm{NMO}}$$, compute $$t$$ from equation (1). […] The amplitude value at this time can be computed using the amplitudes at the neighboring integer sample values […] This is done by an interpolation scheme that involves the four samples.”

This paragraph is telling us to do the calculation backwards. Instead of mapping where each point in the CMP goes in the NMO corrected gather, we should map where each point in the NMO gather comes from in the CMP. Figure 1 shows a sketch of the procedure to calculate the amplitude of a point ($$t_{0}$$, $$x$$) in the NMO gather.

Here is the full algorithm:

1. 1.

2. 2.

For each point ($$t_{0},x$$) in the NMO gather, do:

1. (a)

Calculate the reflection travel-time ($$t$$) given $$v_{\mathrm{NMO}}$$ using the equation in Figure 1.

2. (b)

Go to the trace at offset $$x$$ in the CMP and find the two samples before and the two samples after time $$t$$.

3. (c)

If $$t$$ is greater than the recording time or if it doesn’t have two samples after it, skip the next two steps.

4. (d)

Use the amplitude in these four samples to interpolate the amplitude at time $$t$$.

5. (e)

Copy the interpolated amplitude to the NMO gather at ($$t_{0},x$$).

At the end of this algorithm, we will have a fully populated NMO gather with the amplitudes sampled from the CMP. Notice that we didn’t actually use the equation for $$t_{0}$$. Instead we calculate the reflection travel-time ($$t$$). Good luck guessing that from the equation alone.

Figure 1: Sketch of the algorithm for a single trace and $$t_{0}$$. To the left is a trace from the CMP and to the right the corresponding trace from the NMO corrected gather. The green square in the NMO is the amplitude at $$t_{0}$$ that we want to calculate. We apply the equation to find time $$t$$ in the CMP, then interpolate the amplitude using the four samples around $$t$$ (orange rectangles). This amplitude is then copied over to the NMO.

## The code for NMO

Now I’ll show how to implement the above algorithm in Python using the NumPy and SciPy libraries (Walt et al., 2011). We’ll split the algorithm into three functions. This is very important when programming any moderately complex code because it allows us to test each part of our code independently. It also reduces the amount of code we have to search through to find that bug that is messing up our results. Modular code is easier to understand and to reuse.

The first function I’ll define performs the NMO correction on a given CMP gather. We’ll assume that the CMP gather is a 2D array of amplitudes and that the velocities are a 1D array with $$v_{\mathrm{NMO}}$$ for each time sample.

import numpy as np
def nmo_correction(cmp, dt, offsets, velocities):
nmo = np.zeros_like(cmp)
nsamples = cmp.shape[0]
times = np.arange(0, nsamples*dt, dt)
for i, t0 in enumerate(times):
for j, x in enumerate(offsets):
t = reflection_time(t0, x, velocities[i])
amplitude = sample_trace(cmp[:, j], t, dt)
if amplitude is not None:
nmo[i, j] = amplitude
return nmo

This function is essentially the algorithm above translated to Python with some of the details pushed into the reflection_time and sample_trace functions, which we will define below.

First, the function that calculates the reflection travel-time:

def reflection_time(t0, x, vnmo):
t = np.sqrt(t0**2 + x**2/vnmo**2)
return t

For the sample_trace function, we’ll use cubic splines from the scipy.interpolate package. For more information on interpolation with scipy, see the tutorial by Hall (2016).

from scipy.interpolate import CubicSpline
def sample_trace(trace, time, dt):
before = int(np.floor(time/dt))
N = trace.size
samples = np.arange(before - 1, before + 3)
if any(samples < 0) or any(samples >= N):
amplitude = None
else:
times = dt*samples
amps = trace[samples]
interpolator = CubicSpline(times, amps)
amplitude = interpolator(time)
return amplitude

The Jupyter notebook contains the full code for these functions, including documentation through Python documentation strings or “docstrings” and code that tests that the functions work as expected. Also included is an application of our nmo_correction function to a synthetic CMP (Figure 2).

Figure 2: (Left) The $$v_{\mathrm{NMO}}$$ profile passed to nmo_correction. The profile was interpolated on a line using the two picked velocities (black squares). (Middle) A synthetic CMP gather. (Right) The output from our nmo_correction function.

## Acknowledgments

My sincerest thanks to Evan Bianco, Gregorio Kawakami, Jesper Dramsch, and Matt Hall for comments and suggestions and to Öz Yilmaz for generously making the full text of the “Seismic Data Analysis” book available for free and in the open.

### References

1. Matt Hall. A user guide to the geophysical tutorials. The Leading Edge 35, 190–191 Society of Exploration Geophysicists, 2016. Link

2. Matt Hall. Geophysical Tutorial: The function of interpolation. The Leading Edge 35, 367–369 Society of Exploration Geophysicists, 2016. Link

3. Fernando Perez, Brian E. Granger. IPython: A System for Interactive Scientific Computing. Computing in Science & Engineering 9, 21–29 Institute of Electrical and Electronics Engineers (IEEE), 2007. Link

4. Ste'fan van der Walt, S Chris Colbert, Gaël Varoquaux. The NumPy Array: A Structure for Efficient Numerical Computation. Computing in Science & Engineering 13, 22–30 Institute of Electrical and Electronics Engineers (IEEE), 2011. Link

5. Öz Yilmaz. Seismic Data Analysis. Society of Exploration Geophysicists, 2001. Link