Analysis¶
Summary¶
bathy.summary(data)
¶
Generate summary statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with statistics (count, mean, std, min, 25%, 50%, 75%, max) |
Source code in src/bathy/analysis.py
Hypsometry¶
bathy.hypsometric_index(data)
¶
Calculate the hypsometric index (HI).
HI = (mean - min) / (max - min)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
Returns:
| Type | Description |
|---|---|
float
|
Hypsometric index in [0, 1], or NaN for flat surfaces |
Examples:
Source code in src/bathy/analysis.py
bathy.hypsometric_curve(data, bins=100, absolute=False)
¶
Calculate the hypsometric curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data. |
required |
bins
|
int
|
Number of elevation bins. |
100
|
absolute
|
bool
|
If False, return normalised relative_area (0–1) and
relative_elevation (0–1). If True, return absolute
|
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
When absolute is False: columns |
Examples:
Absolute depth-area curve:
Source code in src/bathy/analysis.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
Volume & Area¶
bathy.volume(data, upper_level=0, lower_level=None)
¶
Calculate water volume between two depth levels.
Volume is computed as the sum of per-cell water columns multiplied by the planimetric cell area. Only cells whose elevation falls between lower_level and upper_level contribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data (negative = below sea level). |
required |
upper_level
|
float
|
Upper bounding elevation in metres. |
0
|
lower_level
|
float
|
Lower bounding elevation in metres. Defaults to the minimum elevation in data. |
None
|
Returns:
| Type | Description |
|---|---|
float
|
Volume in m³. |
Examples:
Source code in src/bathy/analysis.py
bathy.area(data, upper_level=0, lower_level=None, true_surface=False)
¶
Calculate seafloor area between two depth levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data (negative = below sea level). |
required |
upper_level
|
float
|
Upper bounding elevation in metres. |
0
|
lower_level
|
float
|
Lower bounding elevation in metres. Defaults to the minimum elevation in data. |
None
|
true_surface
|
bool
|
If True, compute true (slope-corrected) surface area rather than planimetric area. Each cell's area is divided by cos(slope). |
False
|
Returns:
| Type | Description |
|---|---|
float
|
Area in m². |
Examples:
Source code in src/bathy/analysis.py
Bathymetry¶
bathy.slope(data)
¶
Calculate seafloor slope in degrees.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
Returns:
| Type | Description |
|---|---|
DataArray
|
Slope magnitude in degrees |
Source code in src/bathy/analysis.py
bathy.curvature(data)
¶
Calculate seafloor curvature (Laplacian).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
Returns:
| Type | Description |
|---|---|
DataArray
|
Curvature values (positive = convex/ridges, negative = concave/valleys) |
Source code in src/bathy/analysis.py
bathy.aspect(data)
¶
Calculate seafloor aspect (downslope direction).
Aspect is the compass direction a slope faces, measured in degrees clockwise from north. This follows the standard GIS convention (ESRI, GDAL, GRASS). Flat areas are returned as NaN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
Returns:
| Type | Description |
|---|---|
DataArray
|
Aspect in degrees [0, 360), NaN where slope is zero |
Examples:
Source code in src/bathy/analysis.py
bathy.bpi(data, radius_km=1.0)
¶
Calculate Bathymetric Position Index (BPI).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
radius_km
|
float
|
Radius of the neighbourhood in kilometres (square window) |
1.0
|
Returns:
| Type | Description |
|---|---|
DataArray
|
BPI values (positive = ridges, negative = valleys) |
Examples:
Source code in src/bathy/analysis.py
bathy.rugosity(data, radius_km=1.0)
¶
Calculate Vector Ruggedness Measure (VRM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
radius_km
|
float
|
Radius of the neighbourhood in kilometres |
1.0
|
Returns:
| Type | Description |
|---|---|
DataArray
|
VRM values in range [0, 1] |
References
Sappington, J.M., Longshore, K.M., and Thompson, D.B. (2007). Quantifying landscape ruggedness for animal habitat analysis: a case study using bighorn sheep in the Mojave Desert. Journal of Wildlife Management, 71(5), 1419–1426.
Examples:
Source code in src/bathy/analysis.py
bathy.geomorphons(data, lookup_km=2.0, flatness_threshold=1.0)
¶
Classify seafloor morphology using geomorphons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
lookup_km
|
float
|
Lookup distance in kilometres. |
2.0
|
flatness_threshold
|
float
|
Angle threshold in degrees below which differences are treated as flat. |
1.0
|
Returns:
| Type | Description |
|---|---|
DataArray
|
Integer class codes (1–10): 1=flat, 2=peak, 3=ridge, 4=shoulder, 5=spur, 6=slope, 7=hollow, 8=footslope, 9=valley, 10=pit |
Notes
Each of the eight cardinal/diagonal directions is scanned from 1 cell
to lookup_km, recording the maximum and minimum elevation angles
along the full line of sight. A direction is classified as higher
when the maximum angle exceeds flatness_threshold and lower
when the minimum angle falls below it.
Cells within lookup_km of the grid edge receive fewer directional
comparisons and may be misclassified. Consider trimming edges for
critical analyses.
References
Jasiewicz, J., & Stepinski, T.F. (2013). Geomorphons — a pattern recognition approach to classification and mapping of landforms. Geomorphology, 182, 147–156.
Examples:
Source code in src/bathy/analysis.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
bathy.contours(data, levels=None, interval=None)
¶
Extract depth contour lines as vector geometries.
Provide levels for explicit contour values, interval for regular spacing, or neither to let matplotlib choose automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data. |
required |
levels
|
array - like
|
Explicit contour elevations (e.g. |
None
|
interval
|
float
|
Regular contour spacing in metres. Ignored when levels is given. |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Columns |
Raises:
| Type | Description |
|---|---|
ValueError
|
If interval is not positive. |
Examples:
Source code in src/bathy/analysis.py
bathy.smooth(data, sigma_km=1.0)
¶
Gaussian smooth a bathymetry grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data. |
required |
sigma_km
|
float
|
Gaussian kernel standard deviation in kilometres. |
1.0
|
Returns:
| Type | Description |
|---|---|
DataArray
|
Smoothed elevation grid (NaNs propagated). |
Examples: