bruges.transform package#

Submodules#

bruges.transform.coordinates module#

class bruges.transform.coordinates.CoordTransform(ix, xy)[source]#

Bases: object

A class for converting between seismic survey inline-xline coordinates and real-world UTM coordinates.

Instantiate with a pair of at least 3 coordinates mapping one space to the other. Provide two array-likes of shape (3, 2). See below for example.

After instantiation, the class is callable in the ‘forward’ (inline-xline to UTMx-UTMy) direction. You can also use CoordTransform.forwrd(). The CoordTransform.reverse() method converts in the other direction (UTMx-UTMy to inline-xline).

Example

>>> corner_ix = [[0,  0], [0, 950], [650, 950]]
>>> corner_xy = [[605835.5, 6073556.5],
                [629576.3, 6074220.0],
                [629122.5, 6090463.2]]
>>> transform = bruges.transform.CoordTransform(corner_ix, corner_xy)
>>> transform([300, 400])
array([ 615622.18016194, 6081332.72995951])
>>> transform.forward([300, 400])
array([ 615622.18016194, 6081332.72995951])
>>> transform.reverse([ 615622.18016194, 6081332.72995951])
​array([300, 400])
forward(p)[source]#

Convert inline-xline to UTMx-UTM-y.

Example

>>> transform.forward([300, 400])
array([ 615622.18016194, 6081332.72995951])
reverse(q)[source]#

Convert UTMx-UTM-y to inline-xline.

Example

>>> transform.reverse([ 615622.18016194, 6081332.72995951])

​ array([300, 400])

bruges.transform.cumavg module#

bruges.transform.cumavg.v_avg(v, depth=None, time=None)[source]#

Cumulative average of a velocity log. You must provide either a depth or a time basis for the log.

Parameters
  • v (ndarray) – The velocity log.

  • depth (ndarray) – The depth values corresponding to the log.

  • time (ndarray) – The time values corresponding to the log.

Returns

The V_avg log.

Return type

ndarray

bruges.transform.cumavg.v_bac(v, rho, depth)[source]#

Cumulative Backus average of a velocity log. You must provide either a depth or a time basis for the log.

For a non-cumulative version that can also provide sclaing for the V_s log, as well as quality factor, see bruges.anisotropy.backus.

Parameters
  • v (ndarray) – The velocity log.

  • rho (ndarray) – The density log.

  • depth (ndarray) – The depth values corresponding to the logs.

Returns

The V_bac log.

Return type

ndarray

bruges.transform.cumavg.v_rms(v, depth=None, time=None)[source]#

Cumulative RMS mean of a velocity log. You must provide either a depth or a time basis for the log.

Parameters
  • v (ndarray) – The velocity log.

  • depth (ndarray) – The depth values corresponding to the log.

  • time (ndarray) – The time values corresponding to the log.

Returns

The V_rms log.

Return type

ndarray

bruges.transform.nmo module#

bruges.transform.nmo.nmo_correction(cmp, dt, offsets, velocities)[source]#

Performs NMO correction on the given CMP.

The units must be consistent. E.g., if dt is seconds and offsets is meters, velocities must be m/s.

Parameters
  • cmp (ndarray) – The 2D array CMP gather that we want to correct.

  • dt (float) – The sampling interval.

  • offsets (ndarray) – A 1D array with the offset of each trace in the CMP.

  • velocities (ndarray) – A 1D array with the NMO velocity for each time. Should have the same number of elements as the CMP has samples.

Returns

The NMO corrected gather.

Return type

ndrray

bruges.transform.nmo.reflection_time(t0, x, vnmo)[source]#

Calculate the travel-time of a reflected wave. Doesn’t consider refractions or changes in velocity.

The units must be consistent. E.g., if t0 is seconds and x is metres, vnmo must be m/s.

Parameters
  • t0 (float) – The 0-offset (normal incidence) travel-time.

  • x (float) – The offset of the receiver.

  • vnmo (float) – The NMO velocity.

Returns

The reflection travel-time.

Return type

t (float)

bruges.transform.nmo.sample_trace(trace, time, dt)[source]#

Sample an amplitude at a given time using interpolation.

Parameters
  • trace (1D array) – Array containing the amplitudes of a single trace.

  • time (float) – The time at which I want to sample the amplitude.

  • dt (float) – The sampling interval.

Returns

The interpolated amplitude. Will be None if time is beyond the end of the trace or if there are fewer than two points between time and the end.

Return type

amplitude (float or None)

bruges.transform.timedepthconv module#

bruges.transform.timedepthconv.depth_to_time(data, vmodel, dz, dt, twt=True, mode='nearest', return_t=False)[source]#

Converts data from the depth domain to the time domain given a velocity model.

Parameters
  • data (ndarray) – The data to convert, will work with a 1 or 2D numpy numpy array. array(samples,traces).

  • vmodel (ndarray) – P-wave interval velocity model that corresponds to the data. Must be the same shape as data.

  • dz (float) – The sample interval of the input data [m].

  • dt (float) – The sample interval of the output data [s].

  • twt (bool) – Use twt travel time, defaults to true.

  • mode (str) – What kind of interpolation to use, defaults to ‘nearest’.

  • return_t (bool) – Whether to also return the new time basis.

Returns

The data resampled in the time domain.

bruges.transform.timedepthconv.time_to_depth(data, vmodel, dt, dz, twt=True, mode='nearest', return_z=False)[source]#

Converts data from the time domain to the depth domain given a velocity model.

Parameters
  • data (ndarray) – The data to convert, will work with a 1 or 2D numpy numpy array. array(samples,traces).

  • vmodel (ndarray) – P-wave interval velocity model that corresponds to the data. Must be the same shape as data.

  • dt (float) – The sample interval of the input data [s], or an array of times.

  • dz (float) – The sample interval of the output data [m], or an array of depths.

  • twt (bool) – Use twt travel time, defaults to true.

  • mode (str) – What kind of interpolation to use, defaults to ‘nearest’.

  • return_z (bool) – Whether to also return the new time basis.

Returns

ndarray: The data resampled in the depth domain.

Module contents#