pyfia.estimation.estimators.area
Area estimation for FIA data.
Simple, straightforward implementation without unnecessary abstractions.
Functions
area
db: Database connection or path to FIA database. Can be either a path string to a DuckDB/SQLite file or an existing FIA connection object.grp_by: Column name(s) to group results by. Can be any column from the PLOT and COND tables. Common grouping columns include:
- ‘OWNGRPCD’: Ownership group (10=National Forest, 20=Other Federal, 30=State/Local, 40=Private)
- ‘OWNCD’: Detailed ownership code (see REF_RESEARCH_STATION)
- ‘ADFORCD’: Administrative forest code
- ‘RESERVCD’: Reserved status (0=Not reserved, 1=Reserved)
- ‘FORTYPCD’: Forest type code (see REF_FOREST_TYPE)
- ‘STDSZCD’: Stand size class (1=Large diameter, 2=Medium diameter, 3=Small diameter, 4=Seedling/sapling, 5=Nonstocked)
- ‘STDORGCD’: Stand origin (0=Natural, 1=Planted)
- ‘STDAGE’: Stand age in years
- ‘SITECLCD’: Site productivity class (1=225+ cu ft/ac/yr, 2=165-224, 3=120-164, 4=85-119, 5=50-84, 6=20-49, 7=0-19)
- ‘PHYSCLCD’: Physiographic class code
- ‘STATECD’: State FIPS code
- ‘UNITCD’: FIA survey unit code
- ‘COUNTYCD’: County code
- ‘INVYR’: Inventory year
- ‘DSTRBCD1’, ‘DSTRBCD2’, ‘DSTRBCD3’: Disturbance codes
- ‘TRTCD1’, ‘TRTCD2’, ‘TRTCD3’: Treatment codes
-
land_type: Land type to include in estimation: - ‘forest’: All forestland (COND_STATUS_CD = 1)
- ‘timber’: Timberland only (unreserved, productive forestland)
- ‘all’: All land types including non-forest
-
area_domain: SQL-like filter expression for COND-level attributes. Examples: - “STDAGE > 50”: Stands older than 50 years
- “FORTYPCD IN (161, 162)”: Specific forest types
- “OWNGRPCD == 10”: National Forest lands only
- “PHYSCLCD == 31 AND STDSZCD == 1”: Xeric sites with large trees
-
plot_domain: SQL-like filter expression for PLOT-level attributes. This parameter enables filtering by plot location and attributes that are not available in the COND table. Examples:
- “COUNTYCD == 183”: Wake County, NC (single county)
- “COUNTYCD IN (183, 185, 187)”: Multiple counties
- “UNITCD == 1”: Survey unit 1
- “LAT >= 35.0 AND LAT <= 36.0”: Latitude range
- “LON >= -80.0 AND LON <= -79.0”: Longitude range
- “ELEV > 2000”: Elevation above 2000 feet
- “INVYR == 2019”: Inventory year
- “MEASYEAR >= 2015”: Measured since 2015
most_recent: If True, automatically select the most recent evaluation for each state/region. Equivalent to calling db.clip_most_recent() first.eval_type: Evaluation type to select if most_recent=True. Options: ‘ALL’, ‘VOL’, ‘GROW’, ‘MORT’, ‘REMV’, ‘CHANGE’, ‘DWM’, ‘INV’. Default is ‘ALL’ for area estimation.variance: If True, return variance instead of standard error.totals: If True, include total area estimates expanded to population level. If False, only return per-acre values.
- Area estimates with the following columns:
- YEAR : int Inventory year
- [grouping columns] : varies Any columns specified in grp_by parameter
- AREA_PERC : float Percentage of the sampled area in the requested land/condition class
- AREA_SE_PERCENT : float Standard error of AREA_PERC (the percentage)
- AREA : float Total area in acres, expanded to the population
- AREA_SE : float Standard error of AREA (the total, in acres)
- AREA_VARIANCE : float Variance of the total area in acres (equals AREA_SE squared)
- TOTAL_EXPNS : float Total expansion factor (population acres) for the evaluation
- N_PLOTS : int Number of plots contributing to the estimate
Timber area by forest type for stands over 50 years:from pyfia import FIA, area with FIA(“path/to/fia.duckdb”) as db: … db.clip_by_state(37) # North Carolina … results = area(db, land_type=“forest”) Area by ownership group: results = area(db, grp_by=“OWNGRPCD”)Results will show area for each ownership category
results = area( … db, … grp_by=“FORTYPCD”, … land_type=“timber”, … area_domain=“STDAGE > 50” … ) Multiple grouping variables: results = area( … db, … grp_by=[“STATECD”, “OWNGRPCD”, “STDSZCD”], … land_type=“forest” … ) Area by disturbance type: results = area( … db, … grp_by=“DSTRBCD1”, … area_domain=“DSTRBCD1 > 0” # Only disturbed areas … ) Filter by county using plot_domain: results = area( … db, … plot_domain=“COUNTYCD == 183”, # Wake County, NC … land_type=“forest” … ) Combine plot and area domain filters: results = area( … db, … plot_domain=“COUNTYCD IN (183, 185, 187)”, # Multiple counties … area_domain=“OWNGRPCD == 40”, # Private land only … grp_by=“FORTYPCD” … ) Geographic filtering with plot_domain: results = area( … db, … plot_domain=“LAT >= 35.0 AND LAT <= 36.0 AND ELEV > 1000”, … land_type=“forest” … )
Classes
AreaEstimator
Area estimator for FIA data.
Estimates forest area by various categories without complex
abstractions or deep inheritance hierarchies.
Methods:
get_required_tables
get_cond_columns
calculate_values
apply_filters
aggregate_results
- Bundle containing results, plot_condition_data (as plot_tree_data field), and group_cols for explicit variance calculation.
calculate_variance
agg_result: Bundle containing results, plot_condition_data (as plot_tree_data field), and group_cols from aggregate_results().
- Results with variance columns added.