Skip to main content

Spatial raster analysis for USDA Forest Service BIGMAP data - Part of the FIA Python Ecosystem

Project description

GridFIA

GridFIA is a spatial raster analysis tool for USDA Forest Service BIGMAP data, providing efficient Zarr-based storage and processing for localized forest biomass analysis.

Part of the FIA Python Ecosystem:

About BIGMAP

The USDA Forest Service's BIGMAP project provides tree species aboveground biomass estimates at 30-meter resolution across the continental United States. This data, derived from Landsat 8 imagery (2014-2018) and 212,978 FIA plots, represents biomass for 327 individual tree species in tons per acre.

What This Project Does

GridFIA bridges the gap between the BIGMAP REST API and local analysis by:

  • Converting raster data from the FIA BIGMAP ImageServer into efficient Zarr stores
  • Enabling localized analysis for any US state, county, or custom region
  • Providing ready-to-use tools for calculating forest diversity metrics
  • Optimizing data access patterns for scientific computing workflows

Key Features

  • Zarr Storage: Converts BIGMAP GeoTIFF data into cloud-optimized Zarr arrays for fast local analysis
  • REST API Integration: Direct access to FIA BIGMAP ImageServer (327 tree species, 30m resolution)
  • Location Flexibility: Analyze any US state, county, or custom geographic region
  • Analysis Ready: Pre-configured calculations for diversity indices, biomass totals, and species distributions
  • Performance: Chunked storage with compression for efficient data access patterns
  • Visualization: Create publication-ready maps with automatic boundary detection

Installation

# Using uv (recommended)
uv venv
uv pip install -e ".[dev]"

# Using pip
pip install -e ".[dev]"

Quick Start

Python API

from gridfia import GridFIA

# Initialize API
api = GridFIA()

# List available species
species = api.list_species()

# Download species data for a location
files = api.download_species(
    state="North Carolina",
    county="Wake",
    species_codes=["0131", "0068"],  # Loblolly Pine, Red Maple
    output_dir="data/wake"
)

# Create Zarr store from downloaded data
zarr_path = api.create_zarr(
    input_dir="data/wake",
    output_path="data/wake_forest.zarr"
)

# Calculate forest metrics
results = api.calculate_metrics(
    zarr_path=zarr_path,
    calculations=["species_richness", "shannon_diversity", "total_biomass"]
)

# Create visualization maps
maps = api.create_maps(
    zarr_path=zarr_path,
    map_type="diversity",
    output_dir="maps/"
)

Using Bounding Boxes

from gridfia import GridFIA

api = GridFIA()

# Download using explicit bounding box (Web Mercator)
files = api.download_species(
    bbox=(-8792000, 4274000, -8732000, 4334000),
    crs="3857",
    species_codes=["0131"],
    output_dir="data/custom"
)

Supported Locations

GridFIA supports analysis for:

  • All 50 US States: Automatic State Plane CRS detection
  • Counties: Any US county within a state
  • Custom Regions: Define your own bounding box
  • Multi-State Regions: Combine multiple states

Available Calculations

Calculation Description Units
species_richness Number of tree species per pixel count
shannon_diversity Shannon diversity index index
simpson_diversity Simpson diversity index index
evenness Pielou's evenness (J) ratio
total_biomass Total biomass across all species Mg/ha
dominant_species Most abundant species by biomass species_id
species_proportion Proportion of specific species ratio

API Reference

GridFIA Class

The main API interface for all GridFIA functionality:

from gridfia import GridFIA
from gridfia.config import GridFIASettings, CalculationConfig

# Initialize with default settings
api = GridFIA()

# Initialize with custom settings
settings = GridFIASettings(
    output_dir=Path("output"),
    calculations=[
        CalculationConfig(name="species_richness", enabled=True),
        CalculationConfig(name="shannon_diversity", enabled=True)
    ]
)
api = GridFIA(config=settings)

Methods

  • list_species() - List available species from BIGMAP
  • download_species() - Download species data for a location
  • create_zarr() - Create Zarr store from GeoTIFF files
  • calculate_metrics() - Run forest metric calculations
  • create_maps() - Create visualization maps
  • validate_zarr() - Validate a Zarr store
  • get_location_config() - Get location configuration

Integration with FIA Ecosystem

GridFIA works seamlessly with other FIA Python tools:

# Use with PyFIA for survey data
from pyfia import FIAData
from gridfia import GridFIA

# Get species information from PyFIA
fia_data = FIAData()
species_info = fia_data.query_species()

# Use species codes with GridFIA
api = GridFIA()
files = api.download_species(
    state="Oregon",
    species_codes=species_info["species_code"].tolist()
)

Development

# Run tests
uv run pytest

# Format code
uv run black gridfia/
uv run isort gridfia/

# Type checking
uv run mypy gridfia/

# Build documentation
uv run mkdocs serve

Data Sources

FIA BIGMAP (2018)

This project accesses the USDA Forest Service FIA BIGMAP Tree Species Aboveground Biomass layers:

  • Resolution: 30 meters
  • Species: 327 individual tree species
  • Coverage: Continental United States
  • Units: Tons per acre (converted to Mg/ha in processing)
  • Source: Landsat 8 OLI (2014-2018) + 212,978 FIA plots
  • REST API: https://di-usfsdata.img.arcgis.com/arcgis/rest/services/FIA_BIGMAP_2018_Tree_Species_Aboveground_Biomass/ImageServer

Citation

If you use GridFIA in your research, please cite:

@software{gridfia2025,
  title = {GridFIA: Spatial Raster Analysis for USDA Forest Service BIGMAP Data},
  year = {2025},
  url = {https://github.com/mihiarc/gridfia}
}

License

MIT License - See LICENSE file for details

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gridfia-0.3.0.tar.gz (263.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gridfia-0.3.0-py3-none-any.whl (83.7 kB view details)

Uploaded Python 3

File details

Details for the file gridfia-0.3.0.tar.gz.

File metadata

  • Download URL: gridfia-0.3.0.tar.gz
  • Upload date:
  • Size: 263.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for gridfia-0.3.0.tar.gz
Algorithm Hash digest
SHA256 dbad58e2cea76e11d00947f85057bf0cab96844c3dbead85111395e91c70e77d
MD5 67d4cee005a554ab15536b101c0f6ad9
BLAKE2b-256 393912aef5ce7990a446da3d6ef82c48d76ed24613dd107b7300035f0d0d51aa

See more details on using hashes here.

File details

Details for the file gridfia-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gridfia-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 83.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for gridfia-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 063a52a2274fe118cdf31a186c35b030aacfdc7e6e50b2790d7aee4627dea9b1
MD5 61b3a4b91486e27d4cfc78a625f00e1f
BLAKE2b-256 5f88058436e959ebab9fbc0f62414d8324ee05367964c55e7f33a2c386e66745

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page