Water bodies detection
Goal
Wrap the CommandLineTool with a CWL Workflow
Lab
This step has a dedicated lab available at /workspace/quickwin/practice-labs/Workflow.ipynb
How to wrap a CWL CommandLineTool with a CWL Workflow
The Cloud native Workflow orchestrates the wrapped Python application command line tool as a CWL CommandLineTool
step with input parameters:
- a SpatioTemporal Asset Catalog (STAC) Item
- a bounding box area of interest (AOI)
- the EPSG code of the bounding box area of interest
- a list of common band names (["green", "nir"])
graph TB
A[STAC Item URL]
A --> B(("Detect water bodies"));
B --> C[STAC Catalog]
The CWL Workflow is shown below and the lines highlighted chain the water bodies detection step:
app-water-body-cloud-native.cwl | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
To run this CWL document, one does:
terminal
export WORKSPACE=/workspace/quickwin
command -v podman >/dev/null 2>&1 && {
flag="--podman"
}
cwltool ${flag} \
--outdir ${WORKSPACE}/runs \
${WORKSPACE}/cwl-workflow/app-water-body-cloud-native.cwl \
--item "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2B_10TFK_20210713_0_L2A" \
--aoi="-121.399,39.834,-120.74,40.472" \
--epsg "EPSG:4326" \
--band "green" \
--band "nir"
Expected outcome
The folder /workspace/quickwin/runs
contains:
(base) jovyan@jupyter-fbrito--training:~/quickwin$ tree runs
runs
└── jtv7v57e
├── S2B_10TFK_20210713_0_L2A
│ ├── S2B_10TFK_20210713_0_L2A.json
│ └── otsu.tif
├── catalog.json
└── otsu.tif
2 directories, 4 files