Skip to content
/ pyfia Public

pyFIA provides a programmatic API for working with Forest Inventory and Analysis (FIA) data. It leverages modern Python data science tools like Polars and DuckDB for efficient processing of large-scale national forest inventory datasets while maintaining exact statistical compatibility with FIA EVALIDator.

License

Notifications You must be signed in to change notification settings

mihiarc/pyfia

pyFIA

The Python API for forest inventory data

PyPI PyPI Downloads Documentation License: MIT Python 3.11+


A high-performance Python library for analyzing USDA Forest Inventory and Analysis (FIA) data. Built on DuckDB and Polars for speed, with statistical methods that match EVALIDator exactly.

Why pyFIA?

Feature pyFIA EVALIDator
Speed 10-100x faster Baseline
Interface Python API Web UI
Reproducibility Code-based Manual
Custom analysis Unlimited Limited options
Statistical validity ✓ Exact match ✓ Reference

Quick Start

pip install pyfia
from pyfia import FIA, biomass, tpa, volume, area

with FIA("path/to/FIA_database.duckdb") as db:
    db.clip_by_state(37)  # North Carolina
    db.clip_most_recent(eval_type="EXPVOL")

    # Core estimates
    trees = tpa(db, tree_domain="STATUSCD == 1")
    carbon = biomass(db, by_species=True)
    timber = volume(db, land_type="timber")
    forest = area(db, land_type="forest")

Core Functions

Function Description Example
tpa() Trees per acre tpa(db, tree_domain="DIA >= 5.0")
biomass() Above/belowground biomass biomass(db, by_species=True)
volume() Merchantable volume (ft³) volume(db, land_type="timber")
area() Forest land area area(db, grp_by="FORTYPCD")
site_index() Site productivity index site_index(db, grp_by="COUNTYCD")
mortality() Annual mortality rates mortality(db)
growth() Net growth estimation growth(db)

Statistical Methods

pyFIA implements design-based estimation following Bechtold & Patterson (2005):

  • Post-stratified estimation with proper variance calculation
  • Ratio-of-means estimators for per-acre values
  • EVALID-based filtering for statistically valid estimates
  • Temporal methods: TI, annual, SMA, LMA, EMA

Installation Options

# Basic
pip install pyfia

# With spatial support
pip install pyfia[spatial]

# Development
git clone https://github.com/mihiarc/pyfia.git
cd pyfia && pip install -e .[dev]

Documentation

Full documentation: mihiarc.github.io/pyfia

Citation

@software{pyfia2025,
  title = {pyFIA: A Python Library for Forest Inventory Applications},
  author = {Mihiar, Christopher},
  year = {2025},
  url = {https://github.com/mihiarc/pyfia}
}

Affiliation

Developed in collaboration with USDA Forest Service Research & Development. pyFIA provides programmatic access to Forest Inventory and Analysis (FIA) data but is not part of the official FIA Program.


Built by Chris Mihiar

About

pyFIA provides a programmatic API for working with Forest Inventory and Analysis (FIA) data. It leverages modern Python data science tools like Polars and DuckDB for efficient processing of large-scale national forest inventory datasets while maintaining exact statistical compatibility with FIA EVALIDator.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages