pyfia.downloader
FIA Data Download Module.
This module provides functionality to download FIA data directly from the
USDA Forest Service FIA DataMart, similar to rFIA’s getFIA() function in R.
Downloads CSV files from FIA DataMart and converts them to DuckDB format
for use with pyFIA.
Examples
from pyfia import downloadDownload Georgia data (returns path to DuckDB database)
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”)Download only common tables (default)
db_path = download(“GA”, common=True)
References
- FIA DataMart: https://apps.fs.usda.gov/fia/datamart/datamart.html
- rFIA Package: https://doserlab.com/files/rfia/
Functions
download
states: State abbreviations (e.g., ‘GA’, ‘NC’). Supports multiple states: [‘GA’, ‘FL’, ‘SC’]dir: Directory to save downloaded data. Defaults to ~/.pyfia/data/common: If True, download only tables required for pyFIA functions. If False, download all available tables.tables: Specific tables to download. Overridescommonparameter.force: If True, re-download even if files exist locally.show_progress: Show download progress bars.use_cache: Use cached downloads if available.
- Path to the DuckDB database file.
from pyfia import downloadDownload Georgia data
db_path = download(“GA”)Download multiple states merged into one database
db_path = download([“GA”, “FL”, “SC”])Download only specific tables
db_path = download(“GA”, tables=[“PLOT”, “TREE”, “COND”])Use with pyFIA immediately
from pyfia import FIA, area with FIA(download(“GA”)) as db: … db.clip_most_recent() … result = area(db)
clear_cache
older_than_days: Only clear entries older than this many days.state: Only clear entries for this state.delete_files: If True, also delete the cached files from disk.
- Number of cache entries cleared.
cache_info
- Cache statistics including size, file count, etc.