# vegetation-remote-sensing/resilience architecture

> Architecture diagram of the GitHub repository vegetation-remote-sensing/resilience, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vegetation-remote-sensing/resilience
- Repository: https://github.com/vegetation-remote-sensing/resilience

## Overview

This repository provides vegetation time-series resilience analysis and a separate supervised-learning workflow. The main documented path decomposes kNDVI series into trend, seasonal, and residual components, then computes sliding-window AR1 and variance indicators from residuals. A separate script tunes an XGBoost regressor and writes SHAP explanations. The tree also contains MATLAB scripts for abrupt-decline event detection and paired resilience comparisons; their internal relationships are not established by the sampled source. Paths and connections for those modules are therefore kept conservative.

Main entry points: [`STL_Decomposition.py`](https://github.com/vegetation-remote-sensing/resilience/blob/main/STL_Decomposition.py) (STL Decomposition), [`AR1_Var_calculating.py`](https://github.com/vegetation-remote-sensing/resilience/blob/main/AR1_Var_calculating.py) (AR1 and Variance), [`XGBoost_SHAP_ADs.py`](https://github.com/vegetation-remote-sensing/resilience/blob/main/XGBoost_SHAP_ADs.py) (XGBoost and SHAP), [`output`](https://github.com/vegetation-remote-sensing/resilience/tree/main/output) (Trend, Season, Residual)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_time_series["Time-Series Resilience"]
  node_vegetation_data["Vegetation Series<br/>[kndvi_data.csv]"]
  node_stl["STL Decomposition"]
  node_components["Trend, Season, Residual"]
  node_ar1_variance["AR1 and Variance"]
  node_resilience_outputs["Resilience Indicators"]
end

subgraph group_machine_learning["Model Interpretation"]
  node_feature_data["Feature Dataset"]
  node_xgboost_shap["XGBoost and SHAP"]
  node_shap_outputs["SHAP Results"]
end

subgraph group_abrupt_decline["Abrupt Decline Analysis"]
  node_trend_analysis["Resilience Trends"]
  node_event_detection["Abrupt Event Detection"]
  node_paired_comparison["Paired AD Comparison"]
  node_matlab_example["MATLAB Example Run<br/>[example_run.m]"]
end

node_analyst(("Analyst"))

node_analyst -->|"runs"| node_stl
node_vegetation_data -->|"supplies series"| node_stl
node_stl -->|"writes components"| node_components
node_analyst -->|"runs"| node_ar1_variance
node_components -->|"residual input"| node_ar1_variance
node_ar1_variance -->|"writes indicators"| node_resilience_outputs
node_analyst -->|"runs"| node_xgboost_shap
node_feature_data -->|"supplies features"| node_xgboost_shap
node_xgboost_shap -->|"writes explanations"| node_shap_outputs

click node_vegetation_data "https://github.com/vegetation-remote-sensing/resilience/blob/main/input/kndvi_data.csv"
click node_stl "https://github.com/vegetation-remote-sensing/resilience/blob/main/STL_Decomposition.py"
click node_components "https://github.com/vegetation-remote-sensing/resilience/tree/main/output"
click node_ar1_variance "https://github.com/vegetation-remote-sensing/resilience/blob/main/AR1_Var_calculating.py"
click node_resilience_outputs "https://github.com/vegetation-remote-sensing/resilience/tree/main/output"
click node_feature_data "https://github.com/vegetation-remote-sensing/resilience/blob/main/input/xgb_data_sigma4div2_WS07.csv"
click node_xgboost_shap "https://github.com/vegetation-remote-sensing/resilience/blob/main/XGBoost_SHAP_ADs.py"
click node_shap_outputs "https://github.com/vegetation-remote-sensing/resilience/tree/main/output"
click node_trend_analysis "https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/calculate_resilience_trends.m"
click node_event_detection "https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/detect_abrupt_decline_events.m"
click node_paired_comparison "https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/extract_paired_AD_noAD_resilience.m"
click node_matlab_example "https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/example_run.m"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_vegetation_data,node_stl,node_components,node_ar1_variance,node_resilience_outputs toneBlue
class node_feature_data,node_xgboost_shap,node_shap_outputs toneAmber
class node_trend_analysis,node_event_detection,node_paired_comparison,node_matlab_example toneMint
class node_analyst toneIndigo
```

## Components

### Time-Series Resilience

- [Vegetation Series](https://github.com/vegetation-remote-sensing/resilience/blob/main/input/kndvi_data.csv): `input/kndvi_data.csv`
- [STL Decomposition](https://github.com/vegetation-remote-sensing/resilience/blob/main/STL_Decomposition.py): `STL_Decomposition.py`
- [Trend, Season, Residual](https://github.com/vegetation-remote-sensing/resilience/tree/main/output): `output`
- [AR1 and Variance](https://github.com/vegetation-remote-sensing/resilience/blob/main/AR1_Var_calculating.py): `AR1_Var_calculating.py`
- [Resilience Indicators](https://github.com/vegetation-remote-sensing/resilience/tree/main/output): `output`

### Model Interpretation

- [Feature Dataset](https://github.com/vegetation-remote-sensing/resilience/blob/main/input/xgb_data_sigma4div2_WS07.csv): `input/xgb_data_sigma4div2_WS07.csv`
- [XGBoost and SHAP](https://github.com/vegetation-remote-sensing/resilience/blob/main/XGBoost_SHAP_ADs.py): `XGBoost_SHAP_ADs.py`
- [SHAP Results](https://github.com/vegetation-remote-sensing/resilience/tree/main/output): `output`

### Abrupt Decline Analysis

- [Resilience Trends](https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/calculate_resilience_trends.m): `Forest Resilience Abrupt Decline Detection/calculate_resilience_trends.m`
- [Abrupt Event Detection](https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/detect_abrupt_decline_events.m): `Forest Resilience Abrupt Decline Detection/detect_abrupt_decline_events.m`
- [Paired AD Comparison](https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/extract_paired_AD_noAD_resilience.m): `Forest Resilience Abrupt Decline Detection/extract_paired_AD_noAD_resilience.m`
- [MATLAB Example Run](https://github.com/vegetation-remote-sensing/resilience/blob/main/Forest%20Resilience%20Abrupt%20Decline%20Detection/example_run.m): `Forest Resilience Abrupt Decline Detection/example_run.m`

### Other components

- **Analyst**

## Connections

- Analyst → STL Decomposition: runs (evidence: `README.md`)
- Vegetation Series → STL Decomposition: supplies series (evidence: `README.md`)
- STL Decomposition → Trend, Season, Residual: writes components (evidence: `STL_Decomposition.py`)
- Analyst → AR1 and Variance: runs (evidence: `README.md`)
- Trend, Season, Residual → AR1 and Variance: residual input (evidence: `README.md`)
- AR1 and Variance → Resilience Indicators: writes indicators (evidence: `AR1_Var_calculating.py`)
- Analyst → XGBoost and SHAP: runs (evidence: `README.md`)
- Feature Dataset → XGBoost and SHAP: supplies features (evidence: `README.md`)
- XGBoost and SHAP → SHAP Results: writes explanations (evidence: `XGBoost_SHAP_ADs.py`)
