xrspatial.erosion.erode#
- xrspatial.erosion.erode(agg, iterations=50000, seed=42, params=None)[source]#
Apply particle-based hydraulic erosion to a terrain DataArray.
Erosion is a global operation that cannot be chunked, so dask arrays are materialized before processing and re-wrapped afterwards.
- Parameters:
agg (xr.DataArray) – 2D terrain heightmap.
iterations (int) – Number of water droplets to simulate. Capped at
_MAX_ITERATIONS(1e8) to keep host and device allocations bounded.seed (int) – Random seed for droplet placement.
params (dict, optional) – Override default erosion constants. Keys: inertia, capacity, deposition, erosion, evaporation, gravity, min_slope, radius, max_lifetime.
radiusis capped at_MAX_RADIUS(1024) andmax_lifetimeat_MAX_LIFETIME(1e5).
- Returns:
Eroded terrain.
- Return type:
xr.DataArray
- Raises:
ValueError – If iterations, params[‘radius’], or params[‘max_lifetime’] is outside the allowed range.
MemoryError – If the projected working set exceeds available memory.