Recipe: Historical Lightning
This recipe shows how to query historical lightning data to find out whether strikes occurred near a location on a given date.
These recipes are teaching examples — not production code.
- Host: examples use the development host apidev.accuweather.com. Switch to api.accuweather.com for production.
- Production hardening: GZIP compression, caching, retries with exponential backoff, and error handling are not included. See the Best Practices guide.
Scenario
"There was a big storm last week. I want to see how many lightning strikes happened near my area that day."
Call the Historical lightning endpoint with a location's coordinates, a search radius, and the date you're interested in.
Endpoint:
Code
Add &strikeType=cg to filter results to cloud-to-ground strikes only — the type most relevant for ground-level impact.
Pagination
Results come in pages of 5,000. Use the offset parameter as a page index (0 = first set, 1 = second set, etc.) to fetch additional pages:
Key response fields
| Field | Type | Description |
|---|---|---|
resultsCount | Integer | Total number of lightning strikes returned |
lightningSummary.positiveStrikes | Integer | Count of positively-charged strikes |
lightningSummary.negativeStrikes | Integer | Count of negatively-charged strikes |
lightningSummary.closestStrike | Object | GeoJSON feature of the strike nearest to the search center |
lightningStrikes.features[] | Array | GeoJSON features for each individual strike |
properties.strikeType | String | "cg" (cloud-to-ground), "ic" (intra-cloud), or "" (unknown) |
properties.peakCurrent | Integer | Strike amperage. Positive = more energetic. Negative = most common. null if unavailable. |
properties.sourceId | Integer | 84 (GOES East GLM), 85 (GOES West GLM), 86 (AccuWeather Lightning Network) |
Understanding peak current
| Polarity | Description | Significance |
|---|---|---|
| Positive (+) | Positively-charged cloud-to-ground strike | Typically more energetic. Carries more charge, longer duration. |
| Negative (-) | Negatively-charged cloud-to-ground strike | Most common type of lightning (~90% of CG strikes). |
null | Not available | Data source does not provide amperage (GLM satellites). |
Complete code sample
Copy a full, runnable example that queries historical lightning data and prints a summary.
Next steps
- Real-Time Lightning — monitor current strikes near a location
- Lightning Forecast — check lightning probability for the next 2 hours
- Lightning Parameters — full API reference