# catalog/operations/raster/normalize.yaml

id: raster_normalize
name: Normalize
description: >
  Normalize raster values using various methods. Useful for preparing data
  for visualization or machine learning. Output is always float32.
version: 1.0.0
category: raster
type: raster-to-raster
default_implementation: native

inputs:
  - name: raster
    type: raster
    format: geotiff
    description: Input raster to normalize
    required: true

requires: {}  # structural — operates on any raster

outputs:
  - name: normalized
    type: raster
    format: cog
    dtype: float32
    description: Normalized raster

params:
  method:
    type: enum
    default: minmax
    enum: [minmax, zscore, quantile, log]
    description: >
      Normalization method:
      - minmax: scale to output_range using min/max
      - zscore: standardize using mean and std
      - quantile: robust scaling using percentiles
      - log: log transform then scale to output_range
  output_range:
    type: array
    default: [0.0, 1.0]
    description: Target range for normalized values (minmax, quantile, log methods)
  percentile_range:
    type: array
    default: [2, 98]
    description: Percentiles to use for quantile method

cache_policy:
  ttl_days: 30
  invalidate_on: [source_update, param_change]

# 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:
  python:
    function: geo.raster.normalize
    dispatch: folia/compute.py _BUILTIN_OP_MAP

display_hints:
  map:
    renderer: maplibre
    palette: sequential

ui:
  icon: sliders
  color: "#20B2AA"
