# Weather API
## What It Does
The Weather API provides current conditions, hourly forecasts (up to 5 days), and daily forecasts (up to 15 days) for any location. Returns temperature, precipitation, humidity, wind speed/direction, cloud cover, visibility, and UV index.
Unlike general weather services, this API is designed for location-specific applications where weather affects user experience or safety.
## Music Use Case: Field Recording Conditions
Weather dramatically affects outdoor sound recording quality and character:
**Pre-recording planning:**
- Check wind speed before recording (>10 mph = wind noise issues)
- Avoid rain/precipitation (water on microphone = distortion)
- Monitor temperature for equipment limits (condensation, battery life)
- Plan for golden hour lighting + calm winds for video-audio projects
**Sonic environment correlation:**
- Temperature affects sound propagation (cold air = sharper high frequencies)
- Humidity dampens high frequencies (foggy days sound muffled)
- Wind direction determines which sounds reach your mic (highway noise, etc.)
- Precipitation creates rain/snow ambience (document weather in metadata)
**Example:** Tijuana Jazz Club Outdoor Patio Recording
```json
{
"date": "2025-11-15",
"time": "20:00",
"location": "Av. Revolución 1006",
"weather": {
"temperature": 18°C,
"wind_speed": 5 mph,
"humidity": 72%,
"conditions": "Clear",
"recording_quality": "Excellent - calm winds, dry conditions"
}
}
```
**Soundwalk route planning:**
- Avoid routes exposed to high winds
- Plan indoor/outdoor alternation based on forecast
- Schedule walks during optimal weather windows
## Environmental Research Use Case: Water Infrastructure Operations
Weather drives water and sewer system behavior:
**Rainfall and sewer overflow:**
- Track precipitation to predict combined sewer overflows (CSOs)
- Correlate heavy rain with water quality degradation
- Plan inspections after storm events (identify infrastructure weaknesses)
**Example:** Tijuana River Watershed Monitoring
```
Storm event: 2025-11-12
Rainfall: 1.2 inches in 3 hours
Impact: WWTP La Morita exceeded capacity at 14:30
CSO discharge: Tijuana River at border crossing
Water quality sampling: Next 48 hours critical
```
**Temperature and water quality:**
- High temps increase bacterial growth in stagnant water
- Cold temps reduce biological treatment effectiveness at WWTPs
- Track temperature trends for seasonal operational adjustments
**Wind and aerial inspection:**
- Drone surveys require <15 mph winds for stable footage
- Helicopter inspections need clear visibility (>5 miles)
- Plan aerial mapping during calm weather windows
**UV index and outdoor work:**
- Schedule long inspection days during lower UV periods
- Provide crew safety guidance for high UV days
## How to Use It
### Direct API Call (No MCP Tool Available)
**Endpoint:** `https://weather.googleapis.com/v1/weather:lookup`
**Current conditions:**
```bash
curl "https://weather.googleapis.com/v1/weather:lookup?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"location": {
"latitude": 32.5332,
"longitude": -117.0192
}
}'
```
**Hourly forecast:**
```json
{
"location": {"latitude": 32.5332, "longitude": -117.0192},
"forecast": {
"hourly": true,
"hours": 48
}
}
```
**Daily forecast:**
```json
{
"location": {"latitude": 32.5332, "longitude": -117.0192},
"forecast": {
"daily": true,
"days": 7
}
}
```
## Response Structure
**Current conditions:**
```json
{
"temperature": {"value": 18, "unit": "C"},
"humidity": 72,
"windSpeed": {"value": 8, "unit": "km/h"},
"windDirection": 270,
"precipitation": {"value": 0, "unit": "mm"},
"cloudCover": 25,
"uvIndex": 3,
"visibility": {"value": 16, "unit": "km"},
"weatherCode": "partly_cloudy"
}
```
**Weather codes:** `clear`, `partly_cloudy`, `cloudy`, `rain`, `heavy_rain`, `snow`, `fog`, `thunderstorm`
## How It Works
**Data sources:**
1. NOAA weather stations (US)
2. National meteorological services (international)
3. Weather radar networks
4. Satellite imagery
5. Numerical weather prediction models
**Update frequency:** Current conditions update every 15-30 minutes. Forecasts update every 6 hours.
**Accuracy:**
- Current conditions: Very accurate (direct measurements)
- Next 24 hours: ~90% accurate
- 3-5 days: ~75% accurate
- 7+ days: ~60% accurate (general trends only)
## When to Use It
**Music/Audio projects:**
- Planning outdoor recording sessions
- Documenting sonic environment conditions
- Scheduling soundwalks and audio tours
- Video + audio production weather coordination
**Environmental research:**
- Predicting sewer overflow events
- Planning water quality sampling after storms
- Scheduling drone/aerial infrastructure inspections
- Crew safety planning (UV, temperature extremes)
**Don't use it for:**
- Long-range planning (>7 days = use daily forecast trends only)
- Hyperlocal microclimates (API gives general area conditions)
- Storm warnings (use official weather alerts instead)
## Pro Tips
**Wind is the enemy of outdoor recording:** Anything over 10 mph requires windscreens. Over 20 mph, consider rescheduling.
**Rain changes everything:** Water infrastructure systems behave completely differently during and after storms. Plan sampling routes to capture these events.
**Golden hour + calm winds = magic:** The hour after sunrise and before sunset often has the calmest winds and best lighting for audio-video projects.
**Check forecast the night before:** Morning conditions often differ from afternoon. Plan recording/inspection times based on hourly forecast.
**Temperature inversions trap pollution:** Cold mornings with little wind can cause high pollution near water treatment plants. Cross-reference with Air Quality API.
## Real-World Integration Example
**Tijuana soundwalk planning:**
```javascript
// Pseudo-code workflow
locations = ["Tijuana Jazz Club", "Foro Nebraska", "Black Box"]
for each location:
weather = getWeather(location.coords)
air_quality = getAirQuality(location.coords)
if weather.windSpeed < 10 AND weather.precipitation == 0 AND air_quality.uaqi < 100:
mark_location_as("optimal_for_recording")
else:
suggest_indoor_alternative(location)
```
## Related APIs
- [[Air Quality API]] - Pollution affects both hearing and breathing
- [[Pollen API]] - Combined respiratory health view
- [[Solar API]] - Solar radiation correlates with temperature
- [[Directions API]] - Weather-aware route planning
## Resources
- [Weather API Documentation](https://developers.google.com/maps/documentation/weather)
- Weather codes and their meanings
- Best practices for weather-aware application design