Skip to content

Commit

Permalink
update cwl-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricebrito committed Nov 2, 2023
1 parent 30122bc commit 0c0ccc0
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cwl-workflow/app-water-bodies-cloud-native.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $graph:
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/terradue/ogc-eo-application-package-hands-on/crop:bids23
dockerPull: localhost/crop:latest
baseCommand: ["python", "-m", "app"]
arguments: []
inputs:
Expand Down Expand Up @@ -158,7 +158,7 @@ $graph:
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/terradue/ogc-eo-application-package-hands-on/norm_diff:bids23
dockerPull: localhost/norm_diff:latest
baseCommand: ["python", "-m", "app"]
arguments: []
inputs:
Expand All @@ -184,7 +184,7 @@ $graph:
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/terradue/ogc-eo-application-package-hands-on/otsu:bids23
dockerPull: localhost/otsu:latest
baseCommand: ["python", "-m", "app"]
arguments: []
inputs:
Expand All @@ -210,7 +210,7 @@ $graph:
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/terradue/ogc-eo-application-package-hands-on/stac:bids23
dockerPull: localhost/stac:latest
baseCommand: ["python", "-m", "app"]
arguments: []
inputs:
Expand Down
6 changes: 3 additions & 3 deletions docs/cwl-workflow/cloud-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ subgraph scatter on bands
P --> B(("crop(green)"))
P --> C(("crop(nir)"))
Q --> B(("crop(green)"))
Q --> C(("crop(green)"))
Q --> C(("crop(nir)"))
R --> B(("crop(green)"))
R --> C(("crop(green)"))
R --> C(("crop(nir)"))
end
B(("crop(green)")) --> D
C(("crop(green)")) --> D
C(("crop(nir)")) --> D
D(("`Normalized
difference`"));
D --> E(("`Otsu
Expand Down
5 changes: 4 additions & 1 deletion docs/cwl-workflow/scatter-cloud-native.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
CWL can run sub-workflows in a step. Below a CWL Workflow created to process a list of STAC Items and then generate a STAC catalog with several detected water bodies.

```yaml linenums="1" hl_lines="33-43"
```yaml linenums="1" hl_lines="18-21 33-43"
--8<--
cwl-workflow/app-water-bodies-cloud-native.cwl:8:58
--8<--
```

The `stac` CommandLineTool is updated to manage arrays:

```yaml linenums="200" hl_lines="19-23 25-29"
--8<--
cwl-workflow/app-water-bodies-cloud-native.cwl:200:234
--8<--
```

To run this CWL document, one would do:

```bash
--8<--
Expand Down
4 changes: 3 additions & 1 deletion docs/cwl-workflow/stage-out.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ It uses a custom STAC I/O to facilitate S3 interactions.

The AWS credentials and endpoint URL need to be properly configured in the environment variables for the script to work. A


```bash linenums="1" hl_lines="8-71"
--8<--
scripts/build-stage-container.sh
--8<--

```

To run the stage-out step, one would run:

```bash linenums="1" hl_lines="8-71"
--8<--
scripts/cwl-cli-stage-out.sh
Expand Down
34 changes: 34 additions & 0 deletions docs/cwl-workflow/staged.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
The non-Cloud native Workflow chains the `crop`, `norm_diff`, `otsu` and `stac` steps taking a staged EO acquisition as a STAC Catalog in a directory as input parameters:

* a local STAC Catalog in a directory
* a bounding box area of interest (AOI)
* the EPSG code of the bounding box area of interest
* a list of common band names (["green", "nir08"])

``` mermaid
graph TB
S[(local storage)]
S -- STAC Catalog --> B(("crop(green)"));
S -- STAC Catalog --> C(("crop(nir)"));
S -- STAC Catalog --> F
P[bands]
Q[EPSG code]
R[AOI]
subgraph scatter on bands
P --> B(("crop(green)"))
P --> C(("crop(nir08)"))
Q --> B(("crop(green)"))
Q --> C(("crop(nir08)"))
R --> B(("crop(green)"))
R --> C(("crop(nir08)"))
end
B(("crop(green)")) --> D
C(("crop(nir08)")) --> D
D(("`Normalized
difference`"));
D --> E(("`Otsu
threshold`"))
E --> F(("`Create
STAC Catalog`"))
```

The CWL Workflow is shown below and the lines highlighted show the changes to manage a staged STAC Catalog instead of an URL to a STAC Item:

```yaml linenums="1" hl_lines="32 90 180" title="app-water-body.cwl"
--8<--
Expand Down
2 changes: 1 addition & 1 deletion scripts/exec-app-water-body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ cwltool \
--aoi="-118.985,38.432,-118.183,38.938" \
--epsg "EPSG:4326" \
--bands green \
--bands nir08 > results.json
--bands nir08

0 comments on commit 0c0ccc0

Please sign in to comment.