geost.accessor.GeostFrame.calculate_gradient#
- GeostFrame.calculate_gradient(column: str, use_mid_depth: bool = True) Series[source]#
Calculate the rate of change (i.e. “gradient”) over depth of a value column per survey.
The gradient is computed as the difference between consecutive rows of column, divided by the difference between the corresponding depths. The first row of each survey has no preceding row and is therefore set to 0.0.
- Parameters:
column (str) – Name of the numeric column for which to calculate the gradient.
use_mid_depth (bool, optional) – If True, the gradient is calculated over the mid depth of each interval. If False, the bottom depth of each interval is used. By default True.
- Returns:
The gradient (change in column per unit of depth), with the same index as the original object.
- Return type:
pd.Series
- Raises:
TypeError – If column is not of a numeric dtype.
Notes
This method assumes that the rows are sorted by survey and ascending depth.
Examples
>>> result = df.survey.calculate_gradient("value") >>> result = df.survey.calculate_gradient("value", use_mid_depth=False)