# Flood Property Risk — National Harbor, Maryland
#
# "The hotel you're standing in right now has a flood risk score."
#
# The Gaylord National Resort & Convention Center — the venue for
# ClimateTech Connect 2026 — sits on the Potomac River waterfront
# in National Harbor, MD. It is in a FEMA flood zone. The parking
# garage has flooded. The Potomac rises.
#
# This demo computes flood risk for any US address from raw elevation
# data, satellite-derived land cover, FEMA regulatory zones, and
# physics-based flood models. Full provenance. Every layer auditable.
#
# ─── WHY THIS LOCATION ───────────────────────────────────────────
#
# National Harbor (Oxon Hill, MD) sits at the confluence of the
# Potomac River and Broad Creek, 10 miles south of DC. The venue is
# built on reclaimed waterfront at ~3m above mean sea level. Across
# the river, Alexandria's Old Town floods regularly during king tides
# and nor'easters. The Anacostia waterfront in DC is one of the most
# flood-vulnerable urban corridors on the East Coast.
#
# FEMA Zone AE (1% annual chance flood) covers the Potomac
# waterfront. Climate change projections show 0.3-1.0m of sea level
# rise in the Chesapeake Bay by 2050, which would put the convention
# center's ground floor at risk during storm surge events.
#
# Everyone in this room insures properties like this one.
#
# ─── THE PITCH ────────────────────────────────────────────────────
#
# "Right now, you're standing in a FEMA flood zone. The Potomac is
#  300 meters from this room. Let me show you your flood risk."
#
#  [types venue address — map zooms to National Harbor]
#  [blue flood risk overlay appears around the venue]
#  [clicks venue location — "Flood risk: 67/100"]
#
# "Every layer you see traces back to source data — FEMA, USGS,
#  ESA, Deltares. Full provenance. No black box.
#
#  Now give me YOUR address."
#
# ─── PIPELINE ─────────────────────────────────────────────────────
#
#   source/dem ──────────── terrain/slope ──────────────────┐
#                    │            └── terrain/twi ──────────┤
#                    └───── terrain/hillshade               │
#                    └───── hydro/breached-dem              │
#                              └── hydro/flow-direction     │
#                                    └── hydro/flow-accum ──┤
#                    └───── sea-level/inundation-1m         │
#                    └───── sea-level/inundation-2m         │
#                                                           │
#   source/landcover ──────── hydro/impervious ────────────┤
#                                                           │
#   source/fema-zones ─────────────────────────────────────┤
#                                                           │
#   source/flood-depth ────────────────────────────────────┤
#                                                           │
#   source/daymet ──────── hydro/precipitation ────────────┤
#                                                           ▼
#                                              risk/flood
#                                                   │
#                                              risk/flood-classified
#                                                   │
#   source/population ─── exposure/population ─── analysis/exposure
#
# ─── DATA SOURCES ─────────────────────────────────────────────────
#
#   Copernicus DEM GLO-30          ESA / Airbus         Open License
#   ESA WorldCover 2021            ESA / Copernicus     CC-BY-4.0
#   FEMA NFHL                      FEMA                 Public Domain
#   Deltares Global Flood Maps     Deltares             CC-BY-4.0
#   Daymet Daily NA                ORNL DAAC            Public Domain
#   Census ACS Tracts              US Census            Public Domain
#
# Usage:
#   folia validate demos/flood-property-risk/folia.yaml
#   folia run demos/flood-property-risk
#
# See also:
#   - docs/use_cases/climate-risk-data-supplier.md (UC-033)
#   - docs/contacts/climatech-connect-2026/ (buyer contacts)

name: flood-property-risk
version: "1.0"
description: >
  Property-level flood risk assessment from raw elevation data, FEMA
  zones, physics-based flood models, and satellite land cover. Type
  an address — see terrain drainage, impervious runoff, regulatory
  flood zones, and a composite risk score. Full provenance.
  National Harbor, MD — the ClimateTech Connect 2026 venue.

settings:
  # National Harbor → Alexandria → DC waterfront
  # Captures: Gaylord National (venue), Old Town Alexandria, Anacostia,
  # Reagan Airport, Navy Yard — all flood-vulnerable areas
  # Bbox stays within one Copernicus DEM tile (N38W078: -78 to -77)
  # to avoid multi-tile merge alignment issues.
  # Centered on National Harbor / Oxon Hill / Alexandria waterfront.
  default_bbox: [-77.15, 38.73, -77.01, 38.88]
  default_crs: EPSG:4326
  address_search: true

layers:

  # ================================================================
  #  SOURCE DATA
  #
  #  Six federal/open datasets. Everything you need to assess flood
  #  risk at the property level. No proprietary data. No special
  #  access. No license fees. Just public infrastructure data
  #  that every insurance company ingests independently.
  # ================================================================

  source/dem:
    uri: stac://microsoft-pc/cop-dem-glo-30
    type: raster
    description: >
      Copernicus DEM GLO-30 — 30m global elevation. The foundation
      of every flood model. Water flows downhill. Elevation determines
      where it goes, how fast, and how deep it gets.

      National Harbor sits at ~3m above mean sea level on the Potomac
      waterfront. Old Town Alexandria across the river is even lower.
      The Anacostia River corridor in DC is a natural floodplain that
      the city built on anyway.

      For US properties, USGS 3DEP (1-3m LiDAR) provides higher
      resolution. We use Copernicus for global coverage. Same pipeline,
      swap one URI for another.
    metadata:
      provider: ESA / Airbus
      license: Copernicus DEM License
      concepts: [elevation, terrain]

  source/landcover:
    uri: stac://microsoft-pc/esa-worldcover
    type: raster
    description: >
      ESA WorldCover 2021 — 10m land cover. Class 50 = built-up
      (impervious surface). Impervious surface is the #1 driver of
      urban flooding — rain that would soak into soil instead runs
      off concrete and asphalt into storm drains, channels, and
      your basement.

      The DC metro area is heavily developed. National Harbor is a
      concrete-and-glass development on filled waterfront land.
      Impervious fraction here approaches 90%.
    metadata:
      provider: ESA / Copernicus
      license: CC-BY-4.0
      concepts: [land-cover, impervious-surface]

  source/fema-zones:
    uri: https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer/28/query?where=1%3D1&geometry=-77.15,38.73,-77.01,38.88&geometryType=esriGeometryEnvelope&inSR=4326&outFields=FLD_ZONE,ZONE_SUBTY,SFHA_TF,STATIC_BFE&outSR=4326&f=geojson&resultRecordCount=5000
    type: vector
    description: >
      FEMA National Flood Hazard Layer (NFHL) — the regulatory
      standard for flood risk in the United States. Zone designations:

        AE  — 1% annual chance flood (100-year), with base flood
              elevation determined. Mandatory flood insurance.
        A   — 1% annual chance, no BFE determined.
        VE  — Coastal high hazard (wave action). Strictest building
              codes. Mandatory insurance.
        X   — 0.2% annual chance (500-year) or minimal risk.

      The Potomac waterfront at National Harbor is Zone AE. Old Town
      Alexandria is Zone AE. The Anacostia corridor has both AE and
      VE designations.

      FEMA maps are the floor, not the ceiling. They're based on
      historical data and don't account for climate change. The real
      risk is worse than what these maps show.
    style:
      renderer: maplibre
      fill-opacity: 0.4
      stroke-width: 0.8
      categorize:
        field: FLD_ZONE
        values:
          VE: "#08306b"
          AE: "#2171b5"
          A: "#6baed6"
          AO: "#9ecae1"
          AH: "#9ecae1"
          X: "#c6dbef"
          default: "#deebf7"
      info:
        fields: [FLD_ZONE, ZONE_SUBTY, STATIC_BFE]
        format: "FEMA Zone {FLD_ZONE} ({ZONE_SUBTY}) — BFE: {STATIC_BFE} ft"
        section: Regulatory
      legend:
        title: "FEMA Flood Zones"
        items:
          - { label: "VE — Coastal High Hazard", color: "#08306b" }
          - { label: "AE — 1% Annual Chance", color: "#2171b5" }
          - { label: "A — 1% (No BFE)", color: "#6baed6" }
          - { label: "X — Minimal Risk", color: "#c6dbef" }

  source/flood-depth:
    uri: stac://microsoft-pc/deltares-floods
    type: raster
    description: >
      Deltares Global Flood Maps — physics-based modeled flood extent
      and depth for multiple return periods. Uses MERIT DEM, NASADEM,
      and LiDAR-derived elevation with GTSMip6 storm surge forcing.

      This is what FEMA maps SHOULD look like — continuous depth
      estimates, not just zone boundaries. A house in Zone AE might
      get 0.3m or 3.0m of water depending on its exact elevation.
      Deltares shows the difference. FEMA doesn't.

      We use the 100-year return period to match FEMA's 1% annual
      chance standard, but Deltares provides 2yr through 1000yr.
    metadata:
      provider: Deltares
      license: CC-BY-4.0
      params:
        return_period: 100
      concepts: [flood, hydrology, inundation]

  source/daymet:
    uri: stac://microsoft-pc/daymet-daily-na
    type: raster
    description: >
      Daymet daily surface weather — 1km gridded for North America.
      Precipitation totals show how much rain a location receives.
      The DC metro area averages ~1000mm/year, but intense summer
      thunderstorms can drop 50-100mm in an hour. That's when
      urban flooding happens — storm drains can't keep up.
    metadata:
      provider: ORNL DAAC
      license: Public Domain
      concepts: [weather, precipitation]

  source/population:
    uri: https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/tigerWMS_Current/MapServer/8/query?where=STATE+IN+(%2724%27,%2711%27,%2751%27)&geometry=-77.15,38.73,-77.01,38.88&geometryType=esriGeometryEnvelope&inSR=4326&outFields=GEOID,BASENAME,POP100,AREALAND&outSR=4326&f=geojson&resultRecordCount=5000
    type: vector
    description: >
      Census tract population — Maryland (24), DC (11), Virginia (51).
      How many people are exposed to flood risk? The Potomac waterfront
      corridor from Alexandria through National Harbor to DC houses
      hundreds of thousands of residents plus millions of daily
      commuters and visitors.
    style:
      renderer: maplibre
      fill: "#1565C0"
      fill-opacity: 0.2
      stroke: "#0D47A1"
      stroke-width: 0.3
      info:
        fields: [BASENAME, POP100]
        format: "{BASENAME}: {POP100:,} people"
        section: Demographics

  # ================================================================
  #  TERRAIN ANALYSIS
  #
  #  Water flows downhill. Terrain tells you where.
  # ================================================================

  terrain/slope:
    type: raster
    description: >
      Slope in degrees. The inverse of slope is flatness — flat areas
      accumulate water, steep areas shed it. The Potomac floodplain
      is nearly flat (<2°). National Harbor is built on flat, low-lying
      land at the river's edge. Water has nowhere to go.
    compute:
      op: terrain_slope
      params:
        units: degrees
      inputs:
        dem: { layer: source/dem }
    style:
      renderer: maplibre
      opacity: 0.7
      colorRamp:
        - { value: 0, color: "#08306b", label: "Flat (flood risk)" }
        - { value: 5, color: "#2171b5" }
        - { value: 10, color: "#6baed6" }
        - { value: 20, color: "#c6dbef" }
        - { value: 30, color: "#f7fbff", label: "Steep (sheds water)" }
      info:
        fields: [value]
        format: "Slope: {value:.1f}°"
        section: Terrain

  terrain/hillshade:
    type: raster
    description: >
      Hillshade relief — shows the Potomac River valley, Broad Creek,
      and the low-lying areas where National Harbor was built.
    compute:
      op: terrain_hillshade
      params:
        azimuth: 315
        altitude: 45
      inputs:
        dem: { layer: source/dem }
    style:
      renderer: maplibre
      opacity: 0.4
      colorRamp:
        - { value: 0, color: "#000000" }
        - { value: 255, color: "#ffffff" }

  # ================================================================
  #  HYDROLOGY
  #
  #  Where does water flow? How fast does it run off? These layers
  #  answer the physics questions that FEMA zone boundaries can't.
  # ================================================================

  hydro/breached-dem:
    type: raster
    description: >
      Depression-breached DEM — artificial depressions in the elevation
      model are removed so water can flow continuously downhill to the
      river. Without this preprocessing, flow routing gets stuck in
      DEM artifacts (bridges, overpasses, data gaps). This is the
      standard first step in any hydrological analysis.
    compute:
      op: breach_depressions
      inputs:
        dem: { layer: source/dem }

  hydro/flow-direction:
    type: raster
    description: >
      D8 flow direction — for each cell, which of its 8 neighbors
      does water flow toward? Computed from the breached DEM using
      the steepest-descent algorithm. This is the routing grid that
      all downstream analysis depends on.
    compute:
      op: flow_direction_d8
      inputs:
        dem: { layer: hydro/breached-dem }

  hydro/flow-accumulation:
    type: raster
    description: >
      Flow accumulation — how many upstream cells drain through each
      cell? High values = drainage channels where water concentrates.
      The Potomac River has the highest accumulation. Broad Creek
      (which flows past National Harbor) and Four Mile Run (Alexandria)
      show as bright drainage lines.

      This layer reveals the invisible hydrology underneath the
      pavement. Urban flooding happens where these natural drainage
      channels have been paved over but the water still comes.
    compute:
      op: flow_accumulation
      inputs:
        flow_direction: { layer: hydro/flow-direction }
    style:
      renderer: maplibre
      opacity: 0.8
      colorRamp:
        - { value: 0, color: "#f7fbff" }
        - { value: 10, color: "#c6dbef" }
        - { value: 100, color: "#6baed6", label: "Minor channel" }
        - { value: 1000, color: "#2171b5", label: "Major channel" }
        - { value: 10000, color: "#08306b", label: "River" }
      info:
        fields: [value]
        format: "Upstream cells: {value:,.0f}"
        section: Hydrology

  terrain/twi:
    type: raster
    description: >
      Topographic Wetness Index — TWI = ln(a / tan β), where a is upstream
      contributing area (proxied by flow accumulation × cell width) and β is
      slope. The canonical hydrological "where does water sit" derivative
      (Beven & Kirkby 1979). High TWI = flat land downstream of a large
      contributing area = wet. Low TWI = ridges or steep terrain = dry.

      Typical range: ~1 (ridges) to ~25 (river floodplains). National Harbor
      and Old Town Alexandria sit on the wet end of this scale; the Maryland
      ridges to the north show low TWI.
    compute:
      op: raster_calc
      params:
        expression: >
          log(
            (max(flow_accum, 1.0) * 30.0) /
            max(tan(slope * 0.017453292519943295), 0.01)
          )
        output_band: twi
      inputs:
        flow_accum: { layer: hydro/flow-accumulation }
        slope: { layer: terrain/slope }
    style:
      renderer: maplibre
      opacity: 0.7
      colorRamp:
        - { value: 1, color: "#fff7bc", label: "Dry (ridges)" }
        - { value: 8, color: "#fec44f" }
        - { value: 12, color: "#41b6c4" }
        - { value: 18, color: "#225ea8", label: "Wet (floodplain)" }
      info:
        fields: [value]
        format: "TWI: {value:.2f}"
        section: Hydrology

  hydro/impervious:
    type: raster
    description: >
      Impervious surface — built-up areas from ESA WorldCover
      (class 50) used as a runoff proxy.
    compute:
      op: raster_calc
      params:
        expression: "where(landcover == 50, 100.0, 0.0)"
        output_band: impervious
      inputs:
        landcover: { layer: source/landcover }
    style:
      renderer: maplibre
      opacity: 0.65
      colorRamp:
        - { value: 0, color: "#00000000", label: "Pervious" }
        - { value: 100, color: "#455A64", label: "Impervious" }
      info:
        fields: [value]
        format: "Impervious: {value:.0f}%"
        section: Hydrology

  hydro/precipitation:
    type: raster
    description: >
      Annual total precipitation from Daymet (2024). 1km resolution.
      The DC metro area receives ~1000mm/year with a summer maximum.
      But annual totals mask the real driver of urban flooding:
      intensity. A 100mm storm in 1 hour causes flooding. The same
      100mm over a week does not. Future versions will include
      precipitation frequency (IDF curves) from NOAA Atlas 14.
    compute:
      op: temporal_reduce
      params:
        method: sum
        variable: prcp
      inputs:
        timeseries: { layer: source/daymet }
    style:
      renderer: maplibre
      opacity: 0.65
      colorRamp:
        - { value: 600, color: "#ffffcc" }
        - { value: 800, color: "#a1dab4" }
        - { value: 1000, color: "#41b6c4" }
        - { value: 1200, color: "#225ea8" }
      info:
        fields: [value]
        format: "Annual precipitation: {value:.0f} mm"
        section: Hydrology

  # ================================================================
  #  SEA LEVEL RISE
  #
  #  What happens when the Potomac rises? Simple elevation thresholds
  #  show which areas go underwater at +1m and +2m above current
  #  mean sea level. NOAA projects 0.3-1.0m of rise in the
  #  Chesapeake Bay by 2050. +2m is a reasonable 2100 scenario.
  # ================================================================

  sea-level/inundation:
    type: raster
    description: >
      Areas below the sea level rise threshold — controlled by slider.
      Blue = literally underwater at the selected rise level.
      Drag the "Sea Level Rise" slider to see the flood line advance.
    compute:
      op: raster_calc
      params:
        expression: "where(dem <= sea_level_m, 100.0, 0.0 / 0.0)"
        output_band: inundation
      inputs:
        dem: { layer: source/dem }
    style:
      renderer: maplibre
      opacity: 0.7
      colorRamp:
        - { value: 0, color: "#00000000" }
        - { value: 100, color: "#1565F0" }
      info:
        fields: [value]
        format: "Inundated at +{value:.0f}m"
        section: Sea Level Rise
      form:
        sea_level_m:
          type: slider
          min: 0
          max: 5
          step: 0.5
          default: 1
          label: "Sea Level Rise (meters)"


  # ================================================================
  #  EXPOSURE
  # ================================================================

  exposure/population:
    type: raster
    description: >
      Population density rasterized from Census tracts. How many
      people live in flood-prone areas? The Potomac waterfront
      corridor has seen massive development in the last 20 years —
      The Wharf, National Harbor, Pentagon City, Crystal City —
      putting hundreds of thousands of people closer to the water.
    compute:
      op: raster_rasterize
      params:
        attribute: POP100
        background: 0.0
        all_touched: true
        dtype: float32
      inputs:
        features: { layer: source/population }
        reference: { layer: source/dem }
    style:
      renderer: maplibre
      opacity: 0.6
      colorRamp:
        - { value: 0, color: "#f7fbff" }
        - { value: 1000, color: "#6baed6" }
        - { value: 5000, color: "#2171b5" }
        - { value: 10000, color: "#08306b" }
      info:
        fields: [value]
        format: "Tract population: {value:,.0f}"
        section: Exposure

  # ================================================================
  #  COMPOSITE FLOOD RISK
  #
  #  Five inputs, weighted and combined into a single 0-100 score.
  #
  #  This is not a hydrodynamic simulation (LISFLOOD-FP, HEC-RAS).
  #  It's a screening model — fast, transparent, and good enough
  #  for property-level risk ranking. The same approach that
  #  Previsico and 7Analytics use for their initial screening,
  #  before running full hydraulic models on flagged properties.
  # ================================================================

  risk/flood:
    type: raster
    description: >
      Composite flood risk index (0-100). Weighted overlay of six conditioning
      factors:
        - Terrain flatness (inverse slope) — flat areas accumulate water
        - Impervious surface — built-up = runoff, not infiltration
        - Very low elevation (<5m) — coastal storm-surge proximity
        - Low elevation (<20m) — broader floodplain risk
        - Flow accumulation — drainage concentration channels
        - Topographic Wetness Index — hydrological wetness derivative

      Default weights are FIT, not hand-tuned. Logistic regression against
      Deltares 100yr depth pseudo-labels for the Mid-Atlantic region (HUC-4
      0207 Potomac watershed, bbox -79.5,-76.5 × 38.0,39.8). AUC test = 0.999.
      Methodology: Khosravi et al. 2018, Sci. Total Environ. 627, 744-755.
      See `calibration/REPORT.md` for full fit details, including the honest
      caveat that AUC > 0.99 in this coastal-dominant bbox reflects elevation-
      dominance of Deltares, not exceptional model skill.

      Click any pixel to see its score. Drag sliders to override the fit.
    validation:
      method: logistic_regression
      region: HUC-4 0207 (Potomac, Mid-Atlantic)
      region_bbox: [-79.5, 38.0, -76.5, 39.8]
      auc_test: 0.9993
      n_positive: 9290
      n_negative: 10000
      seed: 42
      methodology: "Khosravi et al. 2018, Sci. Total Environ. 627, 744-755"
      label_source:
        dataset: deltares-floods
        version: v2021.06
        return_period_years: 100
        sea_level_year: 2018
        license: CC-BY-4.0
      calibration_artifact: calibration/mid-atlantic.json
      caveats:
        - >
          AUC > 0.99 reflects elevation-dominance of Deltares 100yr in coastal
          Mid-Atlantic, not exceptional model skill. The fit is calibration,
          not validation. For honest held-out validation use Sentinel-1 GFM
          detections or NFIP claims (Phase C ensemble labels).
        - >
          Train/test split is random; spatial autocorrelation likely inflates
          AUC. Block-aware split is a v2 improvement.
        - >
          drainage and twi conditioning factors used a local-relief proxy in
          the offline fit (no whitebox flow routing in fit env). The recipe
          itself uses the full hydrological flow_accum and TWI layers at run
          time — minor numerical drift between fit-time and run-time features
          is expected.
    compute:
      op: raster_calc
      params:
        expression: >
          min(max(
            ((1.0 - min(slope, 30.0) / 30.0) * flatness_w) +
            (impervious / 100.0 * impervious_w) +
            (where(dem <= 5.0, (5.0 - dem) / 5.0 * low_elev_w, 0.0)) +
            (where(dem <= 20.0, (20.0 - dem) / 20.0 * mid_elev_w, 0.0)) +
            (min(log(flow_accum + 1.0) / 10.0, 1.0) * drainage_w) +
            (min(max(twi, 0.0) / 25.0, 1.0) * twi_w),
            0), 100)
        output_band: flood_risk
      inputs:
        slope: { layer: terrain/slope }
        impervious: { layer: hydro/impervious }
        dem: { layer: source/dem }
        flow_accum: { layer: hydro/flow-accumulation }
        twi: { layer: terrain/twi }
    style:
      renderer: maplibre
      opacity: 0.85
      colorRamp:
        - { value: 0, color: "#1a985020" }
        - { value: 20, color: "#FFEB3B" }
        - { value: 40, color: "#FF9800" }
        - { value: 60, color: "#F44336" }
        - { value: 80, color: "#D32F2F" }
        - { value: 100, color: "#B71C1C" }
      info:
        fields: [value]
        format: "Flood risk: {value:.0f}/100"
        section: Risk Score
      form:
        # Default values are LR-fit weights for HUC-4 0207 Potomac
        # (Mid-Atlantic). See calibration/mid-atlantic.json for raw
        # coefficients and slider rescaling. Drag to override.
        flatness_w:
          type: slider
          min: 0
          max: 50
          step: 5
          default: 5
          label: "Terrain Flatness"
        impervious_w:
          type: slider
          min: 0
          max: 50
          step: 5
          default: 5
          label: "Impervious Surface"
        low_elev_w:
          type: slider
          min: 0
          max: 50
          step: 5
          default: 20
          label: "Very Low Elevation (<5m)"
        mid_elev_w:
          type: slider
          min: 0
          max: 40
          step: 5
          default: 30
          label: "Low Elevation (<20m)"
        drainage_w:
          type: slider
          min: 0
          max: 40
          step: 5
          default: 0
          label: "Drainage Accumulation"
        twi_w:
          type: slider
          min: 0
          max: 40
          step: 5
          default: 5
          label: "Topographic Wetness Index"

  risk/flood-classified:
    type: raster
    description: >
      Flood risk classified into 5 tiers. Maps cleanly onto insurance
      pricing bands:
        1 = Very Low  — preferred rates
        2 = Low       — standard rates
        3 = Moderate  — surcharge zone
        4 = High      — mandatory flood insurance
        5 = Extreme   — coverage may be unavailable
    compute:
      op: raster_reclassify
      params:
        method: quantile
        n_classes: 5
        class_values: [1.0, 2.0, 3.0, 4.0, 5.0]
        labels: ["Very Low", "Low", "Moderate", "High", "Extreme"]
      inputs:
        raster: { layer: risk/flood }
    style:
      renderer: maplibre
      opacity: 0.8
      colorRamp:
        - { value: 1, color: "#f7fbff" }
        - { value: 2, color: "#c6dbef" }
        - { value: 3, color: "#6baed6" }
        - { value: 4, color: "#2171b5" }
        - { value: 5, color: "#08306b" }
      info:
        fields: [value]
        format: "Risk tier: {value:.0f}/5"
        section: Risk Score

  # ================================================================
  #  EXPOSURE ANALYSIS
  # ================================================================

  analysis/exposure:
    type: table
    description: >
      Population exposed to flood risk by Census tract. Aggregates
      flood risk scores across tracts to show which neighborhoods
      have the most people at risk. National Harbor and Old Town
      Alexandria should rank highest.
    compute:
      op: analysis_zonal_stats
      params:
        stats: [mean, max, count]
      inputs:
        raster: { layer: risk/flood }
        zones: { layer: source/population }
    style:
      table:
        renderer: tanstack-table
        columns:
          - { field: zone_id, label: "Tract" }
          - { field: mean, label: "Mean Flood Risk", format: ".1f" }
          - { field: max, label: "Max Risk", format: ".1f" }
          - { field: count, label: "Cells", format: "d" }
        sortBy: mean
        sortOrder: desc

# ================================================================
#  VIEWS — Organized for the pitch
#
#  View 1: The opener — "you're standing in a flood zone"
#  View 2: The science — where water flows
#  View 3: The future — sea level rise scenarios
#  View 4: FEMA vs reality — regulatory gaps
#  View 5: The differentiator — view the spec
# ================================================================

views:
  - name: "Property Risk"
    layers: [risk/flood, sea-level/inundation]
    map:
      center: [-77.08, 38.80]
      zoom: 14
    description: >
      Flood risk for the ClimateTech Connect venue. The Gaylord
      National Resort is at the center of the map. Blue = flood risk.
      FEMA zone boundaries overlaid for comparison. Click any point
      for a score. Give me your address — I'll show you yours.

  - name: "Terrain & Impervious"
    layers: [terrain/slope, hydro/impervious]
    map:
      center: [-77.08, 38.80]
      zoom: 13
    description: >
      Where does water go? Flow accumulation shows drainage channels
      underneath the pavement. Broad Creek (past National Harbor) and
      Hunting Creek (Old Town Alexandria) are natural flood corridors
      that have been built over. The water still comes.

  - name: "Sea Level Rise"
    layers: [terrain/hillshade, sea-level/inundation]
    map:
      center: [-77.08, 38.80]
      zoom: 13
    description: >
      What happens when the Potomac rises. Dark blue = underwater at
      +1m (NOAA 2050 mid-range projection). Light blue = underwater
      at +2m (2100 high-end). Reagan Airport runways. Old Town
      Alexandria. The Tidal Basin. National Harbor parking. All below
      the line.

  - name: "FEMA vs Physics"
    layers: [terrain/hillshade, source/fema-zones, source/flood-depth]
    map:
      center: [-77.08, 38.80]
      zoom: 13
    description: >
      FEMA zones are regulatory boundaries — binary in/out. Deltares
      flood depth is continuous — how deep does the water get? A house
      1 meter inside Zone AE might see 0.1m of water or 2.0m. FEMA
      can't tell you which. Physics-based models can. Both layers
      are here — compare them.

  - name: "The Spec"
    layers: []
    description: >
      This is the entire flood risk pipeline. 18 layers. 6 source
      datasets. 12 compute operations including hydrological flow
      routing (WhiteboxTools), FEMA regulatory zones, physics-based
      flood modeling (Deltares), and sea level rise scenarios.

      Every output traces back to source. Every weight is adjustable.
      Every layer is auditable. No black box.

      "What does your geospatial data pipeline look like?"
      This is ours. One file.
