# NOTE (2026-07-01, sdk/016): the QA/SCL-bit masking ops are now their own records —
# cloud_mask_landsat_c2.yaml + cloud_mask_sentinel2.yaml (engine-dispatched, ADR-0065
# op identities). This record describes a generic BRIGHTNESS-THRESHOLD mask, but its
# rust-wasm backend pointer references the QA-bit kernel — a semantic mismatch flagged
# for the registry reconcile pass; do not wire new work against this record.
id: cloud_mask
name: Cloud Mask
description: >
  Mask cloudy pixels by thresholding brightness values.
  Pixels above the threshold are set to NaN.
version: 1.0.0
category: analysis
type: raster-to-raster

inputs:
  - name: data
    type: raster
    description: Input raster (e.g., Landsat QA band or brightness)
    required: true

requires:
  # Brightness-threshold cloud masking; canonical visible+NIR bands.
  # Sensor-specific implementations may use QA bitmasks instead.
  bands: [blue, green, red, nir]

outputs:
  - name: masked
    type: raster
    format: cog
    dtype: float32
    concept: cloud-mask
    description: Raster with cloudy pixels set to NaN

params:
  threshold:
    type: number
    default: 0.3
    description: Brightness threshold above which pixels are masked

# backends: audited 2026-08-14 (defect 50). A key means a runtime that DISPATCHES this op —
# folia-engine `dispatch_op` (products/sdk/folia-engine/src/lib.rs), a `registerOp`/OP_TABLE
# entry in packages/compute, `_BUILTIN_OP_MAP` in folia/compute.py, or a backend manifest
# (folia/backends/*/backend.yaml).
backends:
  rust-wasm:
    function: temporal_ops::cloud_mask_landsat
    handle_function: h_cloud_mask_landsat
  js:
    function: cloud_mask
