Stage and cog
Goal
Run the stage-and-cog.cwl CWL Workflow that that stages a Sentinel-2 Level-1C from the CDSE and converts/resamples its assets to COG.
Lab
This step has a dedicated lab available at /workspace/inference-eoap/practice-labs/Application steps/01 - Stage-and-cog.ipynb
Dependencies
This steps requires generating a CDSE access token with the Python script and your own CDSE credentials:
bin/get-bearer-token | |
---|---|
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 |
|
Lab
This step has a dedicated lab available at /workspace/inference-eoap/practice-labs/Application steps/01 - Stage-and-cog.ipynb
Step 1 - Run the stage-and-cog.cwl_ CWL Workflow
Use cwltool
to run the stage-and-cog.cwl CWL Workflow with a Sentinel-2 Level-1C acquisition reference
The CWL Workflow is shown below and the lines highlighted chain the stage-in
and conversion
to COG steps:
stage-and-cog.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 87 88 89 90 91 92 93 94 95 96 97 |
|
To run this CWL document run the script below to:
- provide your CDSE username and password to generate and access token
- Use
cwltool
to run stage-and-cog.cwl CWL description
version="1.0.0"
export WORKSPACE=/workspace/inference-eoap
export PATH=${WORKSPACE}/bin:$PATH
read -p "Enter the CDSE username: " username
read -sp "Enter the CDSE password: " password
BEARER_TOKEN=$( get-bearer-token ${username} ${password} )
cwltool \
--podman \
--outdir ${WORKSPACE}/runs \
https://github.com/eoap/inference-eoap/releases/download/1.0.0/stage-and-cog.1.0.0.cwl \
--access_token ${BEARER_TOKEN} \
--item "https://catalogue.dataspace.copernicus.eu/stac/collections/SENTINEL-2/items/S2A_MSIL1C_20240125T100311_N0510_R122_T33TVM_20240125T104959.SAFE" > ${WORKSPACE}/runs/results.json
Expected outcome
The folder /workspace/inference-eoap/runs
contains:
(base) jovyan@jupyter-fbrito--training:~/inference-eoap$ tree runs
runs
├── results.json
└── ydmns4od
├── S2A_T33TVM_20240125T100359_L1C
│ ├── S2A_T33TVM_20240125T100359_L1C.json
│ ├── blue.tif
│ ├── cirrus.tif
│ ├── coastal.tif
│ ├── green.tif
│ ├── nir.tif
│ ├── nir08.tif
│ ├── nir09.tif
│ ├── red.tif
│ ├── rededge1.tif
│ ├── rededge2.tif
│ ├── rededge3.tif
│ ├── swir16.tif
│ └── swir22.tif
└── catalog.json
2 directories, 16 files