PyFIA¶
High-performance Python library for USDA Forest Inventory and Analysis (FIA) data.
PyFIA provides statistically valid estimation methods following Bechtold & Patterson (2005) methodology, enabling researchers and analysts to work with FIA data efficiently.
Features¶
- Direct Data Download: Download FIA data directly from the DataMart with
download("GA") - Statistical Rigor: Design-based estimation with proper variance calculations
- High Performance: Built on Polars and DuckDB for fast data processing
- EVALIDator Compatible: Results validated against official USFS estimates
- Simple API: Intuitive functions like
volume(),mortality(), andtpa() - Lazy Evaluation: Memory-efficient processing for large datasets
Quick Example¶
from pyfia import download, FIA, area
# Download Georgia FIA data directly
db_path = download("GA")
# Connect and analyze
with FIA(db_path) as db:
db.clip_most_recent()
result = area(db, land_type="forest")
print(result)
Installation¶
Getting Started¶
Download FIA Data¶
from pyfia import download
# Download a single state
db_path = download("GA")
# Download multiple states (merged into single database)
db_path = download(["GA", "FL", "SC"])
# Download to specific directory
db_path = download("GA", dir="./data")
Run Analysis¶
from pyfia import FIA, volume
with FIA(db_path) as db:
db.clip_by_state("GA")
result = volume(db, grp_by="SPCD")
print(result)
Documentation Overview¶
- :material-download: **[Downloading Data](guides/downloading.md)**
Download FIA data directly from the DataMart
- :material-rocket-launch: **[Getting Started](getting-started.md)**
Installation, setup, and your first analysis
- :material-book-open-variant: **[User Guide](guides/index.md)**
Domain filtering, variance estimation, and workflows
- :material-api: **[API Reference](api/index.md)**
Complete function and class documentation
- :material-file-code: **[Examples](examples.md)**
Real-world analysis examples
Estimation Functions¶
| Function | Description |
|---|---|
area() |
Estimate forest area by land type and categories |
area_change() |
Estimate annual changes in forest area |
volume() |
Estimate standing tree volume |
tpa() |
Calculate trees per acre and basal area |
biomass() |
Estimate tree biomass and carbon |
mortality() |
Calculate annual mortality rates |
growth() |
Estimate annual growth |
removals() |
Estimate timber removals |
Why PyFIA?¶
FIA data analysis traditionally requires complex SQL queries and careful attention to statistical methodology. PyFIA handles:
- Direct data access with automatic downloads from FIA DataMart
- Proper stratified estimation with expansion factors
- Variance calculation following ratio-of-means methodology
- EVALID filtering for consistent evaluation groups
- Domain-specific filtering (forest land, timberland, growing stock)
Comparison with rFIA¶
PyFIA brings the ease of rFIA's getFIA() to Python:
| Feature | rFIA (R) | PyFIA (Python) |
|---|---|---|
| Download data | getFIA(states='GA') |
download("GA") |
| Multiple states | getFIA(states=c('GA','FL')) |
download(["GA", "FL"]) |
| Estimate area | area(fiaData) |
area(db) |
| Estimate volume | biomass(fiaData) |
volume(db) |
License¶
PyFIA is released under the MIT License.