Skip to content

Commit

Permalink
Add cwl workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
figi44 committed Aug 15, 2024
1 parent e8a72cd commit 5dbe51e
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

cwl-out/
2 changes: 2 additions & 0 deletions resize-collection-inputs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
catalog: supported-datasets/ceda-stac-fastapi
collection: sentinel2_ard
152 changes: 152 additions & 0 deletions resize-collection.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
cwlVersion: v1.0
$namespaces:
s: https://schema.org/
s:softwareVersion: 1.0.0
schemas:
- http://schema.org/version/9.0/schemaorg-current-http.rdf
$graph:
- class: Workflow
id: resize-collection
label: Resize sentinel2ard collection
doc: Resize sentinel2ard collection
requirements:
- class: ScatterFeatureRequirement
inputs:
catalog:
label: catalog
doc: full catalog path
type: string
collection:
label: collection
doc: collection id
type: string
outputs:
- id: stac_output
outputSource:
- stac_step/stac_catalog
type: Directory
steps:
get_urls_step:
run: "#get_urls_cmd"
in:
catalog: catalog
collection: collection
out:
- urls
- ids
resize_step:
run: "#resize_cmd"
in:
url: get_urls_step/urls
id: get_urls_step/ids
scatter:
- url
- id
scatterMethod: dotproduct
out:
- resized
stac_step:
run: "#stac_cmd"
in:
items: resize_step/resized
out:
- stac_catalog

- class: CommandLineTool
id: get_urls_cmd
requirements:
InlineJavascriptRequirement: {}
ResourceRequirement:
coresMax: 1
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/figi44/eoap/get_urls:main
baseCommand:
- python
- /app/app.py
inputs:
catalog:
type: string
inputBinding:
prefix: --catalog
collection:
type: string
inputBinding:
prefix: --collection
outputs:
urls:
type: string[]
outputBinding:
loadContents: true
glob: urls.txt
outputEval: $(self[0].contents.split('\n'))
ids:
type: string[]
outputBinding:
loadContents: true
glob: ids.txt
outputEval: $(self[0].contents.split('\n'))

- class: CommandLineTool
id: resize_cmd
requirements:
InlineJavascriptRequirement: {}
ResourceRequirement:
coresMax: 1
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/osgeo/gdal:ubuntu-small-latest
baseCommand: gdal_translate
inputs:
url:
type: string
inputBinding:
position: 1
prefix: /vsicurl/
separate: false
id:
type: string
inputBinding:
position: 2
valueFrom: $(self + "_resized.tif")
outsize_x:
type: string
inputBinding:
position: 3
prefix: -outsize
default: 5%
outsize_y:
type: string
inputBinding:
position: 4
default: 5%
outputs:
resized:
type: File
outputBinding:
glob: "*.tif"

- class: CommandLineTool
id: stac_cmd
requirements:
InlineJavascriptRequirement: {}
ResourceRequirement:
coresMax: 1
ramMax: 512
hints:
DockerRequirement:
dockerPull: ghcr.io/figi44/eoap/make_stac:main
baseCommand:
- python
- /app/app.py
inputs:
items:
type: File[]
inputBinding: {}
outputs:
stac_catalog:
outputBinding:
glob: .
type: Directory

0 comments on commit 5dbe51e

Please sign in to comment.