Loading...
Loading...
Compare original and translation side by side
from landlab import RasterModelGrid
from landlab.components import FlowAccumulator, StreamPowerEroder
import numpy as npfrom landlab import RasterModelGrid
from landlab.components import FlowAccumulator, StreamPowerEroder
import numpy as npundefinedundefined| Grid | Use Case |
|---|---|
| Regular rectangular grids (most common) |
| Hexagonal grids (isotropic flow) |
| Irregular point distributions |
| Channel networks only |
| 网格类型 | 适用场景 |
|---|---|
| 规则矩形网格(最常用) |
| 六边形网格(各向同性水流) |
| 不规则点分布网格 |
| 仅适用于河道网络 |
undefinedundefinedundefinedundefinedfrom landlab.components import FlowAccumulator
fa = FlowAccumulator(grid, flow_director='D8') # or 'Steepest', 'MFD'
fa.run_one_step()
drainage_area = grid.at_node['drainage_area']from landlab.components import FlowAccumulator
fa = FlowAccumulator(grid, flow_director='D8') # or 'Steepest', 'MFD'
fa.run_one_step()
drainage_area = grid.at_node['drainage_area']from landlab.components import StreamPowerEroder
sp = StreamPowerEroder(grid, K_sp=1e-5, m_sp=0.5, n_sp=1.0)
sp.run_one_step(dt=1000) # dt in yearsfrom landlab.components import StreamPowerEroder
sp = StreamPowerEroder(grid, K_sp=1e-5, m_sp=0.5, n_sp=1.0)
sp.run_one_step(dt=1000) # dt in yearsfrom landlab.components import LinearDiffuser
ld = LinearDiffuser(grid, linear_diffusivity=0.01) # m^2/yr
ld.run_one_step(dt=100)from landlab.components import LinearDiffuser
ld = LinearDiffuser(grid, linear_diffusivity=0.01) # m^2/yr
ld.run_one_step(dt=100)from landlab.io import read_esri_ascii, write_esri_ascii
from landlab.io.netcdf import read_netcdf, write_netcdf
grid, z = read_esri_ascii('dem.asc', name='topographic__elevation')
write_esri_ascii('output.asc', grid, names='topographic__elevation')
write_netcdf('output.nc', grid) # Save all fieldsfrom landlab.io import read_esri_ascii, write_esri_ascii
from landlab.io.netcdf import read_netcdf, write_netcdf
grid, z = read_esri_ascii('dem.asc', name='topographic__elevation')
write_esri_ascii('output.asc', grid, names='topographic__elevation')
write_netcdf('output.nc', grid) # Save all fieldsfrom landlab import RasterModelGrid
from landlab.components import FlowAccumulator, StreamPowerEroder, LinearDiffuser
grid = RasterModelGrid((100, 100), xy_spacing=100.0)
z = grid.add_zeros('topographic__elevation', at='node')
z += grid.node_y / 1000 + np.random.rand(grid.number_of_nodes) * 0.1
grid.set_closed_boundaries_at_grid_edges(True, True, True, False)
fa = FlowAccumulator(grid, flow_director='D8')
sp = StreamPowerEroder(grid, K_sp=1e-5)
ld = LinearDiffuser(grid, linear_diffusivity=0.01)
dt, uplift_rate = 1000, 0.001
for _ in range(500):
fa.run_one_step()
sp.run_one_step(dt)
ld.run_one_step(dt)
z[grid.core_nodes] += uplift_rate * dtfrom landlab import RasterModelGrid
from landlab.components import FlowAccumulator, StreamPowerEroder, LinearDiffuser
grid = RasterModelGrid((100, 100), xy_spacing=100.0)
z = grid.add_zeros('topographic__elevation', at='node')
z += grid.node_y / 1000 + np.random.rand(grid.number_of_nodes) * 0.1
grid.set_closed_boundaries_at_grid_edges(True, True, True, False)
fa = FlowAccumulator(grid, flow_director='D8')
sp = StreamPowerEroder(grid, K_sp=1e-5)
ld = LinearDiffuser(grid, linear_diffusivity=0.01)
dt, uplift_rate = 1000, 0.001
for _ in range(500):
fa.run_one_step()
sp.run_one_step(dt)
ld.run_one_step(dt)
z[grid.core_nodes] += uplift_rate * dt| Use Case | Tool | Why |
|---|---|---|
| Landscape evolution modelling | Landlab | Modular components, Python-native |
| Basin-scale stratigraphy | Badlands | Focus on sediment deposition and basin fill |
| Topographic analysis (MATLAB) | TopoToolbox | Mature MATLAB toolkit for DEM analysis |
| Simple diffusion/erosion | Custom numpy | Fewer dependencies for basic models |
| Coupled surface-subsurface | Landlab | Components for hydrology + geomorphology |
| Channel network extraction | Landlab or pysheds | Both handle flow routing well |
| Soil production and transport | Landlab | Dedicated weathering and soil components |
| Teaching geomorphology | Landlab | Clear component API, good tutorials |
| 适用场景 | 工具 | 原因 |
|---|---|---|
| 地形演化建模 | Landlab | 模块化组件,原生支持Python |
| 盆地尺度地层学 | Badlands | 专注于沉积物沉积与盆地填充 |
| 地形分析(MATLAB) | TopoToolbox | 成熟的MATLAB地形分析工具包 |
| 简单扩散/侵蚀模拟 | 自定义numpy实现 | 基础模型依赖更少 |
| 地表-地下耦合模拟 | Landlab | 包含水文与地貌学组件 |
| 河道网络提取 | Landlab 或 pysheds | 两者均能很好处理水流路径模拟 |
| 土壤生成与搬运 | Landlab | 有专门的风化与土壤组件 |
| 地貌学教学 | Landlab | 组件API清晰,教程完善 |
RasterModelGridtopographic__elevationFlowAccumulatorStreamPowerEroderLinearDiffuserdtwrite_netcdf()write_esri_ascii()grid.imshow()RasterModelGridtopographic__elevationFlowAccumulatorStreamPowerEroderLinearDiffuserdtwrite_netcdf()write_esri_ascii()grid.imshow()| Issue | Solution |
|---|---|
| Flat areas block flow | Add small random noise to initial topography |
| Boundary effects | Ensure at least one open boundary edge for drainage |
| Unstable erosion | Reduce |
| Wrong field name | Use exact Landlab names: |
| Memory with large grids | Reduce grid resolution or use |
| 问题 | 解决方案 |
|---|---|
| 平坦区域阻塞水流 | 为初始地形添加少量随机噪声 |
| 边界效应 | 确保至少有一个开放边界用于排水 |
| 侵蚀模拟不稳定 | 减小 |
| 字段名称错误 | 使用Landlab规定的准确名称: |
| 大型网格内存不足 | 降低网格分辨率,或针对河道使用 |