using WildfireData
using CairoMakie, GeoMakie, Tyler
using Extents, TileProviders
CairoMakie.activate!()
if !isempty(get(ENV, "FIRMS_MAP_KEY", ""))
df = FIRMS.download(:VIIRS_NOAA20_NRT, region=:conus, days=1, verbose=false)
if !isempty(df)
ext = Extent(; X=(-130.0, -65.0), Y=(24.0, 50.0))
m = Tyler.Map(ext;
size = (900, 600),
axis = (; type = GeoMakie.GeoAxis, dest = "+proj=merc"),
provider = TileProviders.OpenStreetMap(:Mapnik),
)
sc = scatter!(m.axis, df.longitude, df.latitude, color=df.frp,
colormap=:hot, markersize=4)
Colorbar(m.figure[1, 2], sc, label="Fire Radiative Power (MW)")
m.figure
end
else
@info "FIRMS_MAP_KEY not set, skipping plot"
endFIRMS
Fire Information for Resource Management System
Overview
The FIRMS module provides access to NASA’s Fire Information for Resource Management System. FIRMS distributes near real-time active fire data from satellite sensors including MODIS, VIIRS, and LANDSAT.
Data Source: NASA FIRMS
API Key Setup
FIRMS requires a free API key (MAP_KEY) from NASA.
- Register at NASA Earthdata
- Request a FIRMS MAP_KEY at FIRMS MAP_KEY Request
using WildfireData
# Set via environment variable (recommended)
ENV["FIRMS_MAP_KEY"] = "your-32-character-key"
# Or set programmatically
FIRMS.set_map_key!("your-32-character-key")
# Check current key
FIRMS.get_map_key()Available Sources
| Source | Description |
|---|---|
:MODIS_NRT |
MODIS Near Real-Time |
:MODIS_SP |
MODIS Standard Processing |
:VIIRS_NOAA20_NRT |
VIIRS NOAA-20 Near Real-Time |
:VIIRS_NOAA21_NRT |
VIIRS NOAA-21 Near Real-Time |
:VIIRS_SNPP_NRT |
VIIRS Suomi NPP Near Real-Time |
:VIIRS_NOAA20_SP |
VIIRS NOAA-20 Standard Processing |
:VIIRS_SNPP_SP |
VIIRS Suomi NPP Standard Processing |
:LANDSAT_NRT |
LANDSAT Near Real-Time |
Basic Usage
using WildfireData
# List all sources
FIRMS.sources()
# Filter by type
FIRMS.sources(type=:NRT)
# Print general info
FIRMS.info()Downloading Data
By Region
# Download for a predefined region
df = FIRMS.download(:VIIRS_NOAA20_NRT, region=:california, days=1)
# Available regions
FIRMS.regions() # :conus, :california, :western_us, etc.By Bounding Box
# Download for custom bounding box ("west,south,east,north")
df = FIRMS.download(:VIIRS_NOAA20_NRT, area="-125,32,-114,42", days=1)Historical Data
# Last N days (1-10)
df = FIRMS.download(:VIIRS_NOAA20_NRT, region=:california, days=3)
# Specific date
df = FIRMS.download(:VIIRS_SNPP_SP, region=:western_us, days=1, date="2023-08-15")Working with Results
FIRMS returns a DataFrame:
df = FIRMS.download(:VIIRS_NOAA20_NRT, region=:california, days=1)
# View columns
names(df)
# Filter by confidence
high_confidence = filter(row -> row.confidence == "h", df)
# Get fire locations
for row in eachrow(df)
println("Lat: $(row.latitude), Lon: $(row.longitude)")
println(" FRP: $(row.frp)")
endKey Fields
| Field | Description |
|---|---|
latitude / longitude |
Fire location |
bright_ti4 |
Brightness temperature (Kelvin) |
bright_ti5 |
Brightness temperature (Kelvin) |
frp |
Fire Radiative Power (MW) |
confidence |
Detection confidence (l/n/h for low/nominal/high) |
acq_date |
Acquisition date |
acq_time |
Acquisition time (HHMM) |
satellite |
Satellite name |
daynight |
Day or night detection (D/N) |
Convenience Functions
# Get recent fires with optional confidence filtering
df = FIRMS.recent_fires(region=:california, days=2)
df = FIRMS.recent_fires(source=:MODIS_NRT, region=:conus, min_confidence=80)
# Group detections by date
by_date = FIRMS.hotspots_by_date(region=:western_us, days=5)
# Check data availability
avail = FIRMS.data_availability(:VIIRS_NOAA20_NRT)Saving and Loading Files
# Download and save to CSV
path = FIRMS.download_file(:VIIRS_NOAA20_NRT, region=:california, days=1)
# Load previously downloaded file (pass the filename as a String)
df = FIRMS.load_file("VIIRS_NOAA20_NRT_20240115.csv")Predefined Regions
FIRMS.regions()| Region | Description |
|---|---|
:world |
Global coverage |
:conus |
Continental United States |
:alaska |
Alaska |
:california |
California |
:western_us |
Western United States |
:eastern_us |
Eastern United States |
:canada |
Canada |
:australia |
Australia |
:europe |
Europe |
:amazon |
Amazon basin |
:africa |
Africa |
Plot Example
API Reference
Functions
sources(; type=nothing)- List available satellite sourcesinfo()- Print FIRMS API informationregions()- List predefined regionsdownload(source; area, region, days, date, verbose)- Download fire datadownload_file(source; filename, force, verbose, ...)- Download and save to fileload_file(filename)- Load previously downloaded CSV filequery_url(source, area, days; date)- Build API query URLdata_availability(source)- Check data availabilityrecent_fires(; source, region, days, min_confidence)- Get recent detectionshotspots_by_date(; source, region, days)- Group detections by dateget_map_key()- Get current API keyset_map_key!(key)- Set API keydir()- Get local data directory path