Skip to content

Commit b11a1c8

Browse files
committed
Release: Complete EarthReach implementation v1.0
This commit represents the final day release of the EarthReach project, replacing the initial main branch with the full implementation. Key Features: - Dual-LLM framework (Generator + Evaluator agents) - Complete earth_reach package structure - VLLM inference server integration - Full CLI interface with era command - Documentation and example notebooks Package structure migrated from src/earth_reach_agent/ to src/earth_reach/
1 parent 6a4afdb commit b11a1c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4169
-1950
lines changed

.github/workflows/ci.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
- 'README*'
10+
- '.gitignore'
11+
pull_request:
12+
branches: [ main, develop ]
13+
paths-ignore:
14+
- '**.md'
15+
- 'docs/**'
16+
- 'README*'
17+
- '.gitignore'
18+
workflow_dispatch:
19+
20+
jobs:
21+
code-analysis:
22+
name: Code Quality Analysis
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout Repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
version: "latest"
33+
34+
- name: Install Python
35+
run: uv python install
36+
37+
- name: Install dependencies
38+
run: uv sync --locked --all-extras --dev
39+
40+
- name: Check formatting
41+
run: uv run ruff format --check .
42+
43+
- name: Check linting
44+
run: uv run ruff check .

.gitignore

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ wheels/
99
# Virtual environments
1010
.venv
1111

12-
# Notebooks
13-
.ipynb_checkpoints/
14-
*.ipynb
15-
1612
# Data
1713
weather_images/
1814

@@ -22,7 +18,6 @@ weather_images/
2218
# Common
2319
*.DS_Store
2420

25-
# Images
26-
*.png
27-
*.jpg
28-
*.jpeg
21+
# Data
22+
data/monthly_average.zarr
23+
data/*.nc

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-merge-conflict
10+
- id: check-toml
11+
- id: debug-statements
12+
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.12.7
15+
hooks:
16+
- id: ruff-check
17+
args: [--fix]
18+
- id: ruff-format

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@
199199
distributed under the License is distributed on an "AS IS" BASIS,
200200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201
See the License for the specific language governing permissions and
202-
limitations under the License.
202+
limitations under the License.

README.md

Lines changed: 90 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# EarthReach Agent: Dual-LLM Framework for Validated Meteorological Chart Descriptions
22

33
<p align="center">
4+
<a href="https://www.python.org/downloads/release/python-3120/">
5+
<img src="https://img.shields.io/badge/python-3.12-blue.svg" alt="Python 3.12">
6+
</a>
47
<a href="https://opensource.org/licenses/apache-2-0">
58
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0">
69
</a>
@@ -14,14 +17,19 @@
1417

1518
## EarthReach
1619

17-
EarthReach is a challenge from the 2025 edition dedicated to enhancing the accessibility of meteorological data visualisations produced by Earthkit, by equipping the plots module with LLM-powered alternative text generation capabilities.
20+
EarthReach is a Python library for generating natural language descriptions of meteorological data visualizations. The library extends [earthkit-plots](https://github.com/ecmwf/earthkit-plots) by providing automated text generation capabilities for weather charts, enabling programmatic conversion of visual data representations into structured textual descriptions.
21+
22+
The system implements a dual-LLM architecture consisting of a generator agent and an evaluator agent. The generator creates initial descriptions from chart images and associated GRIB file metadata, while the evaluator assesses output quality across multiple criteria including scientific accuracy, coherence, and meteorological relevance. This iterative process continues until quality thresholds are met or maximum iterations are reached.
23+
24+
![Global temperature and mean sea level map](./docs/source/_static/example_global_chart.png)
1825

1926
## Installation
2027

2128
### Prerequisites
2229

23-
- Python 3.12 or higher
24-
- [uv](https://docs.astral.sh/uv/) - Python package and project manager
30+
- [uv](https://docs.astral.sh/uv/): Python package and project manager (will automatically install Python 3.12+ if needed)
31+
- [Climate Data Store ](https://cds.climate.copernicus.eu/how-to-api): API key configured for accessing meteorological data
32+
- API key for a supported LLM provider (OpenAI, Google Gemini, Anthropic Claude, Groq, or any OpenAI-compatible API provider)
2533

2634
### Setup
2735

@@ -32,42 +40,63 @@ EarthReach is a challenge from the 2025 edition dedicated to enhancing the acces
3240
```
3341
2. **Create a virtual environment and install dependencies**
3442
```sh
35-
uv sync
43+
uv sync --group dev
3644
```
3745
This command will automatically:
3846
- Create a .venv virtual environment
3947
- Install all project dependencies from pyproject.toml
48+
- Install development dependencies
4049

4150
3. **Activate the virtual environment**
4251
```sh
4352
source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
4453
```
4554

55+
4. **Set up pre-commit hooks (recommended for development)**
56+
```sh
57+
uv run pre-commit install
58+
```
59+
4660
You're now ready to use the project.
4761

4862
## Project Structure
4963

5064
```sh
51-
.
65+
.
5266
├── docs/ # Project documentation
5367
├── notebooks/ # Tutorials & experiments
5468
├── src/
55-
│ ├── earth_reach_agent/ # Main package
69+
│ ├── earth_reach/ # Main package
5670
│ └── tests/ # Unit and integration tests (to come)
5771
├── vllm/ # VLLM inference server setup
5872
├── pyproject.toml # Project dependencies and metadata
5973
└── uv.lock # Locked dependency versions
6074
```
6175

62-
## VLLM Inference Server
76+
## Basic Usage
6377

64-
To run this project, you will need to have an openAI-compatible LLM inference server.
78+
```python
79+
from earth_reach import EarthReachAgent
80+
import earthkit.plots as ekp
81+
import earthkit.data as ekd
6582

66-
We provide instructions on how to setup your own secured inference server using [VLLM](./vllm/setup.md).
83+
# Load your data with earthkit-data
84+
data = ekd.from_source("file", "your_data.grib")
6785

68-
## Usage
86+
# Create a weather chart with earthkit-plots
87+
figure = ekp.quickplot(data, mode="overlay")
88+
89+
# Generate description
90+
agent = EarthReachAgent(provider="openai")
91+
description = agent.generate_alt_description(figure, data)
92+
print(description)
93+
```
6994

70-
The project provides a command-line interface (CLI) accessible through `earth-reach-agent` or its shorter alias `era`.
95+
See `notebooks/example.ipynb` for a practical usage example.
96+
97+
## CLI Interface
98+
99+
EarthReach includes a standalone CLI that works on image files only, producing less detailed descriptions than the full library integration.
71100

72101
### Available Commands
73102

@@ -76,20 +105,66 @@ View all commands and options:
76105
uv run era --help
77106
```
78107

79-
### Generate weather chart descriptions
80-
81108
Generate a natural language description from a weather chart image:
82109
```sh
83110
uv run era generate --image-path <path_to_image>
84111
```
85112

86-
### Evaluate descriptions
87-
88113
Evaluate the accuracy of a description against a weather chart:
89114

90115
```sh
91116
uv run era evaluate --image-path <path_to_image> --description "<description_string>"
92117
```
118+
## VLLM Inference Server
119+
120+
EarthReach supports any OpenAI-compatible API endpoint for self-hosted LLMs. See `vllm/` directory for a VLLM setup example.
121+
122+
**Warning**: Self-hosting requires advanced system administration skills and significant GPU resources. Recommended only for experienced users.
123+
124+
## Development
125+
126+
### Development Tooling
127+
128+
This project uses the following development tools:
129+
130+
- **Ruff**: Fast Python linter and formatter
131+
- **mypy**: Static type checker for Python
132+
- **Pre-commit**: Git hooks for code quality checks
133+
- **Pytest**: Testing framework
134+
135+
### Code Quality
136+
137+
The project is configured with pre-commit hooks that run automatically before each commit to ensure code quality:
138+
139+
- **Ruff linting**: Checks for common Python issues and enforces coding standards
140+
- **Ruff formatting**: Automatically formats code for consistency
141+
- **mypy type checking**: Validates type hints and catches import errors
142+
- **Basic checks**: Trailing whitespace, file endings, YAML/TOML syntax, merge conflicts
143+
144+
### Running Tools Manually
145+
146+
You can run the development tools manually:
147+
148+
```sh
149+
# Run ruff linter
150+
uv run ruff check .
151+
152+
# Run ruff formatter
153+
uv run ruff format .
154+
155+
# Run mypy type checker
156+
uv run mypy .
157+
158+
# Run pre-commit hooks on all files
159+
uv run pre-commit run --all-files
160+
```
161+
162+
### Configuration
163+
164+
- Ruff configuration is in `pyproject.toml` under `[tool.ruff]`
165+
- mypy configuration is in `pyproject.toml` under `[tool.mypy]`
166+
- Pre-commit configuration is in `.pre-commit-config.yaml`
167+
93168
## License
94169

95170
See [LICENSE](LICENSE)

docs/.gitkeep

Whitespace-only changes.

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd
440 KB
Loading

0 commit comments

Comments
 (0)