From cb2655b833e001e993be30d7e0419b428455345f Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Thu, 2 Nov 2023 08:38:27 +0100 Subject: [PATCH] ls9 exec --- docs/cwl-workflow/exec-stage-in.md | 68 +++++++++++++++++++++++++++++- docs/cwl-workflow/stage-in.md | 2 +- scripts/exec-app-water-body.sh | 11 +++++ 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 scripts/exec-app-water-body.sh diff --git a/docs/cwl-workflow/exec-stage-in.md b/docs/cwl-workflow/exec-stage-in.md index 3ddd01b..f994250 100644 --- a/docs/cwl-workflow/exec-stage-in.md +++ b/docs/cwl-workflow/exec-stage-in.md @@ -43,18 +43,82 @@ scripts/cwl-cli-stage-in-released.sh sh ${WORKSPACE}/scripts/cwl-cli-stage-in-released.sh ``` +The expected content after this step is: + +```bash +(base) jovyan@coder-fbrito:~/runs$ tree +. +├── app-water-body.1.0.0.cwl +├── lwft9j0o +│ ├── LC09_L2SP_042033_20231015_02_T1 +│ │ ├── LC09_L2SP_042033_20231015_02_T1.json +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ANG.txt +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_MTL.json +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_MTL.txt +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_MTL.xml +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_QA_PIXEL.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_QA_RADSAT.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B1.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B2.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B3.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B4.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B5.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B6.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_B7.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_SR_QA_AEROSOL.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_ATRAN.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_B10.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_CDIST.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_DRAD.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_EMIS.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_EMSD.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_QA.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_TRAD.TIF +│ │ ├── LC09_L2SP_042033_20231015_20231016_02_T1_ST_URAD.TIF +│ │ ├── preview.png +│ │ └── tilejson.json +│ ├── catalog.json +│ └── stage.py +└── staged.json + +2 directories, 30 files +``` + The result is redirected to a file named `staged.json` as we use `jq` to get the path of the staged product: ```bash title="terminal" -cat staged.json | jq -r .staged +cat staged.json | jq -r .staged.path ``` This returns a path like `/workspace/runs/921x91vw` ### Step 4 - Execute the Application Package +Use `cwltool` to run the application package using the staged Landsat-9 acquisition: + ```bash linenums="1" hl_lines="5" --8<-- -scripts/cwl-workflow-staged.sh +scripts/exec-app-water-body.sh --8<-- +``` + +``` +sh ${WORKSPACE}/scripts/exec-app-water-body.sh +``` + +### Expected outcome + +The folder `/workspace/runs` contains: + +``` hl_lines="3" +(base) jovyan@coder-fbrito:~/runs$ tree . +/workspace/runs/ +├── app-water-body-cloud-native.1.0.0.cwl +└── cmtriamc + ├── S2B_10TFK_20210713_0_L2A + │ ├── S2B_10TFK_20210713_0_L2A.json + │ └── otsu.tif + └── catalog.json + +2 directories, 4 files ``` \ No newline at end of file diff --git a/docs/cwl-workflow/stage-in.md b/docs/cwl-workflow/stage-in.md index 1d45ac5..b064327 100644 --- a/docs/cwl-workflow/stage-in.md +++ b/docs/cwl-workflow/stage-in.md @@ -58,7 +58,7 @@ scripts/cwl-cli-stage-in.sh The result is redirected to a file named `staged.json` as we use `jq` to get the path of the staged product: ```bash title="terminal" -cat staged.json | jq -r .staged +cat staged.json | jq -r .staged.path ``` This returns a path like `/workspace/runs/921x91vw` \ No newline at end of file diff --git a/scripts/exec-app-water-body.sh b/scripts/exec-app-water-body.sh new file mode 100644 index 0000000..caae5c7 --- /dev/null +++ b/scripts/exec-app-water-body.sh @@ -0,0 +1,11 @@ +version="1.0.0" + +cwltool \ + --podman \ + --outdir /workspace/runs \ + /workspace/runs/app-water-body.${version}.cwl \ + --item $( cat staged.json | jq -r .staged.path ) \ + --aoi="-118.985,38.432,-118.183,38.938" \ + --epsg "EPSG:4326" \ + --bands green \ + --bands nir08 \ No newline at end of file