# aymanalwani/earthtrend architecture

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

- Interactive diagram: https://gitdiagram.com/aymanalwani/earthtrend
- Repository: https://github.com/aymanalwani/earthtrend

## Overview

EarthTrend is a Streamlit climate time-series explorer. Users select a variable, location, period, and resolution; the app retrieves live NASA POWER point data or saved NASA Giovanni area averages, prepares the series, estimates and tests trends, then presents charts, explanations, context, and a CSV download. A separate offline workflow cross-checks Jordan station temperatures against MERRA-2. The graph follows shown calls and README-documented capabilities; some UI and pipeline details are only partially excerpted, so unsupported links are omitted.

Main entry points: [`earthtrend/ui/components.py`](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/components.py) (Results interface), [`earthtrend/integration.py`](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/integration.py) (Analysis integration), [`earthtrend/pipeline.py`](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/pipeline.py) (Analysis pipeline), [`scripts/validate_stations.py`](https://github.com/aymanalwani/earthtrend/blob/main/scripts/validate_stations.py) (Station cross-check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App workflow"]
  node_entry["Streamlit entry<br/>[app.py]"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
end

subgraph group_data["Data sources"]
  node_powerclient["POWER client<br/>[power_client.py]"]
  node_giovanni["Giovanni loader<br/>[giovanni.py]"]
  node_processed[("Saved series")]
  node_nasa{{"NASA POWER"}}
end

subgraph group_methods["Analysis and charts"]
  node_preprocess["Series preparation<br/>[preprocessing.py]"]
  node_integration["Analysis integration<br/>[integration.py]"]
  node_analysis["Trend statistics<br/>[analysis.py]"]
  node_plotting["Plot adapter<br/>[plotting.py]"]
  node_visualization["Scientific charts<br/>[visualization.py]"]
end

subgraph group_presentation["Results interface"]
  node_ui["Results interface<br/>[components.py]"]
  node_charts["Chart section<br/>[charts.py]"]
  node_maps["Location map<br/>[maps.py]"]
  node_text["Result wording<br/>[text.py]"]
end

subgraph group_validation["Offline validation"]
  node_station["Station cross-check"]
  node_noaa{{"NOAA observations"}}
end

node_user(("User"))

node_user -->|"configures"| node_entry
node_entry -->|"renders controls"| node_ui
node_entry -->|"runs analysis"| node_pipeline
node_pipeline -->|"fetches point data"| node_powerclient
node_pipeline -->|"loads saved data"| node_giovanni
node_giovanni -->|"reads series"| node_processed
node_powerclient -->|"requests data"| node_nasa
node_pipeline -->|"delegates steps"| node_integration
node_integration -->|"preprocesses"| node_preprocess
node_integration -->|"analyzes series"| node_analysis
node_integration -->|"builds figure"| node_plotting
node_plotting -->|"delegates charting"| node_visualization
node_ui -->|"requests figure"| node_integration
node_ui -->|"renders charts"| node_charts
node_ui -->|"renders location"| node_maps
node_ui -->|"formats results"| node_text
node_ui -->|"presents results"| node_user
node_station -->|"downloads observations"| node_noaa
node_station -->|"fetches comparison data"| node_powerclient
node_station -->|"tests differences"| node_analysis

click node_entry "https://github.com/aymanalwani/earthtrend/blob/main/app.py"
click node_pipeline "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/pipeline.py"
click node_powerclient "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/data/power_client.py"
click node_giovanni "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/data/giovanni.py"
click node_processed "https://github.com/aymanalwani/earthtrend/tree/main/data/processed"
click node_preprocess "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/preprocessing.py"
click node_integration "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/integration.py"
click node_analysis "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/analysis.py"
click node_plotting "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/plotting.py"
click node_visualization "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/visualization.py"
click node_ui "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/components.py"
click node_charts "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/charts.py"
click node_maps "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/maps.py"
click node_text "https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/text.py"
click node_station "https://github.com/aymanalwani/earthtrend/blob/main/scripts/validate_stations.py"

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_entry,node_pipeline,node_user toneBlue
class node_powerclient,node_giovanni,node_processed,node_nasa toneAmber
class node_preprocess,node_integration,node_analysis,node_plotting,node_visualization toneMint
class node_ui,node_charts,node_maps,node_text toneRose
class node_station,node_noaa toneIndigo
```

## Components

### App workflow

- [Streamlit entry](https://github.com/aymanalwani/earthtrend/blob/main/app.py): `app.py`
- [Analysis pipeline](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/pipeline.py): `earthtrend/pipeline.py`

### Data sources

- [POWER client](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/data/power_client.py): `earthtrend/data/power_client.py`
- [Giovanni loader](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/data/giovanni.py): `earthtrend/data/giovanni.py`
- [Saved series](https://github.com/aymanalwani/earthtrend/tree/main/data/processed): `data/processed`
- **NASA POWER**

### Analysis and charts

- [Series preparation](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/preprocessing.py): `earthtrend/preprocessing.py`
- [Analysis integration](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/integration.py): `earthtrend/integration.py`
- [Trend statistics](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/analysis.py): `earthtrend/analysis.py`
- [Plot adapter](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/plotting.py): `earthtrend/plotting.py`
- [Scientific charts](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/visualization.py): `earthtrend/visualization.py`

### Results interface

- [Results interface](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/components.py): `earthtrend/ui/components.py`
- [Chart section](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/charts.py): `earthtrend/ui/charts.py`
- [Location map](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/maps.py): `earthtrend/ui/maps.py`
- [Result wording](https://github.com/aymanalwani/earthtrend/blob/main/earthtrend/ui/text.py): `earthtrend/ui/text.py`

### Offline validation

- [Station cross-check](https://github.com/aymanalwani/earthtrend/blob/main/scripts/validate_stations.py): `scripts/validate_stations.py`
- **NOAA observations**

### Other components

- **User**

## Connections

- User → Streamlit entry: configures (evidence: `README.md`)
- Streamlit entry → Results interface: renders controls (evidence: `app.py`)
- Streamlit entry → Analysis pipeline: runs analysis (evidence: `app.py`)
- Analysis pipeline → POWER client: fetches point data (evidence: `earthtrend/pipeline.py`)
- Analysis pipeline → Giovanni loader: loads saved data (evidence: `earthtrend/pipeline.py`)
- Giovanni loader → Saved series: reads series (evidence: `earthtrend/data/giovanni.py`)
- POWER client → NASA POWER: requests data (evidence: `earthtrend/data/power_client.py`)
- Analysis pipeline → Analysis integration: delegates steps (evidence: `earthtrend/pipeline.py`)
- Analysis integration → Series preparation: preprocesses (evidence: `earthtrend/integration.py`)
- Analysis integration → Trend statistics: analyzes series (evidence: `earthtrend/integration.py`)
- Analysis integration → Plot adapter: builds figure (evidence: `earthtrend/integration.py`)
- Plot adapter → Scientific charts: delegates charting (evidence: `earthtrend/plotting.py`)
- Results interface → Analysis integration: requests figure (evidence: `earthtrend/ui/components.py`)
- Results interface → Chart section: renders charts (evidence: `earthtrend/ui/components.py`)
- Results interface → Location map: renders location (evidence: `earthtrend/ui/components.py`)
- Results interface → Result wording: formats results (evidence: `earthtrend/ui/components.py`)
- Results interface → User: presents results (evidence: `README.md`)
- Station cross-check → NOAA observations: downloads observations (evidence: `README.md`)
- Station cross-check → POWER client: fetches comparison data (evidence: `scripts/validate_stations.py`)
- Station cross-check → Trend statistics: tests differences (evidence: `scripts/validate_stations.py`)
