striplog
striplog copied to clipboard
Make Intervals responsible for their own Patches
I'm working on this to allow for more flexibility in Interval shapes (multi-width Polygons, curved PathPatches) when plotting detailed graphic log / measured section data. This should also make it easy to clean up the Striplog.plot_axis method a bit. Any feedback is appreciated!
My idea at this point is to construct and return different kinds of patches based on type(self.data[width_field]):
-
Single numeric values create the standard
Rectanglepatch. -
Arrays or iterables create
Polygons orPathPatchs, depending on kwargs. If the array/iterable is 1D it's assumed to be evenly spaced samples betweenself.topandself.base. If it's a 2D array, then we take it to be an array of specific[depth, value]samples. -
Dictionaries also create
Polygons orPathPatchs depending on kwargs. The case I have in mind is a dataset where beds have atop_gs, abase_gs, and a (weighted)mean_gs. They have a typical "fining up" profile, so these values along with some curve kwargs can be used to fit a path through the top/base values such that interval has the correct weighted mean.
I would also add a Interval.max_field method that returns the appropriate value for whatever datatype is found, and then striplog.max_field would just be the maximum of [iv.max_field(field) for iv in self].
Actually I'm torn about whether I should accept 2D arrays at all, or whether those kinds of samples should have to be specified in a dict with e.g., depths and values keys.