striplog.interval module#

Defines intervals for holding components.

copyright

2015 Agile Geoscience

license

Apache 2.0

class striplog.interval.Interval(top, base=None, description='', lexicon=None, data=None, components=None, max_component=1, abbreviations=False)#

Bases: object

Used to represent a lithologic or stratigraphic interval, or single point, such as a sample location.

Initialize with a top (and optional base) and a description and/or an ordered list of components.

Parameters
  • top (float) – Required top depth. Required.

  • base (float) – Base depth. Optional.

  • description (str) – Textual description.

  • lexicon (dict) – A lexicon. See documentation. Optional unless you only provide descriptions, because it’s needed to extract components.

  • max_component (int) – The number of components to extract. Default 1.

  • abbreviations (bool) – Whether to parse for abbreviations.

copy()#

Returns a shallow copy of the interval.

difference(other)#

Perform the difference binary operation.

Parameters

other (Interval) – The other Interval.

Returns

Interval. One or two Intervals.

intersect(other, blend=True)#

Perform the intersection binary operation. self must at least partially overlap with other or an IntervalError is raised.

If blend is False, you are essentially replacing self with other.

Parameters
  • other (Interval) – The other Interval.

  • blend (bool) – Whether to blend or not.

Returns

Interval. The intersection of the Interval with the one provided.

invert(copy=False)#

Inverts the interval. If it was depth-ordered (positive numbers increasing downwards.), it will now be elevation-ordered, and vice versa.

Parameters

copy (bool) – Whether to make a copy or not. Default: False.

property kind#

a ‘point’ (where base = top), or an ‘interval’, where thickness > 0.

Returns

Either ‘point’ or ‘interval’.

Return type

str

Type

The type of Interval

property max_thickness#

Returns the maximum possible thickness of the interval, given the uncertainty in its top and base Positions.

Returns

The maximum thickness.

Return type

Float

merge(other, blend=True)#

Perform the merge binary operation. self must at least partially overlap with other or an IntervalError is raised.

If blend is False, you are essentially replacing self with other.

Parameters
  • other (Interval) – The other Interval.

  • blend (bool) – Whether to blend or not.

Returns

Striplog. The merge of the Interval with the one provided.

property middle#

Returns the middle of the interval.

Returns

The middle.

Return type

Float

property min_thickness#

Returns the minimum possible thickness of the interval, given the uncertainty in its top and base Positions.

Returns

The minimum thickness.

Return type

Float

property order#

Gives the order of this interval, based on relative values of top & base.

property primary#

Convenience function returning the first component.

Returns

Component. The first one in the list of components.

relationship(other)#

Returns the relationship style. Completely deterministic.

spans(d)#

Determines if depth d is within this interval.

Parameters

d (float) – Level or ‘depth’ to evaluate.

Returns

bool. Whether the depth is in the interval.

split_at(d)#

Splits an interval.

Parameters

d (float) – Level or ‘depth’ to split at.

Returns

tuple. The two intervals that result from the split.

summary(fmt=None, initial=False)#

Returns a summary of the interval.

Parameters
  • fmt (str) – A format string. Optional.

  • initial (bool) – Whether to capitalize the first letter.

Returns

An English-language summary.

Return type

str

property thickness#

Returns the thickness of the interval.

Returns

The thickness.

Return type

Float

union(other, blend=True)#

Perform the union binary operation. self must at least touch other or an IntervalError is raised.

If blend is False, you are essentially replacing self with other.

Parameters
  • other (Interval) – The other Interval.

  • blend (bool) – Whether to blend or not.

Returns

Interval. The union of the Interval with the one provided.

exception striplog.interval.IntervalError#

Bases: Exception

Generic error class.