Pattern 8
Application Package Pattern 8¶
The CWL includes:
- one input parameter of type
Directory - one output parameter of type
Directory?
This scenario takes as input an acquisition, applies an algorithm and may or may not generate and output
Implementation: detects water bodies using the Normalized Difference Water Index (NDWI) and Otsu thresholding.
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[3], line 1 ----> 1 wf.plot() AttributeError: 'WorkflowViewer' object has no attribute 'plot'
Inputs¶
| Id | Type | Label | Doc |
|---|---|---|---|
aoi |
string |
area of interest | area of interest as a bounding box |
epsg |
string |
EPSG code | EPSG code |
bands |
string[] |
bands used for the NDWI | bands used for the NDWI |
item |
Directory |
Landsat-8/9 acquisition reference | Landsat-8/9 acquisition reference |
produce_output |
boolean |
Flag to produce the output | Flag to produce the output |
Steps¶
| Id | Runs | Label | Doc |
|---|---|---|---|
step |
#clt |
Detect water bodies | Detect water bodies based on the NDWI and otsu threshold from Landsat-8/9 acquisition |
Outputs¶
| Id | Type | Label | Doc |
|---|---|---|---|
water_bodies |
[ null, Directory ] |
Water bodies detected | Water bodies detected based on the NDWI and otsu threshold |
Data flow management¶
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[7], line 2 1 w = WorkflowWrapper(workflow=wf.workflow, entrypoint=entrypoint) ----> 2 wrapped = w.wrap() 3 4 app_cwl_file = f".{entrypoint}.cwl" 5 File ~/work/application-package-patterns/application-package-patterns/docs/helpers.py:120, in WorkflowWrapper.wrap(self) 113 file_stage_in = load_cwl_from_location( 114 path=f"{self.base_url}/templates/stage-in-file.cwl" 115 ) 116 stage_out_cwl = load_cwl_from_location( 117 path=f"{self.base_url}/templates/stage-out.cwl" 118 ) --> 120 return wrap( 121 directory_stage_in=directory_stage_in, 122 file_stage_in=file_stage_in, 123 workflows=self.workflow, 124 workflow_id=self.entrypoint, 125 stage_out=stage_out_cwl, 126 ) TypeError: wrap() got an unexpected keyword argument 'workflows'. Did you mean 'workflow'?
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[8], line 1 ----> 1 wf = WorkflowViewer(cwl_file=app_cwl_file, workflow=wrapped, entrypoint="main") 2 3 wf.display_class_diagram() NameError: name 'wrapped' is not defined
Workflow sequence diagram¶
Inputs¶
| Id | Type | Label | Doc |
|---|---|---|---|
aoi |
string |
area of interest | area of interest as a bounding box |
epsg |
string |
EPSG code | EPSG code |
bands |
string[] |
bands used for the NDWI | bands used for the NDWI |
item |
Directory |
Landsat-8/9 acquisition reference | Landsat-8/9 acquisition reference |
produce_output |
boolean |
Flag to produce the output | Flag to produce the output |
Steps¶
| Id | Runs | Label | Doc |
|---|---|---|---|
step |
#clt |
Detect water bodies | Detect water bodies based on the NDWI and otsu threshold from Landsat-8/9 acquisition |
Outputs¶
| Id | Type | Label | Doc |
|---|---|---|---|
water_bodies |
[ null, Directory ] |
Water bodies detected | Water bodies detected based on the NDWI and otsu threshold |
Execution¶
Inputs¶
{
"aoi": "-118.985,38.432,-118.183,38.938",
"epsg": "EPSG:4326",
"bands": [
"green",
"nir08"
],
"item": {
"class": "https://raw.githubusercontent.com/eoap/schemas/main/url.yaml#URL",
"value": "https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat-c2-l2/items/LC08_L2SP_042033_20231007_02_T1"
},
"produce_output": true,
"another_input": "some_value",
"s3_bucket": "my-bucket",
"sub_path": "my/sub/path",
"aws_access_key_id": "test",
"aws_secret_access_key": "test",
"region_name": "us-west-1",
"endpoint_url": "https://s3.us-west-1.amazonaws.com"
}
Errors¶
CWL execution terminated with errors:
[1;30mINFO[0m /opt/hostedtoolcache/Python/3.14.6/x64/lib/python3.14/site-packages/ipykernel_launcher.py 3.1.20260315121657
[1;30mINFO[0m Resolved '../cwl-workflow/pattern-8.cwl#main' to 'file:///home/runner/work/application-package-patterns/application-package-patterns/cwl-workflow/pattern-8.cwl#main'
[1;30mWARNING[0m [33m../cwl-workflow/pattern-8.cwl:102:7: Warning: checking item
Warning: Field 'class' contains undefined reference to
'http://oeap.github.io/schema#JSONSchemaHint'[0m
[1;30mERROR[0m [31mTool definition failed validation:
Reference '#main' not found in file 'file:///home/runner/work/application-package-patterns/application-package-patterns/cwl-workflow/pattern-8.cwl'.[0m