1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

過去の天気データを可視化して現実と向き合う【Weather or Not】

Last updated at Posted at 2025-07-11

🚀 作ったもの:Weather or Not

Weather or Not - 天気を取得するか,しないか.それが問題だ.
OpenWeatherAPIから過去の天気データを取得して,グラフ化するツールです。

主な機能

  • 📊 1時間ごとの温度変化をグラフ化
  • 🌡️ 最高・最低・平均気温を一目で把握
  • 💨 湿度,気圧,風速も余すところなく可視化

💻 技術スタック

const techStack = {
  backend: "Node.js", 
  frontend: "Python",    // え?フロント?
  api: "OpenWeather",   
  visualization: "matplotlib",  // エクセルより100倍美しい
  deployment: "localhost"       // 最強のホスティングサービス
};

🔧 実装のポイント

ファイル整理術

散らかったファイルは心も散らかす.そこで日付ごとにフォルダ分けされるように:

// 出力ディレクトリの作成
const outputDir = path.join('outputs', dateString);
if (!fs.existsSync(outputDir)) {
  fs.mkdirSync(outputDir, { recursive: true });
}

結果:

outputs/
├── 2025-01-10/
│   ├── daily_weather_2025-01-10.json
│   ├── temperature_graph_2025-01-10.png
│   └── weather_details_2025-01-10.png
├── 2025-01-11/
│   └── (以下略)

エラーハンドリング

// API制限を避けるため少し待機
await new Promise(resolve => setTimeout(resolve, 1000));

1秒待つ.大人の余裕.

📝 使い方

1. セットアップ

git clone https://github.com/cdsl-research/weather-or-not.git
cd weather-or-not
npm install
pip install matplotlib numpy

2. APIキーを設定(最重要)

cp .env.example .env
# .envを編集してAPIキーを設定(GitHubに上げないように!)

3. 実行(ワンコマンド)

# 今日の天気データを取得してグラフ化
python plot_temperature.py

# 過去の特定日を指定
python plot_temperature.py 2025-07-10

temperature_graph_2025-07-10.png
weather_details_2025-07-10.png

リポジトリはこちらGitHub - Weather or Not

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?