Water bodies detection¶
In [1]:
Copied!
from pathlib import Path
import sys
repo_root = next(
path for path in [Path.cwd(), *Path.cwd().parents]
if (path / "cwl-workflow/app-water-bodies.cwl").is_file()
)
sys.path.insert(0, str(repo_root / "docs"))
from helpers import WorkflowViewer
import cwl_loader
cwl_loader.logger.remove()
cwl_loader.logger.add(sys.stderr, level="INFO")
from pathlib import Path
import sys
repo_root = next(
path for path in [Path.cwd(), *Path.cwd().parents]
if (path / "cwl-workflow/app-water-bodies.cwl").is_file()
)
sys.path.insert(0, str(repo_root / "docs"))
from helpers import WorkflowViewer
import cwl_loader
cwl_loader.logger.remove()
cwl_loader.logger.add(sys.stderr, level="INFO")
Out[1]:
1
Plot the Application Paca
In [2]:
Copied!
wf = WorkflowViewer.from_file(
str(repo_root / "cwl-workflow/app-water-bodies.cwl"),
entrypoint="detect_water_body",
)
wf = WorkflowViewer.from_file(
str(repo_root / "cwl-workflow/app-water-bodies.cwl"),
entrypoint="detect_water_body",
)
In [3]:
Copied!
wf.display_components_diagram(entrypoint="detect_water_body")
wf.display_components_diagram(entrypoint="detect_water_body")
Inputs¶
In [4]:
Copied!
wf.display_inputs()
wf.display_inputs()
| Id | Type | Label | Doc |
|---|---|---|---|
aoi |
string |
Area of interest | area of interest as a bounding box |
epsg |
string |
EPSG code | EPSG code |
bands |
string[] |
Input bands | bands used for the NDWI |
item |
string |
STAC item href | STAC item |
Steps¶
In [5]:
Copied!
wf.display_steps()
wf.display_steps()
| Id | Runs | Label | Doc |
|---|---|---|---|
crop |
#crop |
Crop spectral bands | Crop and reproject each requested band to the area of interest. |
normalized_difference |
#norm_diff |
Compute NDWI | Compute the normalized difference water index from the cropped bands. |
otsu |
#otsu |
Detect water bodies | Apply Otsu thresholding to the NDWI raster to produce a binary water mask. |
Outputs¶
In [6]:
Copied!
wf.display_outputs()
wf.display_outputs()
| Id | Type | Label | Doc |
|---|---|---|---|
detected_water_body |
File |
Water body mask | Binary water mask generated by the Otsu step |
ndwi |
File |
NDWI raster | NDWI raster generated by normalized difference step |
Component diagram¶
In [7]:
Copied!
wf.display_components_diagram(entrypoint="detect_water_body")
wf.display_components_diagram(entrypoint="detect_water_body")
Class diagram¶
In [8]:
Copied!
wf.display_class_diagram(entrypoint="detect_water_body")
wf.display_class_diagram(entrypoint="detect_water_body")
In [ ]:
Copied!
In [ ]:
Copied!