Lightning density gridded data product.
Overview¶
Spire’s lightning product provides gridded lightning strike density data derived from real-time cloud-to-ground lightning strike observations. The product generates a density grid that tallies recent lightning activity.
Key Specifications¶
| Property | Value |
|---|---|
| Coverage | CONUS (Continental United States) |
| Grid | 5 km × 5 km equal-area |
| Update frequency | Every 5 minutes |
| Time window | Rolling 60-minute cloud-to-ground strike count |
| File format | NetCDF |
Endpoints¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /lightning/file | List lightning density files |
| GET | /lightning/file/{file_id} | Download a lightning density file |
List Lightning Files¶
GET /lightning/fileRetrieve a list of available lightning density files.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
time | string | No | ISO 8601 timestamp or time range |
regions | string | No | Region name |
Example Request¶
Shell
Python
Node.js
curl -X GET \
'https://api.wx.spire.com/lightning/file' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/lightning/file",
headers={"spire-api-key": "YOUR_API_KEY"},
)
data = response.json()const response = await fetch(
"https://api.wx.spire.com/lightning/file",
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);
const data = await response.json();Response¶
{
"meta": {
"count": 288
},
"files": [
"lightning.20250130.t21m15.05km.core.conus-equal-area.f01m00.nc",
"lightning.20250130.t21m20.05km.core.conus-equal-area.f01m00.nc",
"lightning.20250130.t21m25.05km.core.conus-equal-area.f01m00.nc"
]
}File Naming Convention¶
Lightning density files follow a specific naming pattern:
lightning.{date}.{time}.{resolution}.{bundle}.{region}.{window}.nc| Component | Example | Description |
|---|---|---|
lightning | — | Product identifier |
20250130 | Date | File date (YYYYMMDD) |
t21m15 | Time | File time — hour 21, minute 15 UTC |
05km | Resolution | 5 km grid spacing |
core | Bundle | Data bundle |
conus-equal-area | Region | CONUS equal-area grid |
f01m00 | Window | 1-hour (01m00 = 1 hour, 0 minutes) rolling window |
.nc | Format | NetCDF format |
Download Lightning File¶
GET /lightning/file/{file_id}Download a specific lightning density file.
Path Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | Filename to download |
Example Request¶
Shell
Python
Node.js
curl -OJL -X GET \
'https://api.wx.spire.com/lightning/file/lightning.20250130.t21m15.05km.core.conus-equal-area.f01m00.nc' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/lightning/file/lightning.20250130.t21m15.05km.core.conus-equal-area.f01m00.nc",
headers={"spire-api-key": "YOUR_API_KEY"},
allow_redirects=True,
)
with open("lightning.20250130.t21m15.05km.core.conus-equal-area.f01m00.nc", "wb") as f:
f.write(response.content)import { createWriteStream } from "fs";
import { Readable } from "stream";
const response = await fetch(
"https://api.wx.spire.com/lightning/file/lightning.20250130.t21m15.05km.core.conus-equal-area.f01m00.nc",
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);
const fileStream = createWriteStream(
"lightning.20250130.t21m15.05km.core.conus-equal-area.f01m00.nc"
);
Readable.fromWeb(response.body).pipe(fileStream);Data Description¶
Each lightning density file is a NetCDF gridded dataset covering the CONUS region. Each grid cell (5 km × 5 km) contains a count of cloud-to-ground lightning strikes detected within the rolling 60-minute time window ending at the file’s timestamp.
| Field | Description | Units |
|---|---|---|
strike_density | Count of cloud-to-ground strikes per grid cell in the rolling 60-minute window | count |
Python Example¶
Load and visualize lightning density data:
import requests
import xarray as xr
headers = {'spire-api-key': 'YOUR_API_KEY'}
# Get list of available files
response = requests.get(
'https://api.wx.spire.com/lightning/file',
headers=headers
)
files = response.json()['files']
latest_file = files[-1]
print(f"Downloading: {latest_file}")
# Download latest file
file_response = requests.get(
f'https://api.wx.spire.com/lightning/file/{latest_file}',
headers=headers,
allow_redirects=True
)
with open(latest_file, 'wb') as f:
f.write(file_response.content)
# Load with xarray
ds = xr.open_dataset(latest_file)
print(ds)Visualize Lightning Density¶
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
fig, ax = plt.subplots(
figsize=(12, 8),
subplot_kw={'projection': ccrs.LambertConformal(
central_longitude=-96, central_latitude=39
)}
)
ax.add_feature(cfeature.LAND, alpha=0.3)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.BORDERS, linestyle=':')
ax.add_feature(cfeature.STATES, linewidth=0.5)
ax.set_extent([-125, -66, 24, 50])
# Plot the density grid (adjust variable name based on actual file contents)
ds['strike_density'].plot(
ax=ax,
transform=ccrs.PlateCarree(),
cmap='hot_r',
add_colorbar=True
)
plt.title(f'Lightning Strike Density\n{latest_file}')
plt.show()