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)
¶
Calculate the hypsometric curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataArray
|
Elevation data |
required |
bins
|
int
|
Number of elevation bins |
100
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns |
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
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 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 | |
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: