Whitebox
Using WhiteboxTools with ipyleaflet
- WhiteboxTools: https://github.com/jblindsay/whitebox-tools
- WhiteboxTools frontends:
whiteboxgui¶
In [ ]:
import whiteboxgui
In [ ]:
whiteboxgui.show()
In [ ]:
whiteboxgui.show(tree=True)
whitebox¶
In [ ]:
import os
import pkg_resources
import whitebox
In [ ]:
wbt = whitebox.WhiteboxTools()
print(wbt.version())
In [ ]:
print(wbt.help())
In [ ]:
data_dir = os.path.dirname(pkg_resources.resource_filename("whitebox", 'testdata/'))
print(data_dir)
In [ ]:
in_dem = os.path.join(data_dir, "DEM.tif")
In [ ]:
work_dir = os.path.expanduser('~/Downloads')
if not os.path.exists(work_dir):
os.makedirs(work_dir)
In [ ]:
wbt.set_working_dir(work_dir)
wbt.verbose = True
In [ ]:
wbt.feature_preserving_smoothing(in_dem, "smoothed.tif", filter=9)
In [ ]:
wbt.breach_depressions("smoothed.tif", "breached.tif")
In [ ]:
wbt.d_inf_flow_accumulation("breached.tif", "flow_accum.tif")
Using whitebox with ipyleaflet¶
In [ ]:
import nclpy
import whiteboxgui.whiteboxgui as wbt
from ipyleaflet import WidgetControl
In [ ]:
m = nclpy.Map()
m
In [ ]:
tools_dict = wbt.get_wbt_dict()
wbt_toolbox = wbt.build_toolbox(
tools_dict, max_width="800px", max_height="500px"
)
wbt_control = WidgetControl(
widget=wbt_toolbox, position="bottomright"
)
m.add_control(wbt_control)
Last update: 2021-05-03