显示HN:旧金山微气候
Show HN: SF Microclimates

原始链接: https://github.com/solo-founders/sf-microclimates

## 旧金山微气候API 摘要 Solo Founders 创建了一个免费、无需密钥的API ([microclimates.solofounders.com](https://microclimates.solofounders.com)),为旧金山50个街区提供超本地化的天气数据。 认识到旧金山显著的微气候——气温在几英里范围内可能差异很大——该API 汇集了150多个户外传感器的数据,提供比全市平均值更准确的读数。 该API 提供端点来检索所有街区或特定位置的天气(例如,`/sf-weather/mission`)。 数据包括温度、湿度和传感器数量,每小时更新。 它被设计为易于与AI代理(Claude Code, Clawdbot)、家庭自动化、机器人和自定义应用程序集成。 该项目是开源的 (GitHub: [https://github.com/solo-founders/sf-microclimates](https://github.com/solo-founders/sf-microclimates)),并欢迎贡献以将服务扩展到其他具有独特微气候的城市。 它利用PurpleAir传感器和Cloudflare KV进行缓存和性能优化。

## 旧金山微气候:超本地化天气工具 一个名为“SF Microclimates”的新项目(github.com/solo-founders)旨在为旧金山提供极其本地化的温度数据。创建者主要将其构建用于像Claude Code这样的人工智能工具,但承认该网站目前缺乏用于简单天气查询的用户友好界面。 该项目利用PurpleAir传感器的数据——遍布城市数千个传感器网络——来绘制温度变化,揭示由日照和阴影造成的影响。用户可以将开源代码适配到其他城市,例如波特兰。 讨论中提到对默认视图中包含室内传感器数据的担忧,以及对数据来源(主要为PurpleAir)和单个传感器读数API访问权限的疑问。 也有人请求添加摄氏度支持。
相关文章

原文

License: MIT Free API

Real weather for 50 San Francisco neighborhoods. Free API. No key required.

🌐 Live API: microclimates.solofounders.com

Use with Claude Code, Clawdbot, or build into your apps.

Built by Solo Founders.


SF has the most dramatic microclimates of any US city.

Weather apps say "San Francisco: 58°F" — but that's useless. It can be 52°F and foggy in the Outer Sunset while it's 65°F and sunny in the Mission, just 3 miles apart.

This API aggregates 150+ outdoor sensors and groups them by neighborhood, so you get actual local temperatures — not some airport reading from SFO.


curl https://microclimates.solofounders.com/sf-weather/mission
{
  "neighborhood": "mission",
  "name": "Mission District",
  "temp_f": 58,
  "humidity": 52,
  "sensor_count": 8
}

No API key. No signup. Just use it.


Add to Claude Code or Clawdbot

Copy and paste this into your skills folder:

# Create a new skill: sf-microclimates/SKILL.md


# SF Microclimates Skill

Get real-time SF neighborhood weather.

## Triggers
- "weather in [neighborhood]"
- "sf weather mission vs sunset"
- "is it foggy in the richmond?"

## Usage
curl https://microclimates.solofounders.com/sf-weather/marina

## Neighborhoods
mission, castro, marina, soma, haight, noe_valley,
outer_sunset, inner_sunset, outer_richmond, presidio,
north_beach, pacific_heights, potrero, twin_peaks...

  • AI agents — Give your agent real local weather context
  • Home automation — Trigger based on your actual neighborhood temp
  • Slack/Discord bots — Settle "is it foggy?" arguments
  • Travel apps — Show tourists what to actually expect
  • Personal dashboards — Finally, weather that matches your window

Endpoint Description
GET /sf-weather All 50 neighborhoods
GET /sf-weather/:neighborhood Single neighborhood
GET /neighborhoods List all available

From Marina to Noe Valley, Presidio to Twin Peaks — every SF neighborhood mapped.

curl https://microclimates.solofounders.com/neighborhoods

Includes: mission, castro, marina, soma, haight, noe_valley, outer_sunset, inner_richmond, north_beach, pacific_heights, potrero, dogpatch, bayview, twin_peaks, presidio, tenderloin, chinatown, japantown, cole_valley, glen_park, and 30 more.


{
  "updated": "2026-01-25T23:00:00.000Z",
  "neighborhood": "outer_sunset",
  "name": "Outer Sunset",
  "temp_f": 52,
  "humidity": 78,
  "sensor_count": 15
}
{
  "updated": "2026-01-25T23:00:00.000Z",
  "neighborhoods": {
    "mission": { "temp_f": 58, "humidity": 52, "sensor_count": 8 },
    "outer_sunset": { "temp_f": 52, "humidity": 78, "sensor_count": 15 },
    "marina": { "temp_f": 55, "humidity": 65, "sensor_count": 6 }
  }
}

Want to run your own instance?

git clone https://github.com/solo-founders/sf-microclimates.git
cd sf-microclimates
npm install

2. Get a PurpleAir API Key

This API uses PurpleAir sensors. Sign up at develop.purpleair.com — free for personal use.

wrangler kv:namespace create "CACHE"

Add the output to wrangler.toml:

[[kv_namespaces]]
binding = "CACHE"
id = "your-kv-namespace-id"
wrangler secret put PURPLEAIR_API_KEY
echo "PURPLEAIR_API_KEY=your-key" > .dev.vars
wrangler dev

Variable Default Description
CACHE_TTL_SECONDS 3600 Cache duration (1 hour)
RATE_LIMIT_PER_MINUTE 60 Max requests per IP

  1. Request comes in → rate limit check
  2. Check Cloudflare KV cache → return if fresh
  3. Cache miss → fetch outdoor sensors from PurpleAir (location_type=0)
  4. Group sensors by neighborhood GPS bounding boxes
  5. Calculate averages, cache for 1 hour
  6. Return JSON with CORS headers

LA, Seattle, NYC, Chicago, Austin — every city has microclimates.

The neighborhood bounding boxes are in src/index.ts. To adapt:

  1. Update SF_NEIGHBORHOODS with your city's areas + GPS coordinates
  2. Change the PurpleAir bounding box to your city
  3. Update branding
  4. Deploy

PRs welcome! We'd love to see la-microclimates, nyc-microclimates, etc.



MIT — use it however you want.

联系我们 contact @ memedata.com