Bathymetry Models¶
sensingpy.bathymetry.models provides satellite-derived bathymetry (SDB)
estimation functions and the LinearModel class for fitting depth models.
stumpf_pseudomodel¶
stumpf_pseudomodel
¶
Calculate Stumpf pseudomodel for satellite-derived bathymetry.
This function implements the ratio transform algorithm developed by Stumpf et al. (2003) for estimating water depth from multispectral imagery. The algorithm uses the ratio of logarithms of reflectance in blue and another band.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blue
|
ndarray
|
Blue band data to use as base reflectance |
required |
other
|
ndarray
|
Band such as green or red to compare with blue |
required |
n
|
float
|
Constant to prevent negative values in logarithm calculation, by default np.pi*1_000 |
pi * 1000
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Pseudomodel values representing linearized depth estimates |
Notes
The algorithm leverages the differential attenuation of light with depth between blue and other wavelengths.
References
Stumpf, R.P., Holderied, K., Sinclair, M. (2003). Determination of water depth with high-resolution satellite imagery over variable bottom types. Limnology and Oceanography, 48(1), 547-556. https://doi.org/10.4319/lo.2003.48.1_part_2.0547
Source code in sensingpy/bathymetry/models.py
multi_image_pseudomodel¶
multi_image_pseudomodel
¶
Apply multi-image composition method for improved bathymetry estimates.
This function implements the multi-image compositing method developed by Caballero & Stumpf (2020) for optimizing satellite-derived bathymetry from multiple scenes. It creates composite bathymetry models by selecting the maximum values from multiple pseudomodels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_greens
|
ndarray
|
List of green-band pseudomodels to compose |
required |
p_reds
|
ndarray
|
List of red-band pseudomodels to compose |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
Tuple containing: - np.ndarray: Maximum green pseudomodel values - np.ndarray: Maximum red pseudomodel values - np.ndarray: Index array identifying which image was selected at each pixel |
Notes
The multi-image approach helps overcome limitations from individual images such as sun glint, clouds, or varying water quality conditions.
References
Caballero, I., & Stumpf, R. P. (2020). Towards routine mapping of shallow bathymetry in environments with variable turbidity: Contribution of Sentinel-2A/B satellites mission. Remote Sensing, 12(3), 451. https://doi.org/10.3390/rs12030451
Source code in sensingpy/bathymetry/models.py
switching_model¶
switching_model
¶
switching_model(green_model: ndarray, red_model: ndarray, green_coef: float = 3.5, red_coef: float = 2) -> np.ndarray
Create a depth model by combining green and red models using a weighted approach.
This function implements the linear weighted model presented by Caballero & Stumpf (2020) that combines green and red models based on depth thresholds. It uses only the red model for shallow areas, only the green model for deeper areas, and a weighted combination for intermediate depths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
green_model
|
ndarray
|
Green band-based bathymetry model, generally better for deeper waters |
required |
red_model
|
ndarray
|
Red band-based bathymetry model, generally better for shallow waters |
required |
green_coef
|
float
|
Minimum threshold value where the green model starts to be used exclusively, by default 3.5 |
3.5
|
red_coef
|
float
|
Maximum threshold value where the red model is used exclusively, by default 2 |
2
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Combined bathymetry model with optimized depth estimates |
Notes
The switching approach leverages the strengths of different spectral bands: red bands perform better in shallow waters while green bands perform better in deeper waters. This method provides a smooth transition between the models.
References
Caballero, I., & Stumpf, R. P. (2020). Towards routine mapping of shallow bathymetry in environments with variable turbidity: Contribution of Sentinel-2A/B satellites mission. Remote Sensing, 12(3), 451. https://doi.org/10.3390/rs12030451
Source code in sensingpy/bathymetry/models.py
optical_deep_water_model¶
optical_deep_water_model
¶
optical_deep_water_model(model: ndarray, blue: ndarray, green: ndarray, vnir: ndarray) -> np.ndarray
Filter depth estimations based on optical properties of water.
This function applies optical water property-based filters to depth estimation models to improve accuracy. It filters out pixels based on reflectance thresholds for clear waters and an upper depth limit equation for turbid waters as described in peer-reviewed literature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ndarray
|
The initial depth estimation model output to be filtered |
required |
blue
|
ndarray
|
Blue band reflectance values, used for clear water filtering |
required |
green
|
ndarray
|
Green band reflectance values, used for clear water filtering |
required |
vnir
|
ndarray
|
Near-infrared band reflectance values, used for turbid water depth limit calculation |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Filtered depth model with invalid estimations set to NaN |
Notes
The function applies two filtering steps: 1. Clear water filtering: removes pixels with reflectance <= 0.003 in blue or green bands 2. Turbid water filtering: applies depth limitation based on NIR reflectance using the equation: Ymax = -0.251 * ln(NIR) + 0.8
References
Caballero I, Stumpf RP. Towards Routine Mapping of Shallow Bathymetry in Environments with Variable Turbidity: Contribution of Sentinel-2A/B Satellites Mission. Remote Sensing. 2020; 12(3):451. https://doi.org/10.3390/rs12030451
Source code in sensingpy/bathymetry/models.py
LinearModel¶
LinearModel
¶
Bases: object
Linear regression model for satellite-derived bathymetry.
This class implements a simple linear regression approach for converting bathymetric pseudomodels to actual depth values. It provides methods for fitting the model to known depth measurements and predicting depths from new pseudomodel values.
Attributes:
| Name | Type | Description |
|---|---|---|
slope |
float
|
Slope coefficient of the linear model |
intercept |
float
|
Y-intercept of the linear model |
r_square |
float
|
Coefficient of determination (R²) indicating goodness of fit |
Notes
Linear models are commonly used in satellite-derived bathymetry to establish the relationship between optical properties and actual water depths. This implementation uses scipy's linregress for the underlying calculations.
Functions¶
fit
¶
Fit linear regression model using pseudomodel and in-situ depth data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pseudomodel
|
ndarray
|
Predictor values (typically from ratio transform algorithms) |
required |
in_situ
|
ndarray
|
Target values (measured water depths) |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Returns the instance for method chaining |
Notes
This method calculates the linear relationship between pseudomodel values and actual water depths using ordinary least squares regression.
Source code in sensingpy/bathymetry/models.py
predict
¶
Predict depths using the fitted linear model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pseudomodel
|
ndarray
|
Predictor values to convert to depth estimates |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Predicted depth values |
Notes
Applies the linear transformation using stored slope and intercept values.
Source code in sensingpy/bathymetry/models.py
predict_and_evaluate
¶
Predict depths and evaluate model performance against in-situ measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pseudomodel
|
ndarray
|
Predictor values to convert to depth estimates |
required |
in_situ
|
ndarray
|
Reference depth values for validation |
required |
Returns:
| Type | Description |
|---|---|
ValidationSummary
|
Object containing various error metrics and validation statistics |
Notes
This convenience method combines prediction and validation in a single step.