Logo
  • Home

Tutorials

  • Overview
  • Your first custom-type input
  • GeoJSON
    • GeoJSON Point
    • GeoJSON Feature
  • OGC Bounding Box
  • STAC
    • STAC Catalog
    • STAC Collection
    • STAC Item
  • String formats
    • Datetime
    • URI
  • Experimental
    • Experimental Discovery Inputs
      • CWL example
      • Input example
      • Execute the example
    • Experimental Process Inputs

How-to guides

  • Overview
  • Use an existing schema
  • Define new types

Reference

  • Overview
  • GeoJSON
    • Types
    • Schema details
  • OGC API Processes
    • Types
    • Schema details
  • STAC
    • Types
    • Schema details
  • String formats
    • Types
    • Schema details

Explanation

  • Custom types and their limits
EOAP schemas
  • Tutorials
  • Experimental
  • Experimental Discovery Inputs
  • Edit on eoap/schemas

Experimental Discovery Inputs¶

CWL example¶

cwlVersion: v1.2
class: CommandLineTool
label: "geo API - Discovery"
baseCommand: cat
requirements:
  - class: InlineJavascriptRequirement
  - class: SchemaDefRequirement
    types:
      - $import: https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml
      - $import: https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml
      - $import: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml
      - $import: https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml
  - class: InitialWorkDirRequirement
    listing:
      - entryname: inputs.yaml
        entry: "$(inputs.api_endpoint.url.value)\n---\n$(inputs.search_request.collections[0])\n---\n${ \n  const bbox = inputs.search_request?.bbox;\n  if (bbox && Array.isArray(bbox) && bbox.length >= 4) {\n    return \"--bbox \" + bbox.join(\" \");\n  }\n  return \"\";\n}"
inputs:
  api_endpoint:
    type: https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint
    label: "STAC API endpoint"
    doc: "STAC API endpoint for Landsat-9 data"
  search_request:
    type: https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings
    label: "STAC API settings"
    doc: "STAC API settings for Landsat-9 data"
arguments:
  - inputs.yaml
outputs:
  echo_output:
    type: stdout
stdout: discovery-output.yaml

Input example¶

api_endpoint:
  url:
    value: https://planetarycomputer.microsoft.com/api/stac/v1
  headers: []
search_request:
  collections:
    - landsat-c2-l2
  datetime_interval:
    start:
      value: "2023-10-15T18:00:00"
    end:
      value: "2023-10-15T18:59:59"
  bbox:
    - -118.985
    - 38.432
    - -118.183
    - 38.938
  filter-lang: cql2-json
  filter: {"op": "and", "args": [{"op": "<=", "args": [{"property": "eo:cloud_cover"}, 60]}, {"op": ">=", "args": [{"property": "eo:cloud_cover"}, 0]}]}

Execute the example¶

Run the example with:

cwltool examples/experimental/discovery.cwl examples/experimental/discovery.yaml

This produces the output:

INFO /opt/hostedtoolcache/Python/3.12.14/x64/bin/cwltool 3.3.20260925135507
INFO Resolved '../../examples/experimental/discovery.cwl' to 'file:///home/runner/work/schemas/schemas/examples/experimental/discovery.cwl'
DEBUG [job discovery.cwl] initializing from file:///home/runner/work/schemas/schemas/examples/experimental/discovery.cwl
DEBUG [job discovery.cwl] {
    "api_endpoint": {
        "url": {
            "value": "https://planetarycomputer.microsoft.com/api/stac/v1"
        },
        "headers": []
    },
    "search_request": {
        "collections": [
            "landsat-c2-l2"
        ],
        "datetime_interval": {
            "start": {
                "value": "2023-10-15T18:00:00"
            },
            "end": {
                "value": "2023-10-15T18:59:59"
            }
        },
        "bbox": [
            -118.985,
            38.432,
            -118.183,
            38.938
        ],
        "filter-lang": "cql2-json",
        "filter": {
            "op": "and",
            "args": [
                {
                    "op": "<=",
                    "args": [
                        {
                            "property": "eo:cloud_cover"
                        },
                        60
                    ]
                },
                {
                    "op": ">=",
                    "args": [
                        {
                            "property": "eo:cloud_cover"
                        },
                        0
                    ]
                }
            ]
        },
        "datetime": null,
        "datetime-interval": null,
        "intersects": null,
        "ids": null,
        "limit": null,
        "max-items": null,
        "fields": null,
        "filter-crs": null,
        "sortby": null
    }
}
DEBUG [job discovery.cwl] path mappings is {}
DEBUG [job discovery.cwl] command line bindings is [
    {
        "position": [
            -1000000,
            0
        ],
        "datum": "cat"
    },
    {
        "position": [
            0,
            0
        ],
        "datum": "inputs.yaml"
    }
]
DEBUG [job discovery.cwl] initial work dir {
    "_:a5b4f16a-3bb7-403c-ba1f-cc8a692c70cb": [
        "https://planetarycomputer.microsoft.com/api/stac/v1\n---\nlandsat-c2-l2\n---\n--bbox -118.985 38.432 -118.183 38.938",
        "/tmp/wq8hhuis/inputs.yaml",
        "CreateFile",
        true
    ]
}
INFO [job discovery.cwl] /tmp/wq8hhuis$ cat \
    inputs.yaml > /tmp/wq8hhuis/discovery-output.yaml
DEBUG Could not collect memory usage, job ended before monitoring began.
INFO [job discovery.cwl] completed success
DEBUG [job discovery.cwl] outputs {
    "echo_output": {
        "location": "file:///tmp/wq8hhuis/discovery-output.yaml",
        "basename": "discovery-output.yaml",
        "nameroot": "discovery-output",
        "nameext": ".yaml",
        "class": "File",
        "checksum": "sha1$756a816a78cff2ac8d01cdd53654259016f36dc6",
        "size": 112,
        "http://commonwl.org/cwltool#generation": 0
    }
}
DEBUG [job discovery.cwl] Removing input staging directory /tmp/nkjwnv4a
DEBUG [job discovery.cwl] Removing temporary directory /tmp/h88qa7n2
DEBUG Moving /tmp/wq8hhuis/discovery-output.yaml to /home/runner/work/schemas/schemas/docs/experimental/discovery-output.yaml
DEBUG Removing intermediate output directory /tmp/wq8hhuis
INFO Final process status is success

The content of the echo_output.txt file is:

https://planetarycomputer.microsoft.com/api/stac/v1
---
landsat-c2-l2
---
--bbox -118.985 38.432 -118.183 38.938
Previous Next

Apache License, Version 2.0

Built with MkDocs using a theme provided by Read the Docs.
eoap/schemas « Previous Next »