bruges.models package#
Submodules#
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.
bruges.models.polarity module#
bruges.models.wedge module#
- bruges.models.wedge.get_conforming(strat, thickness, conformance)[source]#
Function to deal with top and bottom conforming wedges.
- bruges.models.wedge.get_strat(strat, thickness, kind='nearest', position=1, wedge=None, zoom_mode='nearest')[source]#
Take a ‘stratigraphy’ (either an int, a tuple of ints, or a list-like of floats) and expand or compress it to the required thickness.
kind can be ‘nearest’, ‘linear’, ‘quadratic’, or ‘cubic’.
- bruges.models.wedge.get_subwedges(target, breadth)[source]#
For a binary target (the reference trace of a wedge), create the range of net:gross subwedges. We do this with binary morphologies in the following way:
Erode the ‘secondary’ component (whatever appears second in the target array) one step at a time, until there is nothing left and the resulting trace contains only the primary.
Dilate the secondary component until there is nothing left of the primary and the resulting trace contains only the secondary.
Arrange the traces in order, starting with all primary, and ending in all secondary. The target trace will be somewhere in between, but not necessarily in the middle.
Returns a 2D array with one target wedge trace per section.
- Parameters
target (array) – A 1D array length N, the ‘reference’ trace for the wedge. The reference trace has thickness ‘1’ in the wedge model. This trace must be ‘binary’ — i.e. it must contain exactly 2 unique values.
breadth (int) – How many new reference traces should be in the output.
- Returns
- tuple (ndarray, ndarray, int). The ndarray has shape
N x breadth. It represents one target wedge trace per section in ‘breadth’. The integer is the position of the target trace in the ndarray’s second dimension.
- bruges.models.wedge.pad_func(before, after)[source]#
Padding function. Operates on vector in place, per the np.pad documentation.
- bruges.models.wedge.wedge(depth=(30, 40, 30), width=(10, 80, 10), breadth=None, strat=(0, 1, 2), thickness=(0.0, 1.0), mode='linear', conformance='both')[source]#
Generate a wedge model.
- Parameters
depth (int or tuple) – The vertical size of the model. If a 3-tuple, then each element corresponds to a layer. If an integer, then each layer of the model will be 1/3 of the thickness. Note that if the ‘right’ wedge thickness is more than 1, then the total thickness will be greater than this value.
width (int or tuple) – The width of the model. If a 3-tuple, then each element corresponds to a ‘zone’ (left, middle, right). If an integer, then the zones will be 10%, 80% and 10% of the width, respectively.
breadth (None or int) – Not implemented. Raises an error.
strat (tuple) – Stratigraphy above, in, and below the wedge. This is the ‘reference’ stratigraphy. If you give integers, you get ‘solid’ layers containing those numbers. If you give arrays, you will get layers of those arrays, expanded or squeezed into the layer thicknesses implied in depth.
thickness (tuple) – The wedge thickness on the left and on the right. Default is (0.0, 1.0) so the wedge will be thickness 0 on the left and the wedge thickness specified in the depth argument on the right. If the thickness are equal, you’ll have a flat, layer-cake model.
mode (str or function) – What kind of interpolation to use. Default: ‘linear’. Other options are ‘sigmoid’, which makes a clinoform-like body, ‘root’, which makes a steep-sided bowl shape like the edge of a channel, and ‘power’, which makes a less steep-sided bowl shape. If you pass a function, give it an API like np.linspace: f(start, stop, num), where start is the left thickness, stop is the right thickness, and num is the width of the middle (wedge) ‘zone’.
conformance (str) – ‘top’, ‘bottom’, or ‘both’ (the default). How you want the layers inside the wedge to behave. For top and bottom conformance, if the layer needs to be thicker than the reference.
- Returns
- A tuple containing the
2D wedge model, the top ‘horizon’, the base ‘horizon’, and the position at which the wedge has thickness 1 (i.e. is the thickness specfied by the middle layer depth and/or strat).
- Return type
namedtuple[ndarray, ndarray, ndarray, int]