11  LCZ Classification

11.1 Introduction

The following sections demonstrate that the HEATWISE Local Climate Zones classification software follows the OGC Best Practice for Earth Observation Application Package.

In this demonstration, only the inference step of the LCZ classification algorithm is presented. The repository contains another EOAP for training.

The order of demonstration is deliberately different from that given in the best practice document. This is done to make the demonstration easy to follow and group requirements that can be shown together. An effort is made to keep the requirements in order as much as possible to make it easy to find a specific requirement.

The demonstration proceeds in the following steps:

  • Execute the software as docker container and as CWL document (the EOAP)
  • Show that STAC inputs and outputs are handled by the application as required
  • Show that the CWL document is structured as required
  • Show that STAC inputs and outputs are declared in the CWL as required

After each step, the requirements shown are listed.

Chapter 2 contains an overview of all requirements in order and how they are demonstrated in this document. It furthermore shows all utility scripts used in this demonstration. For brevity, the content of utility scripts is only shown in the requirements overview and not in each demonstration.

11.2 Preparation

Activate the pixi environment to make validation tools and scripts available.

eval "$(pixi shell-hook --change-ps1 false)"

Set environment variables to software, cwl documents, inputs and outputs.

set -o pipefail
set -x
SOFTWARE_ROOT="$PIXI_PROJECT_ROOT"/software/heatwise-lcz-classification
CWL_PATH="$PIXI_PROJECT_ROOT"/application-packages/heatwise_lcz_predict.cwl
INPUT_PATH="$PIXI_PROJECT_ROOT"/inputs/lcz-classification

DOCKER_IMAGE_ID=ghcr.io/esa-heatwise/heatwise-lcz-classification:1.0.0
OUTPUT_PATH="$PIXI_PROJECT_ROOT"/outputs/lcz-classification

ls -ltrAh --color=never "$SOFTWARE_ROOT"
set +x
+ SOFTWARE_ROOT=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/software/heatwise-lcz-classification
+ CWL_PATH=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/application-packages/heatwise_lcz_predict.cwl
+ INPUT_PATH=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/inputs/lcz-classification
+ DOCKER_IMAGE_ID=ghcr.io/esa-heatwise/heatwise-lcz-classification:1.0.0
+ OUTPUT_PATH=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification
+ ls --color=auto -ltrAh --color=never /home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/software/heatwise-lcz-classification
total 68K
-rw-r--r-- 1 runner runner  159 Nov 27 10:37 .gitignore
-rw-r--r-- 1 runner runner 1.8K Nov 27 10:37 Dockerfile
-rw-r--r-- 1 runner runner  11K Nov 27 10:37 README.md
-rw-r--r-- 1 runner runner 1.1K Nov 27 10:37 LICENSE
-rw-r--r-- 1 runner runner  261 Nov 27 10:37 .dockerignore
drwxr-xr-x 3 runner runner 4.0K Nov 27 10:37 data
-rw-r--r-- 1 runner runner 5.0K Nov 27 10:37 heatwise_lcz_predict.cwl
drwxr-xr-x 3 runner runner 4.0K Nov 27 10:37 examples
-rw-r--r-- 1 runner runner 4.5K Nov 27 10:37 heatwise_lcz_train.cwl
-rw-r--r-- 1 runner runner 5.2K Nov 27 10:37 processor.py
-rw-r--r-- 1 runner runner   85 Nov 27 10:37 requirements.txt
drwxr-xr-x 7 runner runner 4.0K Nov 27 10:37 .git
+ set +x

11.3 Running the software

The first set of requirements is concerned with how the software is executed. It shall be

  • Runnable as a non-interactive script
  • Bundled in (Docker) container
  • Executable as a CWL Workflow containing at least one CWL CommandLineTool

11.3.1 Running as a docker container

We can run the (dockerized) software directly, without using the CWL machinery with docker run:

mkdir -p "$OUTPUT_PATH"

docker run --rm \
    -v "$INPUT_PATH/Berlin:/input:ro" \
    -v "$OUTPUT_PATH:/output" \
    --user "$(id -u):$(id -g)" \
    $DOCKER_IMAGE_ID \
    python /app/processor.py predict \
    --config /app/examples/predict_config_sample_docker.yaml \
    --input-catalog /input/catalog.json \
    --weights /input/best_model_HSI-BS.pth \
    --output /output/Berlin_LCZ_sample.tif \
    || { FAIL_REQ_1=1; FAIL_REQ_2=1; }
mkdir -p failed for path /.config/matplotlib: [Errno 13] Permission denied: '/.config'
Matplotlib created a temporary cache directory at /tmp/matplotlib-ry6bh5fq because there was an issue with the default path (/.config/matplotlib); it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
/usr/local/lib/python3.11/site-packages/torch/nn/modules/conv.py:196: UserWarning: Initializing zero-element tensors is a no-op
  init.kaiming_uniform_(self.weight, a=math.sqrt(5))
[predict_map] modal=hsi  use_lst=False  device=cpu
[predict_map] Image 810x537, stacked channels=30, valid pixels=434858
[predict_map] Windows to predict: 1564
  progress 32/1564

[predict_map] Saved LCZ map: /output/Berlin_LCZ_sample.tif
Per-class pixel counts: {2: 160768, 5: 14592, 6: 172800, 8: 21504, 11: 17408, 12: 9728, 17: 3584}
[predict_map] Saved color preview: /output/Berlin_LCZ_sample_preview.png
[processor] Output LCZ map: /output/Berlin_LCZ_sample.tif
[processor] Output STAC catalog: /output/catalog.json

The image should not only be available locally, but also in a container registry.

check-container-registry.sh $DOCKER_IMAGE_ID || FAIL_REQ_3=1
SUCCESS: Image ghcr.io/esa-heatwise/heatwise-lcz-classification:1.0.0 found on registry

11.3.1.1 Requirements Validated

req/app/cmd-line (Requirement 1)

The Application SHALL be a non-interactive executable as a command-line application.

req/app/container (Requirement 2)

The environment, libraries, binaries, executable and configuration files necessary to execute the Application SHALL be bundled in a container image.

req/app/registry (Requirement 3)

The Application container image SHALL be accessible in a container registry.

11.3.2 Running as an EOAP

First, we validate that the CWL document is valid.

cwltool --disable-color --validate "$CWL_PATH" | cat
INFO /home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/.pixi/envs/dev/bin/cwltool 3.2.20260413085819
INFO Resolved '/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/application-packages/heatwise_lcz_predict.cwl' to 'file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/application-packages/heatwise_lcz_predict.cwl'
WARNING ../../application-packages/heatwise_lcz_predict.cwl:60:9: object id '../../application-packages/heatwise_lcz_predict.cwl#main/output' previously defined
WARNING ../../application-packages/heatwise_lcz_predict.cwl:150:7: object id '../../application-packages/heatwise_lcz_predict.cwl#lcz_predict_processor/output' previously defined
WARNING ../../application-packages/heatwise_lcz_predict.cwl:60:9: object id '../../application-packages/heatwise_lcz_predict.cwl#main/output' previously defined
WARNING ../../application-packages/heatwise_lcz_predict.cwl:150:7: object id '../../application-packages/heatwise_lcz_predict.cwl#lcz_predict_processor/output' previously defined
/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/application-packages/heatwise_lcz_predict.cwl is valid CWL.

The CWL should contain a Workflow and at least one CommandLineTool object. We inspect the classes in the CWL graph to make sure.

show-cwl-graph-classes.sh "$CWL_PATH"
class: Workflow
id: main
---
class: CommandLineTool
id: lcz_predict_processor

The EOAP can be executed from its CWL description with cwltool.

cwltool \
  --disable-color \
  --outdir "$OUTPUT_PATH/cwlruns" \
   $CWL_PATH \
   --config $SOFTWARE_ROOT/examples/predict_config_sample_docker.yaml \
   --input_catalog $INPUT_PATH/Berlin \
   --weights $INPUT_PATH/Berlin/best_model_HSI-BS.pth \
   --output Berlin_LCZ_sample.tif \
  || FAIL_REQ_7=1
INFO /home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/.pixi/envs/dev/bin/cwltool 3.2.20260413085819
INFO Resolved '/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/application-packages/heatwise_lcz_predict.cwl' to 'file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/application-packages/heatwise_lcz_predict.cwl'
WARNING ../../application-packages/heatwise_lcz_predict.cwl:60:9: object id '../../application-packages/heatwise_lcz_predict.cwl#main/output' previously defined
WARNING ../../application-packages/heatwise_lcz_predict.cwl:150:7: object id '../../application-packages/heatwise_lcz_predict.cwl#lcz_predict_processor/output' previously defined
WARNING ../../application-packages/heatwise_lcz_predict.cwl:60:9: object id '../../application-packages/heatwise_lcz_predict.cwl#main/output' previously defined
WARNING ../../application-packages/heatwise_lcz_predict.cwl:150:7: object id '../../application-packages/heatwise_lcz_predict.cwl#lcz_predict_processor/output' previously defined
INFO [workflow ] start
INFO [workflow ] starting step processor
INFO [step processor] start
INFO [job processor] /tmp/bmghdjzm$ docker \
    run \
    -i \
    --mount=type=bind,source=/tmp/bmghdjzm,target=/XoFJaz \
    --mount=type=bind,source=/tmp/iwdeu_8d,target=/tmp \
    --mount=type=bind,source=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/software/heatwise-lcz-classification/examples/predict_config_sample_docker.yaml,target=/var/lib/cwl/stgf2d74a5d-4b3c-4068-839d-ff423564f151/predict_config_sample_docker.yaml,readonly \
    --mount=type=bind,source=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/inputs/lcz-classification/Berlin,target=/var/lib/cwl/stg3cf994df-386c-4116-bfd7-07d2fc28e98d/Berlin,readonly \
    --mount=type=bind,source=/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/inputs/lcz-classification/Berlin/best_model_HSI-BS.pth,target=/var/lib/cwl/stg0c23a526-d8f6-4e4c-a95a-cd5afbc7703c/best_model_HSI-BS.pth,readonly \
    --workdir=/XoFJaz \
    --read-only=true \
    --net=none \
    --user=1001:1001 \
    --rm \
    --cidfile=/tmp/7ilpl7sq/20261127104833-436516.cid \
    --env=TMPDIR=/tmp \
    --env=HOME=/XoFJaz \
    ghcr.io/esa-heatwise/heatwise-lcz-classification:1.0.0 \
    python \
    /app/processor.py \
    predict \
    --config \
    /var/lib/cwl/stgf2d74a5d-4b3c-4068-839d-ff423564f151/predict_config_sample_docker.yaml \
    --input-catalog \
    /var/lib/cwl/stg3cf994df-386c-4116-bfd7-07d2fc28e98d/Berlin/catalog.json \
    --output \
    Berlin_LCZ_sample.tif \
    --weights \
    /var/lib/cwl/stg0c23a526-d8f6-4e4c-a95a-cd5afbc7703c/best_model_HSI-BS.pth
/usr/local/lib/python3.11/site-packages/torch/nn/modules/conv.py:196: UserWarning: Initializing zero-element tensors is a no-op
  init.kaiming_uniform_(self.weight, a=math.sqrt(5))
[predict_map] modal=hsi  use_lst=False  device=cpu
[predict_map] Image 810x537, stacked channels=30, valid pixels=434858
[predict_map] Windows to predict: 1564
  progress 32/1564

[predict_map] Saved LCZ map: Berlin_LCZ_sample.tif
Per-class pixel counts: {2: 160768, 5: 14592, 6: 172800, 8: 21504, 11: 17408, 12: 9728, 17: 3584}
[predict_map] Saved color preview: Berlin_LCZ_sample_preview.png
[processor] Output LCZ map: Berlin_LCZ_sample.tif
[processor] Output STAC catalog: /XoFJaz/catalog.json
INFO [job processor] Max memory used: 1438MiB
INFO [job processor] completed success
INFO [step processor] completed success
INFO [workflow ] completed success
{
    "output": {
        "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm",
        "basename": "bmghdjzm",
        "class": "Directory",
        "listing": [
            {
                "class": "File",
                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/Berlin_LCZ_sample_preview.png",
                "basename": "Berlin_LCZ_sample_preview.png",
                "size": 35393,
                "checksum": "sha1$309d06ace65acc4b24e083ec6c9defbe3c35d564",
                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/Berlin_LCZ_sample_preview.png"
            },
            {
                "class": "Directory",
                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.cache",
                "basename": ".cache",
                "listing": [
                    {
                        "class": "Directory",
                        "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.cache/matplotlib",
                        "basename": "matplotlib",
                        "listing": [
                            {
                                "class": "File",
                                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.cache/matplotlib/fontlist-v3.11.0.json",
                                "basename": "fontlist-v3.11.0.json",
                                "size": 29302,
                                "checksum": "sha1$4681fa498c0395154bb40dab213543c2124305dc",
                                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.cache/matplotlib/fontlist-v3.11.0.json"
                            }
                        ],
                        "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.cache/matplotlib"
                    }
                ],
                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.cache"
            },
            {
                "class": "File",
                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/catalog.json",
                "basename": "catalog.json",
                "size": 304,
                "checksum": "sha1$5b0fcd979b72e74d00adbd25d80c63410e81df1b",
                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/catalog.json"
            },
            {
                "class": "File",
                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/Berlin_LCZ_sample.tif",
                "basename": "Berlin_LCZ_sample.tif",
                "size": 6586,
                "checksum": "sha1$3616232271748ada8a0041292c89f036b428f21c",
                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/Berlin_LCZ_sample.tif"
            },
            {
                "class": "File",
                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/lcz_prediction_item.json",
                "basename": "lcz_prediction_item.json",
                "size": 1391,
                "checksum": "sha1$253bf102228f616bd1e1ca13f88c84ac6e215d5a",
                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/lcz_prediction_item.json"
            },
            {
                "class": "Directory",
                "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.config",
                "basename": ".config",
                "listing": [
                    {
                        "class": "Directory",
                        "location": "file:///home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.config/matplotlib",
                        "basename": "matplotlib",
                        "listing": [],
                        "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.config/matplotlib"
                    }
                ],
                "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/.config"
            }
        ],
        "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm"
    }
}INFO Final process status is success

Cwltool creates a new output directory with a random name when it is run. We save the last run in a variable to access it later.

CWLRUN_PATH=$(find-newest-directory-entry.sh "$OUTPUT_PATH/cwlruns")
echo "Path to last cwl run: $CWLRUN_PATH"
Path to last cwl run: /home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm

11.3.2.1 Requirements Validated

req/app-pck/cwl (Requirement 7)

The Application Package SHALL be a valid CWL document with a “Workflow” class and one or more “CommandLineTool” classes.

11.3.2.2 EOAP Output

tree -n $CWLRUN_PATH || :
/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm
├── Berlin_LCZ_sample.tif
├── Berlin_LCZ_sample_preview.png
├── catalog.json
└── lcz_prediction_item.json

1 directory, 4 files

The EOAP produces a colour preview of the LCZ classification map, referenced as asset preview in its output STAC item:

python -c "import json, pathlib, shutil; \
    item_path = pathlib.Path(\"$CWLRUN_PATH/lcz_prediction_item.json\"); \
    preview = json.loads(item_path.read_text())['assets']['preview']['href']; \
    shutil.copy(item_path.parent / preview, 'lcz_classification_map.png')" || :

LCZ classification map

11.4 STAC input / output

11.4.1 Inputs

The EO Products of the input are provided as directories with a catalog.json describing the products each:

ls -lAhX --color=never $INPUT_PATH/*
total 96M
-rw-r--r-- 1 runner runner  40M Nov 27 10:37 Berlin_patches.h5
-rw-r--r-- 1 runner runner 1.2K Nov 27 10:37 Berlin_inputs_item.json
-rw-r--r-- 1 runner runner  895 Nov 27 10:37 Berlin_patches_item.json
-rw-r--r-- 1 runner runner  470 Nov 27 10:37 catalog.json
-rw-r--r-- 1 runner runner 1.1M Nov 27 10:37 best_model_HSI-BS.pth
-rw-r--r-- 1 runner runner 9.9M Nov 27 10:37 Berlin_S2.tif
-rw-r--r-- 1 runner runner  45M Nov 27 10:37 Berlin_hsi_bs.tif
-rw-r--r-- 1 runner runner 1.4M Nov 27 10:37 Berlin_lst_final.tif

These same inputs are classed as Directory in the workflow:

extract-directory-inputs-from.sh Workflow "$CWL_PATH" || FAIL_REQ_4=1
Running
inputs_with_directory_type:
  - id: input_catalog
    type: Directory
    label: input STAC catalog
    doc: 'Directory containing a STAC catalog named catalog.json referencing

      the staged hyperspectral, Sentinel-2, and optional LST input

      products required for LCZ prediction.

      '

11.4.2 Outputs

The output contains a single catalog.json and item, describing the output. Using the recursive validation, both the catalog and item are confirmed to be valid STAC.

(stac-validator validate --recursive $CWLRUN_PATH/catalog.json | cat) || FAIL_REQ_5=1

Thanks for using STAC version 1.1.0!

[
    {
        "version": "1.1.0",
        "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/catalog.json",
        "schema": [
            "https://schemas.stacspec.org/v1.1.0/catalog-spec/json-schema/catalog.json"
        ],
        "valid_stac": true,
        "asset_type": "CATALOG",
        "validation_method": "recursive",
        "validator_engine": "jsonschema"
    },
    {
        "version": "1.1.0",
        "path": "/home/runner/work/heatwise-interoperability-demonstration/heatwise-interoperability-demonstration/outputs/lcz-classification/cwlruns/bmghdjzm/lcz_prediction_item.json",
        "schema": [
            "https://stac-extensions.github.io/processing/v1.2.0/schema.json",
            "https://schemas.stacspec.org/v1.1.0/item-spec/json-schema/item.json"
        ],
        "valid_stac": true,
        "asset_type": "ITEM",
        "validation_method": "recursive",
        "validator_engine": "jsonschema"
    }
]

-- Recursive Validation Summary:
  Stac objects passed: 2/2 (100.0%)

  Breakdown by type:
    Catalog: 1/1 (100.0%)
    Item: 1/1 (100.0%)

Validation completed in 457.52ms

The EOAP best practice mandates that the item contains at least geometry, bbox and datetime keys.

extract-output-keys-from-stac-item.sh $CWLRUN_PATH/lcz_prediction_item.json || FAIL_REQ_6=1
geometry:
  type: Polygon
  coordinates: '[...truncated...]'
bbox:
  - 13.255963533307378
  - 52.448078953513594
  - 13.33782034204588
  - 52.5220055613443
properties:
  datetime: null
  start_datetime: '2009-08-20T00:00:00Z'
  end_datetime: '2023-07-09T23:59:59Z'

Required keys present: true

11.4.3 Requirements Validated

req/app/stac-input (Requirement 4)

An Application input argument that requires staged EO product files SHALL be defined as an argument that points to a folder where a STAC Catalog, named catalog.json, contains a list of one or more STAC Items and associated STAC Assets referencing the files.

req/app/stac-out (Requirement 5)

An Application that creates EO product files to be stage-out SHALL generate a valid STAC Catalog, named catalog.json, and include the STAC Item(s) and corresponding STAC Assets pointing to the results of the processing.

rec/app/stac-out-metadata (Requirement 6)

The STAC Catalog created by the Application SHALL include metadata elements for each STAC Item with at least their spatial (geometry, box) and temporal (datetime) properties.

11.5 CWL

The fields id, baseCommand, inputs, requirements should be present in the CommandLineTool. One of the requirements should be DockerRequirement.

check-commandlinetool-fields.sh "$CWL_PATH" || FAIL_REQ_8=1
id: lcz_predict_processor
baseCommand: python
requirements:
  DockerRequirement:
    dockerPull: ghcr.io/esa-heatwise/heatwise-lcz-classification:1.0.0
  InlineJavascriptRequirement: {}
Required keys present: true

The fields id, label, and doc should be present in the Workflow.

check-workflow-fields.sh "$CWL_PATH" || FAIL_REQ_9=1
id: main
label: HEATWISE LCZ Prediction Workflow
doc: 'EOAP-compatible HEATWISE LCZ whole-scene prediction workflow.


  The workflow performs sliding-window LCZ inference using aligned

  hyperspectral and Sentinel-2 imagery, with optional LST information,

  and a trained LCZ_HMSSNet model checkpoint.


  EO raster inputs are provided through a staged STAC catalog directory.

  The trained model checkpoint is provided as a separate file input.

  The processor generates an LCZ classification map GeoTIFF, an optional

  preview PNG, and an output STAC catalog describing the generated product.

  '
Required keys present: true

Each input of the Workflow should have fields id, label, and doc

check-workflow-input-fields.sh $CWL_PATH || FAIL_REQ_10=1
inputs:
  - id: 0
    label: prediction configuration
    doc: 'YAML configuration controlling LCZ inference, including modality,

      model architecture, class ordering, patch size, stride, batch size,

      scaling, nodata handling, and preview generation.


      EO raster paths and model weights are not provided through this

      configuration in the EOAP workflow.

      '
  - id: 1
    label: input STAC catalog
    doc: 'Directory containing a STAC catalog named catalog.json referencing

      the staged hyperspectral, Sentinel-2, and optional LST input

      products required for LCZ prediction.

      '
  - id: 2
    label: trained model checkpoint
    doc: 'Trained LCZ_HMSSNet checkpoint used for whole-scene prediction.

      '
  - id: 3
    label: output LCZ map filename
    doc: 'Output LCZ classification GeoTIFF path relative to the CWL working

      directory.

      '

The CWL document should contain a version:

check-version.sh $CWL_PATH || FAIL_REQ_11=1
s:version: 1.0.0
https://schema.org/version: null
Found version:  true

11.5.1 Requirements Validated

req/app-pck/clt (Requirement 8)

The Application Package CWL CommandLineTool classes SHALL contain the following elements:

  • Identifier (“id”)
  • Command line name (“baseCommand”)
  • Input parameters (“inputs”)
  • Environment requirements (“requirements”)
  • Docker information (“DockerRequirement”)

req/app-pck/wf (Requirement 9)

The Application Package CWL Workflow class SHALL contain the following elements:

  • Identifier (“id”)
  • Title (“label”)
  • Abstract (“doc”)

req/app-pck/wf-inputs (Requirement 10)

The Application Package CWL Workflow class “inputs” fields SHALL contain the following elements:

  • Identifier (“id”)
  • Title (“label”)
  • Abstract (“doc”)

req/app-pck/metadata (Requirement 11)

The Application Package CWL Workclass classes SHALL include additional metadata as defined in Table 1

Required in table 1: version

11.6 CWL STAC / IO

Inputs and outputs are staged in and out using STAC catalogs. Each input that is an “EO Product” like a vector or raster dataset is declared as type Directory and is described by a STAC catalog catalog.json and accompanying STAC item(s) placed in that directory.

Outputs are handled in much the same way, the application in the application package is responsible for generating a STAC catalog (also named catalog.json) and stage out all the contents of its working directory together with the STAC metadata describing the outputs.

11.6.1 Inputs

There are inputs of type directory in the CommandLineTool description.

extract-directory-inputs-from.sh CommandLineTool "$CWL_PATH" || FAIL_REQ_12=1
Running
inputs_with_directory_type:
  - type: Directory
    label: input STAC catalog
    doc: 'Directory containing catalog.json and the associated STAC Items

      and Assets for the staged hyperspectral, Sentinel-2, and optional

      LST EO products.


      The path to catalog.json inside this directory is passed to the

      processor through the --input-catalog argument.

      '
    inputBinding:
      prefix: --input-catalog
      valueFrom: $(self.path + "/catalog.json")

There are inputs of type directory in the Workflow description.

extract-directory-inputs-from.sh Workflow "$CWL_PATH" || FAIL_REQ_13=1
Running
inputs_with_directory_type:
  - id: input_catalog
    type: Directory
    label: input STAC catalog
    doc: 'Directory containing a STAC catalog named catalog.json referencing

      the staged hyperspectral, Sentinel-2, and optional LST input

      products required for LCZ prediction.

      '

11.6.2 Outputs

The CommandLineTool stages out all the contents of the working directory.

extract-commandlinetool-outputs.sh "$CWL_PATH" || FAIL_REQ_14=1
output:
  type: Directory
  doc: 'Complete CWL working directory containing all files produced by

    the processor, including the LCZ classification GeoTIFF, optional

    preview PNG, and generated STAC catalog.

    '
  outputBinding:
    glob: .
Extracts all items from Working directory: true

11.6.3 Requirements validated

req/app-pck-stage-in/clt-stac (Requirement 12)

All input parameters of the CWL ComandLineTool that require the staging of EO products SHALL be of type Directory.

req/app-pck-stage-in/wf-stac (Requirement 13)

Input parameters of the CWL Workflow that require the staging of EO products SHALL be of type Directory.

req/app-pck-stage-out/output-stac (Requirement 14)

The outputs field of the CommandLineTool that requires the stage-out of EO products SHALL retrieve all the files produced in the working directory.

11.7 Summary

for i in {1..14}; do
    var="FAIL_REQ_$i"
    req=${var#FAIL_}
    if [[ "${!var:-}" == "1" ]]; then
        #echo "$req: FAILED"
        printf '%s\t\033[31mFAILED\033[0m\n' "$req"
    else
        printf '%s\t\033[32mPASSED\033[0m\n' "$req"
    fi
done
REQ_1  PASSED

REQ_2   PASSED

REQ_3   PASSED

REQ_4   PASSED

REQ_5   PASSED

REQ_6   PASSED

REQ_7   PASSED

REQ_8   PASSED

REQ_9   PASSED

REQ_10  PASSED

REQ_11  PASSED

REQ_12  PASSED

REQ_13  PASSED

REQ_14  PASSED

The classification step of the Local Climate Zone classification software has been shown to be non-interactively executable from the command line and using a CWL runner (cwltool). Furthermore it follows the CWL structure and mandatory fields prescribed by the OGC Best Practice for Earth Observation Application Package (EOAP). Inputs and outputs are processed as CWL Directories and valid STAC metadata is generated for the output. It may therefore be concluded that the software behaves as expected by the EOAP best practice in the example scenario.

No conclusive judgment on the adherence to all requirements listed in Chapter 2 under all valid input conditions can be made without inspection of the source code. The demonstration evaluates the statically available information (the CWL document, and container image) as well as the outputs produced by a single example input dataset. It does not show how the validity and content of the generated output depends on the input dataset. While inputs are shown to be a directory containing STAC metadata, only inspection of the source code can establish whether the STAC is actually processed.

Furthermore, the demonstration purely evaluates the adherence of the software to the interoperability best practice and makes no attempt to judge the scientific validity of the data products produced.