bruges.models.panel module

bruges.models.panel.interpolate(*arrays, num=50, dists=None, kind='linear')[source]

Linear interpolation between 1D arrays of the same length.

Parameters:
  • arrays (ndarray) – The 1D arrays to interpolate. All must be the same length. You can use the reconcile() function to produce them.
  • num (int) – The number of steps to take, so will be the width (number of cols) of the output array.
  • dists (array-like) – A list or tuple or array of the distances (any units) between the arrays in the real world.
  • kind (str) – Will be passed to scipy.interpolate.interp1d, which does the lateral interpolation between samples.
Returns:

ndarray. The result, with num columns. The number of rows is the

same as the number of samples in the input arrays.

Example

>>> a = np.array([2, 6, 7, 7, 3])
>>> b = np.array([3, 7, 7, 3, 3])
>>> interp = interpolate(a, b, num=10)
>>> interp.shape
(5, 10)
bruges.models.panel.panel(*arrays, num=50, dists=None, order=0, kind='linear')[source]

Interpolate an arbitrary collection of 1D arrays.

Parameters:
  • num (int) – The number of steps to take, so will be the width (number of cols) of the output array.
  • dists (array-like) – The relative distances between the profiles in the array. Sum used to calculate the output width in pixels if the width argument is None. If not given, the distances are assumed to be equal.
  • order (int) – The order of the interpolation, passed to scipy.ndimage.zoom. Suggestion: 0 for integers and 1 for floats.
  • kind (str) – Will be passed to scipy.interpolate.interp1d, which does the lateral interpolation between samples.
Returns:

ndarray. The interpolated panel. Contains NaNs if sizes are

non-uniform.

bruges.models.panel.reconcile(*arrays, order=0)[source]

Make sure 1D arrays are the same length. If not, stretch them to match the longest.

Parameters:
  • arrays (ndarray) – The input arrays.
  • order (int) – The order of the interpolation, passed to scipy.ndimage.zoom. Suggestion: 0 for integers and 1 for floats.
Returns:

tuple of ndarrays. The reconciled arrays — all of them are now the

same length.

Example

>>> a = np.array([2, 6, 7, 7, 3])
>>> b = np.array([3, 7, 3])
>>> reconcile(a, b, order=0)
(array([2, 6, 7, 7, 3]), array([3, 7, 7, 3, 3]))
bruges.models.panel.unreconcile(arr, sizes, dists=None, order=0)[source]

Opposite of reconcile. Restores the various profiles (the reference arrays, e.g. wells) to their original lengths.

Parameters:
  • sizes (int) – The relative lengths of the profiles in the array. Default returns the input array.
  • dists (array-like) – The relative distances between the profiles in the array. Sum used to calculate the output width in pixels if the width argument is None. If not given, the distances are assumed to be equal.
  • order (int) – The order of the spline interpolation, from 0 to 3. The default is 0, which gives nearest neighbour interpolation. 1 gives linear interpolation, etc. Use 0 for ints and 1-3 for floats.
Returns:

ndarray. The resulting ndarray. The array contains NaNs where there

is no interpolated data.