using WildfireData
using CairoMakie, GeoMakie, Tyler
using Extents, TileProviders
CairoMakie.activate!()
data = MTBS.largest_fires(50)
lons = Float64[]
lats = Float64[]
acres = Float64[]
for feature in data
props = feature.properties
geom = feature.geometry
isnothing(geom) && continue
a = get(props, :ACRES, nothing)
(isnothing(a) || a <= 0) && continue
push!(lons, geom.coordinates[1])
push!(lats, geom.coordinates[2])
push!(acres, Float64(a))
end
if !isempty(lons)
pad = 2.0
ext = Extent(; X=(minimum(lons) - pad, maximum(lons) + pad),
Y=(minimum(lats) - pad, maximum(lats) + pad))
m = Tyler.Map(ext;
size = (900, 600),
axis = (; type = GeoMakie.GeoAxis, dest = "+proj=merc"),
provider = TileProviders.OpenStreetMap(:Mapnik),
)
scatter!(m.axis, lons, lats,
markersize=sqrt.(acres) ./ 80,
color=(:firebrick, 0.6),
strokecolor=:black, strokewidth=0.5)
m.figure
endMTBS
Monitoring Trends in Burn Severity
Overview
The MTBS module provides access to burn severity data from the Monitoring Trends in Burn Severity program. MTBS maps the burn severity and perimeters of large fires across the United States.
Data Source: MTBS
Available Datasets
| Dataset | Description | Geometry |
|---|---|---|
:fire_occurrence |
Fire occurrence points (1984-present) | point |
:burn_boundaries |
Burned area boundaries (1984-present) | polygon |
Basic Usage
using WildfireData
# List all datasets
MTBS.datasets()
# Get dataset info
MTBS.info(:fire_occurrence)Downloading Data
# Download fire occurrence points
data = MTBS.download(:fire_occurrence, limit=100)
# Download burn boundaries
data = MTBS.download(:burn_boundaries, limit=10)
# Download with filter
data = MTBS.download(:fire_occurrence, where="ACRES > 10000", limit=50)Querying
# Count records
n = MTBS.count(:fire_occurrence)
n = MTBS.count(:burn_boundaries)
# Count with filter
n = MTBS.count(:fire_occurrence, where="ACRES > 5000")
# Get field information
fields = MTBS.fields(:fire_occurrence)Convenience Functions
# Query fire occurrence with filters
data = MTBS.fires(year=2020, limit=100)
data = MTBS.fires(min_acres=50000, fire_type="Wildfire", limit=100)
# Query burn boundaries with filters
data = MTBS.boundaries(year=2020, limit=50)
data = MTBS.boundaries(min_acres=100000, limit=50)
# Get largest fires (sorted client-side)
largest = MTBS.largest_fires(10)
largest = MTBS.largest_fires(10, year=2020)Saving and Loading Files
# Download and save to local file
path = MTBS.download_file(:fire_occurrence, limit=100)
# Load previously downloaded file
data = MTBS.load_file(:fire_occurrence)Working with Results
data = MTBS.download(:fire_occurrence, limit=5)
# Iterate directly over the FeatureCollection
for feature in data
println("$(feature.FIRE_NAME): $(feature.ACRES) acres")
endDirect Downloads
MTBS also provides direct download links for full shapefiles and geodatabases:
# List available downloads
MTBS.available_downloads()
# Download a shapefile or geodatabase
path = MTBS.download_shapefile(:fire_occurrence_shp)
path = MTBS.download_shapefile(:burn_boundaries_gdb)| Key | Description |
|---|---|
:burn_boundaries_shp |
Burn area boundaries shapefile (~374 MB) |
:burn_boundaries_gdb |
Burn area boundaries geodatabase (~158 MB) |
:fire_occurrence_shp |
Fire occurrence points shapefile (~3 MB) |
:fire_occurrence_gdb |
Fire occurrence points geodatabase (~2 MB) |
Plot Example
API Reference
Functions
datasets()- List available datasetsinfo(dataset)- Print dataset informationdownload(dataset; where, fields, limit, verbose)- Download datadownload_file(dataset; filename, force, verbose, ...)- Download and save to fileload_file(dataset; filename)- Load previously downloaded filecount(dataset; where)- Get record countfields(dataset)- Get field names and typesquery_url(dataset; kwargs...)- Build query URLfires(; year, min_acres, max_acres, fire_type, limit)- Query fire occurrenceboundaries(; year, min_acres, max_acres, limit)- Query burn boundarieslargest_fires(n; year)- Get largest fires by acreageavailable_downloads()- List direct download optionsdownload_shapefile(key; force, verbose)- Download shapefile/geodatabasedir()- Get local data directory path