Skip to content

Commit c28fb20

Browse files
committed
Add FEDS module for fire event data access
1 parent 83349c7 commit c28fb20

5 files changed

Lines changed: 622 additions & 1 deletion

File tree

docs/_quarto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ book:
3030
- modules/mtbs.qmd
3131
- modules/firms.qmd
3232
- modules/landfire.qmd
33+
- modules/feds.qmd
3334
- part: "API"
3435
chapters:
3536
- api.qmd

docs/modules/feds.qmd

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: "FEDS"
3+
subtitle: "Fire Events Data Suite"
4+
engine: julia
5+
---
6+
7+
## Overview
8+
9+
The FEDS module provides access to NASA's Fire Events Data Suite from the [Wildfire Tracking Lab](https://earth-information-system.github.io/fireatlas/). FEDS provides satellite-derived fire event tracking with perimeters, active fire lines, and new fire pixels via a public OGC API.
10+
11+
**Data Source:** [OpenVEDA Features API](https://openveda.cloud/api/features)
12+
13+
No API key is required.
14+
15+
## Available Collections
16+
17+
| Collection | Description | Category | Geometry |
18+
|------------|-------------|----------|----------|
19+
| `:snapshot_perimeters` | Rolling ~20-day fire perimeters (NRT) | snapshot | polygon |
20+
| `:snapshot_firelines` | Rolling ~20-day active fire lines (NRT) | snapshot | line |
21+
| `:snapshot_newfirepix` | Rolling ~20-day new fire pixels (NRT) | snapshot | point |
22+
| `:lf_perimeters` | Current-year large fire perimeters (>5 km²) | large_fire | polygon |
23+
| `:lf_firelines` | Current-year large fire lines (>5 km²) | large_fire | line |
24+
| `:lf_newfirepix` | Current-year large fire new pixels (>5 km²) | large_fire | point |
25+
| `:archive_perimeters` | Archived perimeters, Western US (2018-2021) | archive | polygon |
26+
| `:archive_firelines` | Archived fire lines, Western US (2018-2021) | archive | line |
27+
| `:archive_newfirepix` | Archived new fire pixels, Western US (2018-2021) | archive | point |
28+
29+
## Basic Usage
30+
31+
```julia
32+
using WildfireData.FEDS
33+
34+
# List all collections
35+
FEDS.collections()
36+
37+
# Filter by category
38+
FEDS.collections(category=:snapshot)
39+
FEDS.collections(category=:large_fire)
40+
FEDS.collections(category=:archive)
41+
42+
# Get collection info
43+
FEDS.info(:snapshot_perimeters)
44+
```
45+
46+
## Downloading Data
47+
48+
### Basic Download
49+
50+
```julia
51+
# Download first 10 snapshot perimeters
52+
data = FEDS.download(:snapshot_perimeters, limit=10)
53+
```
54+
55+
### Spatial Filtering (Bounding Box)
56+
57+
```julia
58+
# Download large fire perimeters in California
59+
data = FEDS.download(:lf_perimeters, bbox=(-125, 32, -114, 42))
60+
61+
# Bounding box as string also works
62+
data = FEDS.download(:lf_perimeters, bbox="-125,32,-114,42")
63+
```
64+
65+
### Temporal Filtering
66+
67+
```julia
68+
# Download archived perimeters for 2020
69+
data = FEDS.download(:archive_perimeters,
70+
datetime="2020-01-01T00:00:00Z/2020-12-31T23:59:59Z")
71+
```
72+
73+
### CQL Filtering
74+
75+
```julia
76+
# Use CQL filter expressions
77+
data = FEDS.download(:lf_perimeters, filter="farea > 100", limit=10)
78+
```
79+
80+
### Sorting and Pagination
81+
82+
```julia
83+
# Sort by fire area descending
84+
data = FEDS.download(:snapshot_perimeters, sortby="-farea", limit=10)
85+
86+
# Pagination
87+
page1 = FEDS.download(:snapshot_perimeters, limit=10)
88+
page2 = FEDS.download(:snapshot_perimeters, limit=10, offset=10)
89+
```
90+
91+
## Working with Results
92+
93+
The download function returns a `GeoJSON.FeatureCollection`:
94+
95+
```julia
96+
data = FEDS.download(:snapshot_perimeters, limit=5)
97+
98+
# Iterate over features
99+
for feature in data
100+
geom = GeoJSON.geometry(feature)
101+
println("Geometry type: $(typeof(geom))")
102+
end
103+
```
104+
105+
## Saving and Loading Files
106+
107+
```julia
108+
# Download and save to local file
109+
path = FEDS.download_file(:snapshot_perimeters, limit=100)
110+
111+
# Load previously downloaded file
112+
data = FEDS.load_file(:snapshot_perimeters)
113+
114+
# Custom filename
115+
path = FEDS.download_file(:lf_perimeters, filename="ca_fires.geojson",
116+
bbox=(-125, 32, -114, 42))
117+
```
118+
119+
## Plot Example
120+
121+
```{julia}
122+
using WildfireData.FEDS
123+
using GeoJSON, CairoMakie, GeoMakie, Tyler
124+
using Extents, TileProviders
125+
import JSON3
126+
CairoMakie.activate!()
127+
128+
data = FEDS.download(:snapshot_perimeters, limit=100, verbose=false)
129+
fc = GeoJSON.read(JSON3.write(data))
130+
131+
ext = Extent(; X=(-130.0, -65.0), Y=(24.0, 50.0))
132+
m = Tyler.Map(ext;
133+
size = (900, 600),
134+
axis = (; type = GeoMakie.GeoAxis, dest = "+proj=merc"),
135+
provider = TileProviders.OpenStreetMap(:Mapnik),
136+
)
137+
138+
for feature in fc
139+
geom = GeoJSON.geometry(feature)
140+
isnothing(geom) && continue
141+
poly!(m.axis, geom, color=(:orange, 0.4), strokecolor=:red, strokewidth=0.5)
142+
end
143+
144+
m.figure
145+
```
146+
147+
## API Reference
148+
149+
### Functions
150+
151+
- `collections(; category=nothing)` - List available collections
152+
- `info(collection)` - Print collection information
153+
- `download(collection; limit, offset, bbox, datetime, filter, sortby, verbose)` - Download data
154+
- `download_file(collection; filename, force, verbose, ...)` - Download and save to file
155+
- `load_file(collection; filename)` - Load previously downloaded file
156+
- `query_url(collection; limit, offset, bbox, datetime, filter, sortby)` - Build query URL
157+
- `dir()` - Get local data directory path

0 commit comments

Comments
 (0)