Stratigraphy functions¶
The package makes available functions relating to computing things based on stratigraphy.
The functions are defined in deltametrics.strat
.
Compute stratigraphy routines¶

Process txy data volume to boxy stratigraphy volume. 
Process txy data volume to boxy stratigraphy coordinates. 
Stratigraphy statistics functions¶
Show 1d profile at point. 


Compute compensation statistic betwen two lines. 
Quickstratigraphy attributes classes¶
The “quick” stratigraphy attributes provide a common API that is accessed by
DataCube, DataSectionVariable and DataPlanformVariable methods. There
are two methods of computing quick stratigraphy, with
MeshStratigraphyAttributes
as the default.

Attribute set for mesh stratigraphy information, emebdded into a DataCube. 
Attribute set for boxy stratigraphy information, emebdded into a DataCube. 


Lowlevel stratigraphy utility functions¶
The functions outlined in this section are the main functions that do the actual work of computing stratigraphy and preservation, throughout DeltaMetrics. These functions may be useful if you are trying to use parts of DeltaMetrics, but need to customize something for your own usecase.

deltametrics.strat.
_compute_elevation_to_preservation
(elev)¶ Compute the preserved elevations of stratigraphy.
Given elevation data alone, we can compute the preserved stratal surfaces. These surfaces depend on the timeseries of bed elevation at any spatial location. We determine preservation by marching backward in time, determining when was the most recent time that the bed elevation was equal to a given elevation.
This function is declared as private and not part of the public API, however some users may find it helpful. The function is heavily utlized internally. Function inputs and outputs are standard numpy ndarray, so that these functions can accept data from an arbitrary source.
 Parameters
elev (
ndarray
orxr.core.dataarray.DataArray
) – The txy volume of elevation data to determine stratigraphy. Returns
strata (
ndarray
) – A txy ndarry of stratal surface elevations.psvd (
ndarray
) – A txy boolean ndarry of whether a (t,x,y) point of instantaneous time is preserved in any of the final stratal surfaces. To determine whether time from a given timestep is preserved, usepsvd.nonzero()[0]  1
.

deltametrics.strat.
_compute_preservation_to_time_intervals
(psvd)¶ Compute the preserved timesteps.
The output from
_compute_elevation_to_preservation
records whether an instance of time, defined exactly at the data interval, is recorded in the stratigraphy (here, “recorded” does not include stasis). This differs from determining which timeintervals are preserved in the stratigraphy, because the deposits reflect the conditions between the save intervals.While this computation is simply an offsetbyone indexing (
psvd[1:, ...]
), the function is implemented explicitly and utilized internally for consistency.Note
True in the preserved timeinterval array does not necessarily indicate that an entire timestep was preserved, but rather that some portion of this timeinterval (up to the entire interval) is recorded.
 Parameters
psvd (
ndarray
) – Boolean ndarray indicating the preservation of instances of time. Time is expected to be the 0th axis. Returns
psvd_intervals – Boolean ndarray indicating the preservation of timeintervals, including partial intervals.
 Return type
ndarray

deltametrics.strat.
_compute_preservation_to_cube
(strata, z)¶ Compute the cubedata coordinates to strata coordinates.
Given elevation preservation data (e.g., data from
_compute_elevation_to_preservation
), compute the coordinate mapping from txy data to zxy preserved stratigraphy.While stratigraphy is timedependent, preservation at any spatial xy location is independent of any other location. Thus, the computation is vectorized to sweep through all “stratigraphic columns” simultaneously. The operation works by beginning at the highest elevation of the stratigraphic volume, and sweeping down though all elevations with an xy “plate”. The plate indicates whether sediments are preserved below the current iteration elevation, at each xy location.
Once the iteration elevation is less than the strata surface at any xy location, there will always be sediments preserved below it, at every elevation. We simply need to determine which time interval these sediments record. Then we store this time indicator into the sparse array.
So, in the end, coordinates in resultant boxy stratigraphy are linked to txy coordinates in the data source, by building a mapping that can be utilized repeatedly from a single stratigraphy computation.
This function is declared as private and not part of the public API, however some users may find it helpful. The function is heavily utlized internally. Function inputs and outputs are standard numpy ndarray, so that these functions can accept data from an arbitrary source.
 Parameters
strata (
ndarray
) – A txy ndarry of stratal surface elevations. Can be computed by_compute_elevation_to_preservation
.z – Vertical coordinates of stratigraphy. Note that z does not need to have regular intervals.
 Returns
strat_coords (
ndarray
) – An N x 3 array of zxy coordinates where information is preserved in the boxy stratigraphy. Rows in strat_coords correspond with rows in data_coords.data_coords (
ndarray
) – An N x 3 array of txy coordinates where information is to be extracted from the data array. Rows in data_coords correspond with rows in strat_coords.

deltametrics.strat.
_determine_strat_coordinates
(elev, z=None, dz=None, nz=None)¶ Return a valid Z array for stratigraphy based on inputs.
This helper function enables support for user specified dz, nz, or z in many functions. The logic for determining how to handle these mutually exclusive inputs is placed in this function, to ensure consistent behavior across all classes/methods internally.
Note
At least one of the optional parameters must be supplied. Precedence when multiple arguments are supplied is z, dz, nz.
 Parameters
elev (
ndarray
) – An uptothreedimensional array with timeseries of elevation values, where elevation is expected to along the zeroth axis.z (
ndarray
, optional) – Array of Z values to use, returned unchanged if supplied.dz (
float
, optional) – Interval in created Z array. Z array is created asnp.arange(np.min(elev), np.max(elev)+dz, step=dz)
.nz (
int
, optional) – Number of intervals in z. Z array is created asnp.linspace(np.min(elev), np.max(elev), num=nz, endpoint=True)
.