Running the step
Goal¶
Run otsu in the same Hatch environment used by the
practice notebook.
The notebook is stored at practice-labs/1-Application_Steps/otsu.ipynb.
Requirements¶
Install Python 3.12 or newer, Hatch, and Task. Run the normalized difference lab first to create norm_diff.tif.
See developer tooling for the available tasks.
Register the notebook kernel¶
From the checkout root, run:
Select Bash (otsu Hatch) in Jupyter or VS Code. This kernel uses the package's default Hatch environment. An ordinary Bash kernel can also activate that environment using the commands below. Run the workspace setup from inside the checkout so Git can locate its root.
Configure the workspace¶
export WORKSPACE="$(git rev-parse --show-toplevel)"
export RUNTIME=${WORKSPACE}/runs
mkdir -p "${RUNTIME}"
cd "${RUNTIME}"
Outputs are written to runs/ in the current checkout.
Activate the Hatch environment¶
cd "${WORKSPACE}/water-bodies/command-line-tools/otsu"
hatch env create default
source "$(hatch env find default)/bin/activate"
cd "${RUNTIME}"
which python
which otsu
otsu --help
Hatch installs the Python project and its dependencies; a separate pip install
cell is unnecessary. Activation keeps the console command available after changing
to the output directory.
Run the step¶
The output is an unsigned-byte mask containing 0 and 1. Nonfinite input pixels are marked as 0.
Expected outcome¶
The step adds these files under runs/:
Earlier steps' outputs remain available.
Finish the session¶
Keep the Hatch environment for subsequent runs. The pip-based scripts under
scripts/ remain an alternative for manual shell use.