name: "PNW Forest Disturbance — LandTrendr"
description: >
  Temporal segmentation of Landsat NBR time series for Pacific Northwest
  industrial forest. Detects clearcut harvests and regrowth using the
  LandTrendr algorithm (Kennedy et al. 2010) — running entirely in the
  browser.

  Reference site: -123.845, 45.889 (conifer-dominated industrial forest,
  Oregon Coast Range). This pixel shows ~17 years of stable mature forest,
  a clearcut harvest in 2001-2002, and subsequent regeneration.

reproduction:
  paper:
    title: "Detecting trends in forest disturbance and recovery using yearly Landsat time series: 1. LandTrendr — Temporal Segmentation Algorithms"
    authors: ["Kennedy, R.E.", "Yang, Z.", "Cohen, W.B."]
    year: 2010
    doi: "10.1016/j.rse.2010.07.008"
    journal: "Remote Sensing of Environment"
    volume: 114
    issue: 12
    pages: "2897-2910"
  quality_tier: recipe      # narrative/visual validation only
  validation_status: unvalidated   # no automated quantitative check
  method_ops: [imagery_composite, landtrendr]
  study_period:
    start: "2000-01-01"
    end: "2024-12-31"
  study_area:
    name: "Oregon Coast Range (PNW industrial forest)"
    bbox: [-123.95, 45.82, -123.75, 45.95]
  reference_pixel:
    lon: -123.845
    lat: 45.889
    description: >
      Conifer-dominated industrial forest. ~17 years stable mature
      forest, clearcut harvest 2001-2002, subsequent regeneration.
  known_divergences:
    - id: simultaneous-fitting
      description: >
        Simultaneous least-squares fitting (tridiagonal solve) replaces
        original sequential anchored regression (Kennedy 2010 Section 2.5.3).
    - id: model-selection-threshold
      description: >
        F-test model selection sometimes picks a more complex model than
        GEE on stable pixels, yielding nonzero RMSE where GEE returns 0.
    - id: browser-native
      description: >
        WASM build processes viewport only. Same Rust core as local/cloud.
    - id: landsat-generation
      description: >
        Original paper used Landsat 5/7. This demo uses Landsat 8/9 C2 L2.

settings:
  # Small bbox centered on the reference pixel for browser performance
  default_bbox: [-123.95, 45.82, -123.75, 45.95]
  theme: light

layers:
  # Annual Landsat composites via Planetary Computer (signed, CORS-enabled)
  # Annual Landsat scenes (summer, sorted by cloud cover) — 10 years
  landsat-nbr:
    type: raster
    uri: "stac://microsoft-pc/landsat-c2-l2"
    params:
      bands: [nir08, swir16]
      limit: 75
      temporal: ["2000-06-01", "2024-09-30"]
      sort: "eo:cloud_cover"
      method: median
      group_by: year

  # RGB composites for filmstrip pixel inspector (not rendered on map)
  landsat-rgb:
    type: raster
    uri: "stac://microsoft-pc/landsat-c2-l2"
    visible: false
    params:
      bands: [red, green, blue]
      limit: 75
      temporal: ["2000-06-01", "2024-09-30"]
      sort: "eo:cloud_cover"
      method: median
      group_by: year
      passthrough: true

  # LandTrendr disturbance map
  disturbance:
    type: raster
    compute:
      op: landtrendr
      inputs:
        time_series: { layer: landsat-nbr }
      params:
        max_segments: 6
        spike_threshold: 0.9
        recovery_threshold: 0.25
    style:
      palette: rdylgn
      clim: [-0.5, 0.5]
      form:
        spike_threshold:
          type: slider
          label: "Spike Threshold"
          min: 0.5
          max: 1.0
          step: 0.05
          default: 0.9
        max_segments:
          type: slider
          label: "Max Segments"
          min: 2
          max: 10
          step: 1
          default: 6
        recovery_threshold:
          type: slider
          label: "Recovery Threshold"
          min: 0.1
          max: 1.0
          step: 0.05
          default: 0.25

views:
  - name: "All Layers"
    layers: [landsat-nbr, disturbance]
  - name: "NBR Composite"
    layers: [landsat-nbr]
  - name: "Disturbance Map"
    layers: [disturbance]
