### Install whitebox from source with setup.py Source: https://whitebox.readthedocs.io/en/latest/installation.html Once you have a copy of the source, run this command to install whitebox using Python's setup.py script. ```console $ python setup.py install ``` -------------------------------- ### Launch WhiteboxTools Runner GUI Source: https://whitebox.readthedocs.io/en/latest/readme.html Starts the WhiteboxTools Runner graphical user interface. Requires the whitebox package to be installed. The Runner() function opens the GUI window. ```python import whitebox whitebox.Runner() ``` -------------------------------- ### Install whitebox with pip Source: https://whitebox.readthedocs.io/en/latest/installation.html Run this command in your terminal to install the most recent stable release of whitebox. This is the preferred installation method. ```console $ pip install whitebox ``` -------------------------------- ### Full whitebox example workflow Source: https://whitebox.readthedocs.io/en/latest/usage.html Example that imports required modules, creates a WhiteboxTools instance, prints version and help, sets the working directory to the package's sample data, and runs feature_preserving_denoise, breach_depressions, and d_inf_flow_accumulation tools. ```python import os import pkg_resources import whitebox wbt = whitebox.WhiteboxTools() print(wbt.version()) print(wbt.help()) # identify the sample data directory of the package data_dir = os.path.dirname(pkg_resources.resource_filename("whitebox", 'testdata/')) wbt.set_working_dir(data_dir) wbt.verbose = False wbt.feature_preserving_denoise("DEM.tif", "smoothed.tif", filter=9) wbt.breach_depressions("smoothed.tif", "breached.tif") wbt.d_inf_flow_accumulation("breached.tif", "flow_accum.tif") ``` -------------------------------- ### Set up local development environment Source: https://whitebox.readthedocs.io/en/latest/contributing.html Creates a virtual environment, enters the project directory, and installs the package in development mode. Requires virtualenvwrapper. ```bash $ mkvirtualenv whitebox $ cd whitebox/ $ python setup.py develop ``` -------------------------------- ### Install whitebox in a conda environment Source: https://whitebox.readthedocs.io/en/latest/readme.html Creates a conda virtual environment named 'wbt' with Python, activates it, and installs whitebox from conda-forge. Recommended for testing the package. ```bash conda create -n wbt python source activate wbt conda install whitebox -c conda-forge ``` -------------------------------- ### Install whitebox with pip Source: https://whitebox.readthedocs.io/en/latest/readme.html Installs the whitebox Python package. Requires Python 3.x; Python 2.x is not supported. ```bash pip install whitebox ``` -------------------------------- ### Quick example using whitebox tools Source: https://whitebox.readthedocs.io/en/latest/readme.html Quick example showing how to use the whitebox Python package. Tool names can be called using snake_case or CamelCase (e.g., lidar_info or LidarInfo). This script prints version and help, sets the working directory to the package's sample data, and runs feature_preserving_smoothing, breach_depressions, and d_inf_flow_accumulation on DEM.tif. ```python import os import pkg_resources import whitebox wbt = whitebox.WhiteboxTools() print(wbt.version()) print(wbt.help()) # identify the sample data directory of the package data_dir = os.path.dirname(pkg_resources.resource_filename("whitebox", 'testdata/')) wbt.set_working_dir(data_dir) wbt.verbose = False wbt.feature_preserving_smoothing("DEM.tif", "smoothed.tif", filter=9) wbt.breach_depressions("smoothed.tif", "breached.tif") wbt.d_inf_flow_accumulation("breached.tif", "flow_accum.tif") ``` -------------------------------- ### Run linting and tests Source: https://whitebox.readthedocs.io/en/latest/contributing.html Runs linting with flake8, executes the test suite, and tests against multiple Python versions with tox. Install flake8 and tox via pip. ```bash $ flake8 whitebox tests $ python setup.py test or py.test $ tox ``` -------------------------------- ### Download MUSL WhiteboxTools for GLIBC errors Source: https://whitebox.readthedocs.io/en/latest/readme.html Downloads the MUSL version of WhiteboxTools to resolve GLIBC errors on Linux. Use this when the standard installation fails with GLIBC errors. ```python import whitebox whitebox.download_wbt(linux_musl=True, reset=True) ``` -------------------------------- ### Upgrade whitebox with pip -U Source: https://whitebox.readthedocs.io/en/latest/readme.html Upgrades an existing whitebox installation to the latest version. ```bash pip install whitebox -U ``` -------------------------------- ### Set WBT_LINUX environment variable to MUSL Source: https://whitebox.readthedocs.io/en/latest/readme.html Sets the WBT_LINUX environment variable to MUSL before installing whitebox, which automatically downloads the MUSL version of WhiteboxTools. ```python import os os.environ["WBT_LINUX"] = "MUSL" ``` -------------------------------- ### Deploy with bumpversion Source: https://whitebox.readthedocs.io/en/latest/contributing.html Bumps the version (patch, minor, or major), pushes the commit, and pushes tags. Travis deploys to PyPI if tests pass. ```bash $ bumpversion patch # possible: major / minor / patch $ git push $ git push --tags ``` -------------------------------- ### Import whitebox package Source: https://whitebox.readthedocs.io/en/latest/usage.html Minimal import statement to use whitebox in a project. ```python import whitebox ``` -------------------------------- ### Download the whitebox source tarball Source: https://whitebox.readthedocs.io/en/latest/installation.html Downloads the source tarball from GitHub using curl with the master branch. ```console $ curl -OL https://github.com/opengeos/whitebox/tarball/master ``` -------------------------------- ### Create a feature branch Source: https://whitebox.readthedocs.io/en/latest/contributing.html Creates and switches to a new branch for your changes. Replace the branch name with a descriptive name for your bugfix or feature. ```bash $ git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Clone the whitebox repository Source: https://whitebox.readthedocs.io/en/latest/contributing.html Clones the forked whitebox repository to your local machine. Replace your_name_here with your GitHub username. ```bash $ git clone git@github.com:your_name_here/whitebox.git ``` -------------------------------- ### Commit and push changes Source: https://whitebox.readthedocs.io/en/latest/contributing.html Stages all changes, commits them with a descriptive message, and pushes the branch to GitHub. ```bash $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature ``` -------------------------------- ### Run a subset of tests Source: https://whitebox.readthedocs.io/en/latest/contributing.html Runs a subset of tests using Python's unittest module. Replace tests.test_whitebox with the specific test module. ```bash $ python -m unittest tests.test_whitebox ``` -------------------------------- ### Clone the whitebox GitHub repository Source: https://whitebox.readthedocs.io/en/latest/installation.html Clones the public repository from GitHub to obtain the source code for whitebox. ```console $ git clone git://github.com/opengeos/whitebox ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.