Skip to content

Commit

Permalink
adds local paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricebrito committed Oct 30, 2023
1 parent 54e3cc9 commit fe547da
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 44 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/cwl-cli/crop.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


```yaml linenums="1" hl_lines="9-12 49-53" title="file: crop.cwl"
```yaml linenums="1" hl_lines="9-12 49-53" title="cwl-cli/crop.cwl"
--8<--
cwl-cli/crop.cwl
--8<--
Expand All @@ -16,7 +16,7 @@ Or

```yaml title="crop-params.yaml"
--8<--
docs/cwl-cli/crop-params.yaml
cwl-cli/crop-params.yaml
--8<--
```

Expand Down
2 changes: 1 addition & 1 deletion docs/cwl-cli/norm-diff.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


```yaml linenums="1" hl_lines="9-12 49-53"
```yaml linenums="1" hl_lines="9-12 49-53" title="cwl-cli/norm-diff.cwl"
--8<--
cwl-cli/norm-diff.cwl
--8<--
Expand Down
4 changes: 3 additions & 1 deletion scripts/build-stage-container.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export WORKSPACE=/workspace/app-package-training-bids23

podman \
build \
--format docker \
-t localhost/stage:latest \
${WORKSPACE}/mastering-app-package-/water-bodies/command-line-tools/stage-in
${WORKSPACE}/water-bodies/command-line-tools/stage-in
13 changes: 9 additions & 4 deletions scripts/build_containers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
podman build --format docker -t localhost/crop:latest ${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/crop
podman build --format docker -t localhost/norm-diff:latest ${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/norm_diff
podman build --format docker -t localhost/otsu:latest ${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/otsu
podman build --format docker -t localhost/stac:latest ${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/stac
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}

podman build --format docker -t localhost/crop:latest ${WORKSPACE}/water-bodies/command-line-tools/crop
podman build --format docker -t localhost/norm-diff:latest ${WORKSPACE}/water-bodies/command-line-tools/norm_diff
podman build --format docker -t localhost/otsu:latest ${WORKSPACE}/water-bodies/command-line-tools/otsu
podman build --format docker -t localhost/stac:latest ${WORKSPACE}/water-bodies/command-line-tools/stac
24 changes: 5 additions & 19 deletions scripts/build_containers_gh.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
podman build --format docker -t ghcr.io/terradue/ogc-eo-application-package-hands-on/crop:bids23 ${WORKSPACE}/mastering-app-package-/water-bodies/command-line-tools/crop
podman push ghcr.io/terradue/ogc-eo-application-package-hands-on/crop:bids23

podman build --format docker -t ghcr.io/terradue/ogc-eo-application-package-hands-on/norm-diff:bids23 ${WORKSPACE}/mastering-app-package-/water-bodies/command-line-tools/norm_diff
podman push ghcr.io/terradue/ogc-eo-application-package-hands-on/norm:bids23

podman build --format docker -t ghcr.io/terradue/ogc-eo-application-package-hands-on/otsu:bids23 ${WORKSPACE}/mastering-app-package-/water-bodies/command-line-tools/otsu
podman push ghcr.io/terradue/ogc-eo-application-package-hands-on/otsu:bids23

podman build --format docker -t ghcr.io/terradue/ogc-eo-application-package-hands-on/stac:bids23 ${WORKSPACE}/mastering-app-package-/water-bodies/command-line-tools/stac
podman push ghcr.io/terradue/ogc-eo-application-package-hands-on/stac:bids23


yq eval '(.$graph[] | select (.id == "crop") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/crop:aaa"' /workspace/mastering-app-package-/cwl-workflow/app-water-bodies-cloud-native.cwl

WORKSPACE=/workspace
WORKSPACE=/workspace/app-package-training-bids23

version="bids23"
repo="ghcr.io/terradue/ogc-eo-application-package-hands-on"
repo="ghcr.io/terradue/${REPO}"

for step in crop norm_diff otsu stac
do
tag=${repo}/${step}:${version}
podman build --format docker -t ${tag} ${WORKSPACE}/mastering-app-package-/water-bodies/command-line-tools/crop
podman build --format docker -t ${tag} ${WORKSPACE}/water-bodies/command-line-tools/crop
podman push ${tag}

t="$tag" s="$step" yq eval -i '(.$graph[] | select (.id == env(s)) ).hints.DockerRequirement.dockerPull = env(t)' /workspace/mastering-app-package-/cwl-workflow/app-water-bodies-cloud-native.cwl
t="$tag" s="$step" yq eval -i '(.$graph[] | select (.id == env(s)) ).hints.DockerRequirement.dockerPull = env(t)' ${WORKSPACE}/cwl-workflow/app-water-bodies-cloud-native.cwl
done
7 changes: 6 additions & 1 deletion scripts/crop_green.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}

python \
${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/crop/app.py \
${WORKSPACE}/water-bodies/command-line-tools/crop/app.py \
--input-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" \
Expand Down
7 changes: 6 additions & 1 deletion scripts/crop_nir.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}

python \
${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/crop/app.py \
${WORKSPACE}/water-bodies/command-line-tools/crop/app.py \
--input-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" \
Expand Down
4 changes: 3 additions & 1 deletion scripts/cwl-cli-crop-green.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export WORKSPACE=/workspace/app-package-training-bids23

cwltool \
--podman \
--outdir /workspace/runs \
crop.cwl \
${WORKSPACE}/cwl-cli/crop.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" \
Expand Down
4 changes: 3 additions & 1 deletion scripts/cwl-cli-norm-diff.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export WORKSPACE=/workspace/app-package-training-bids23

cwltool \
--podman \
--outdir /workspace/runs \
norm_diff.cwl \
${WORKSPACE}/cwl-cli/norm_diff.cwl \
--rasters \
/workspace/runs/crop_green.tif \
--rasters \
Expand Down
2 changes: 1 addition & 1 deletion scripts/cwl-cli-otsu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cwltool \
--podman \
--outdir /workspace/runs \
otsu.cwl \
${WORKSPACE}/cwl-cli/otsu.cwl \
--raster \
/workspace/runs/norm_diff.tif
2 changes: 1 addition & 1 deletion scripts/cwl-cli-stac.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cwltool \
--podman \
--outdir /workspace/runs \
stac.cwl \
${WORKSPACE}/cwl-cli/stac.cwl \
--item \
"https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2B_10TFK_20210713_0_L2A" \
--rasters \
Expand Down
2 changes: 1 addition & 1 deletion scripts/cwl-cli-stage-in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ ls9_ref="https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat
cwltool \
--podman \
--outdir /workspace/runs \
stage-in.cwl \
${WORKSPACE}/cwl-cli/stage-in.cwl \
--reference \
${ls9_ref} > staged.json
2 changes: 1 addition & 1 deletion scripts/cwl-cli-stage-out.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cwltool \
--podman \
stage-out.cwl \
${WORKSPACE}/cwl-cli/stage-out.cwl \
--aws_access_key_id $( cat ~/.aws/credentials | grep aws_access_key_id | cut -d "=" -f 2 ) \
--aws_secret_access_key $( cat ~/.aws/credentials | grep aws_secret_access_key | cut -d "=" -f 2 ) \
--endpoint_url $( cat ~/.aws/config | grep endpoint_url | head -n 1 | cut -d "=" -f 2 ) \
Expand Down
4 changes: 3 additions & 1 deletion scripts/cwl-workflow-cloud-native-scatter.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export WORKSPACE=/workspace/app-package-training-bids23

cwltool \
--podman \
--parallel \
--outdir /workspace/runs \
app-water-bodies-cloud-native.cwl \
${WORKSPACE}/cwl-workflow/app-water-bodies-cloud-native.cwl \
--stac_items "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2B_10TFK_20210713_0_L2A" \
--stac_items "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2A_10TFK_20220524_0_L2A" \
--aoi="-121.399,39.834,-120.74,40.472" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/cwl-workflow-cloud-native.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cwltool \
--podman \
--outdir /workspace/runs \
app-water-body-cloud-native.cwl \
${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"
2 changes: 1 addition & 1 deletion scripts/cwl-workflow-staged.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cwltool \
--podman \
--outdir /workspace/runs \
cwl-workflow/app-water-body.cwl \
${WORKSPACE}/cwl-workflow/cwl-workflow/app-water-body.cwl \
--item $( cat staged.json | jq -r .staged.path ) \
--aoi="-118.985,38.432,-118.183,38.938" \
--epsg "EPSG:4326" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/cwltool-scripted-execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_job_order():
podman=True,
parallel=True,
outdir="/workspace/runs",
workflow=f"/workspace/mastering-app-package-/app-water-bodies-cloud-native.{version}.cwl#water_bodies",
workflow=f"/workspace/app-package-training-bids23/app-water-bodies-cloud-native.{version}.cwl#water_bodies",
job_order=get_job_order(),
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/download-cwl.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version="1.4.1"

wget https://github.com/Terradue/ogc-eo-application-package-hands-on/releases/download/$version/app-water-bodies-cloud-native.$version.cwl
wget https://github.com/Terradue/app-package-training-bids23/releases/download/$version/app-water-bodies-cloud-native.$version.cwl
7 changes: 6 additions & 1 deletion scripts/norm_diff.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}

python \
${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/norm_diff/app.py \
${WORKSPACE}/water-bodies/command-line-tools/norm_diff/app.py \
crop_green.tif \
crop_nir.tif
7 changes: 6 additions & 1 deletion scripts/otsu.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}

python \
${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/otsu/app.py \
${WORKSPACE}/water-bodies/command-line-tools/otsu/app.py \
norm_diff.tif
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export WORKSPACE=/workspace
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}
7 changes: 6 additions & 1 deletion scripts/stac.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export WORKSPACE=/workspace/app-package-training-bids23
export RUNTIME=/workspace/runs
mkdir -p ${RUNTIME}
cd ${RUNTIME}

python \
${WORKSPACE}/ogc-eo-application-package-hands-on/water-bodies/command-line-tools/stac/app.py \
${WORKSPACE}/water-bodies/command-line-tools/stac/app.py \
--input-item "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2B_10TFK_20210713_0_L2A" \
--water-body otsu.tif

0 comments on commit fe547da

Please sign in to comment.