Landslide Science Rule · landslide_class
← All rules

landslide_class → writes landslide_class

1556 already match 0 would change

Function source

This is read live from inventory/derived.py via inspect.getsource(); what you see is exactly what runs.

def compute_landslide_class(row):
    """Categorical class label for this landslide.

    Decision tree (mirrors the inventory legend / map color scheme):

    For SLOW landslides (`landslide_type='slow'`):
      - If `size_inclusion` is False → "Small slow landslide"
      - Else → "Slow " + creep_behavior, e.g. "Slow Obvious creep"
      - If creep_behavior is null → None (needs review)

    For CATASTROPHIC landslides (`landslide_type='catastrophic'`):
      - If `size_inclusion` is False → "Small catastrophic landslide"
      - Else look at year:
        · 2012+ → "Catastrophic " + creep_behavior if any precursor creep is
          recorded, else just "Catastrophic"
        · 1850-2011 → "Catastrophic Modern"
        · before 1850 → "Catastrophic Holocene"
      - If no numeric year but year_text contains "Holocene" or "Modern",
        use that as the era hint.
      - If neither year nor era hint is resolvable → None (needs review)
    """
    t = (row.get('landslide_type') or '').strip().lower()

    if t == 'slow':
        if not row.get('size_inclusion'):
            return 'Small slow landslide'
        cb = (row.get('creep_behavior') or '').strip()
        return f'Slow {cb}' if cb else None

    if t == 'catastrophic':
        if not row.get('size_inclusion'):
            return 'Small catastrophic landslide'
        era = _resolve_event_era(row)
        if era is None:
            return None
        if era == 'Holocene': return 'Catastrophic Holocene'
        if era == 'Modern':   return 'Catastrophic Modern'
        # era is a numeric year
        if era >= POST_2012_THRESHOLD_YEAR:
            cb = (row.get('creep_behavior') or '').strip()
            return f'Catastrophic {cb}' if cb else 'Catastrophic'
        if era >= LIA_END_YEAR:
            return 'Catastrophic Modern'
        return 'Catastrophic Holocene'

    return None

Proposed changes

All rows already match this rule — nothing to apply.