litholog package
Subpackages
Submodules
litholog.bed module
- class litholog.bed.Bed(top, base, data, keys=None, **kwargs)[source]
Bases:
striplog.interval.IntervalRepresents an individual bed or layer.
Essentially a
striplog.Intervalwith some additional restrictions and logic.Beds are required to have a
top,base, anddata(which can be an array or dict-like).- as_patch(legend, width_field=None, depth_field=None, min_width=0.0, max_width=1.5, **kwargs)[source]
Representation of the
Bedas amatplotlib.patchesobject [PolygonorRectangle].- Parameters
legend (
striplog.Legend) – Legend to get a matchingstriplog.Decorfrom.width_field (str or int, optional) –
datakey orvaluescolumn index to use as width field.depth_field (str or int, optional) – Data key or
valuescolumn index to use as positions ofwidth_fieldsamples. If not provided andwidth_fieldvalues are iterable, created fromnp.linspace(top, base). Ignored ifwidth_fieldis a scalar. Sizes must match if both fields return iterables.
- Returns
patch
- Return type
instance from
matplotlib.patches
- compatible_with(other)[source]
Check that
self.dataandother.datahave compatiblevaluesshapes and matchingdatakey order.NOTE: Should both have to be constructed from similar dtypes, or just have concatable values?
- get_values(exclude_keys=[])[source]
Getter for
valuesthat allows droppingexclude_keys(e.g., sample depths) from array
- property lithology
Just shorthand.
- property nfeatures
The number of columns in
values.
- property nsamples
The number of sample rows in
values.
- resample_data(depth_key, step, kind='linear')[source]
Resample data to approximately
step, but preserving at least top/base samples.- Parameters
depth_key (str, int, or None) – Dict key or column index pointing to sample depths
step (float) – Depth step at which to (approximately) resample data values
kind (one of {‘linear’,’slinear’,’quadratic’,’cubic’,…}, optional) – Kind of interpolation to use, default=’linear’. See
scipy.intepolate.interp1ddocs.
- spans(d, eps=0.001)[source]
Determines if position
dis within thisBed. Overridden fromstriplog.Intervalto accomodate small toleranceeps- Parameters
d (float) – Position (depth or elevation) to evaluate.
- Returns
in_bed – True if
dis within theBed, False otherwise.- Return type
bool
- property values
litholog.defaults module
Define default striplog.Decor`s when using grainsize as the width field. Also specify default csv/DataFrame fields to map to `Bed attributes/data.
- litholog.defaults.gs2litho(gs, units='psi')[source]
Map grainsize value gs to striplog.Component.
If gs is None or np.nan, maps to ‘missing’ Component.
If units is ‘mm’ or ‘phi’, will convert to ‘psi’ first.
Psi is log2(gs_mm), so medium sand is -1 to -2. See more at https://en.wikipedia.org/wiki/Grain_size#/media/File:Wentworth_scale.png
litholog.utils module
Utility functions.
- litholog.utils.saferep(x, n)[source]
Repeat x to array of length n if it’s a literal, or check that len(x) == n if it’s iterable.
- litholog.utils.string2array_matlab(s)[source]
Parse matlab-style array string (e.g., “1.0, 2.0, 3.0”) to float array.
litholog.wentworth module
Utility functions for Wentworth/Krumbein logarithmic grainsize scale.
- See this link for a nice chart:
https://en.wikipedia.org/wiki/Grain_size#/media/File:Wentworth_scale.png
- litholog.wentworth.psi2name(psi, scale=[('colloid', - 10), ('clay', - 8), ('vf_silt', - 7), ('f_silt', - 6), ('m_silt', - 5), ('c_silt', - 4), ('vf_sand', - 3), ('f_sand', - 2), ('m_sand', - 1), ('c_sand', 0), ('vc_sand', 1), ('vf_gravel', 2), ('f_gravel', 3), ('m_gravel', 4), ('c_gravel', 5), ('vc_gravel', 6), ('cobble', 8), ('boulder', None)])[source]
Map single psi value to Wentworth bin name.