tuebingen-weather-graphics

TotalClaw 作者 totalclaw

从 open-meteo.com 生成并发送 5 天蒂宾根天气图表 (PNG)。当主人想要更好的视觉预测以及接下来几天的摘要文本时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~zopyx-tuebingen-weather-graphics
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~zopyx-tuebingen-weather-graphics/file -o zopyx-tuebingen-weather-graphics.md
# Tübingen Weather Graphics

## Überblick
Erstellt eine ansprechende PNG-Grafik (max/min-Temperaturen + Regenwahrscheinlichkeit für 5 Tage) auf Basis von Open-Meteo. Ideal für morgendliche Forecast-Posts via Telegram oder Archivierung.

## Voraussetzungen
- Python 3.11+ 
- `matplotlib`, `numpy`, `pillow` (am einfachsten via virtuelles Environment):
  ```bash
  python3 -m venv /tmp/tuebingen-plot
  source /tmp/tuebingen-plot/bin/activate
  pip install matplotlib
  ```

## Quick Start
```bash
/tmp/tuebingen-plot/bin/python \
  skills/tuebingen-weather-graphics/scripts/generate_forecast_graph.py \
  --days 5 \
  --output data/weather/tuebingen_forecast.png
```
Ausgabe: 
- PNG unter `data/weather/...`
- Textzusammenfassung im Terminal (z. B. „Fri 13.02: 5/10°C, Regen 85% | …“)

## Automatischer Versand
1. **Cron-Job 07:30 (Beispiel):**
   ```bash
   openclaw cron add <<'JSON'
   {
     "name": "tuebingen-forecast-graphic",
     "schedule": { "kind": "cron", "expr": "30 7 * * *", "tz": "Europe/Berlin" },
     "sessionTarget": "isolated",
     "payload": {
       "kind": "agentTurn",
       "model": "default",
       "message": "Run `/tmp/tuebingen-plot/bin/python skills/tuebingen-weather-graphics/scripts/generate_forecast_graph.py --output data/weather/tuebingen_forecast.png`. Send Master the summary text plus attach the PNG."
     }
   }
   JSON
   ```
2. **Telegram Versand:** `message.send` mit `media=data/weather/tuebingen_forecast.png`.

## Troubleshooting
- **Matplotlib ImportError:** Stelle sicher, dass das oben genannte venv aktiv ist oder die Pakete systemweit installiert wurden.
- **Leere Daten:** Open-Meteo liefert manchmal keine Regenwahrscheinlichkeit → Script zeigt 0%. Kann im Code angepasst werden.
- **Mehr Tage:** `--days 7` o. Ä. möglich (die API liefert bis zu 7+ Tage im daily-Block).

## Ressourcen
- `scripts/generate_forecast_graph.py` – Lädt Daily-Daten, zeichnet Linien/Flächen-Plot + Regen-Balken, speichert PNG.

---

## 中文说明

# Tübingen Weather Graphics(蒂宾根天气图表)

## 概述
基于 Open-Meteo 生成一张美观的 PNG 图表(5 天的最高/最低温度 + 降雨概率)。非常适合通过 Telegram 发布早间预报或用于归档。

## 前置条件
- Python 3.11+ 
- `matplotlib`、`numpy`、`pillow`(最简单的方式是使用虚拟环境):
  ```bash
  python3 -m venv /tmp/tuebingen-plot
  source /tmp/tuebingen-plot/bin/activate
  pip install matplotlib
  ```

## 快速开始
```bash
/tmp/tuebingen-plot/bin/python \
  skills/tuebingen-weather-graphics/scripts/generate_forecast_graph.py \
  --days 5 \
  --output data/weather/tuebingen_forecast.png
```
输出:
- 位于 `data/weather/...` 下的 PNG
- 终端中的文本摘要(例如 „Fri 13.02: 5/10°C, Regen 85% | …“)

## 自动发送
1. **Cron 任务 07:30(示例):**
   ```bash
   openclaw cron add <<'JSON'
   {
     "name": "tuebingen-forecast-graphic",
     "schedule": { "kind": "cron", "expr": "30 7 * * *", "tz": "Europe/Berlin" },
     "sessionTarget": "isolated",
     "payload": {
       "kind": "agentTurn",
       "model": "default",
       "message": "Run `/tmp/tuebingen-plot/bin/python skills/tuebingen-weather-graphics/scripts/generate_forecast_graph.py --output data/weather/tuebingen_forecast.png`. Send Master the summary text plus attach the PNG."
     }
   }
   JSON
   ```
2. **Telegram 发送:** 使用 `message.send`,并附带 `media=data/weather/tuebingen_forecast.png`。

## 故障排查
- **Matplotlib ImportError:** 请确保上述 venv 已激活,或者相关包已在系统范围内安装。
- **数据为空:** Open-Meteo 有时不返回降雨概率 → 脚本会显示 0%。可在代码中调整。
- **更多天数:** 可以使用 `--days 7` 之类的参数(API 在 daily 块中最多可提供 7 天以上的数据)。

## 资源
- `scripts/generate_forecast_graph.py` – 加载每日数据,绘制折线/面积图 + 降雨柱状图,并保存为 PNG。