This is a fairly simple wrapper to the APIs available from the US Forest Service's FIADB.
For an interactive version of trees/per acre by county, see /demo/index.html
.
- General FIADB API "documentation"
- List of
fullReport
variables - List of
fullReport
population estimates or useFIADB.fullreport.list_attributes()
- Table documentation PDFs
from fiadb import FIADB
client = FIADB() # or:
client = FIADB(verbose = True) # print HTTP request urls for each query
Valid fullReport queries can be very difficult to write and parse without testing first on the USDA's Java-based Evalidator.
# Find total number of softwood and hardwood trees by Wisconsin county
trees = client.fullreport.get(
reptype="State",
snum="Number of live trees (at least 1 inch d.b.h./d.r.c.), in trees, on forest land",
wc=552018,
pselected="None",
rselected="County code and name",
cselected="Species group - Major"
)["row]
See the visual examples at the bottom of this guide, which were created with data taken from fullreport
queries.
# Most recent evalGrps for Minnesota, Wisconsin
client.evalgrp.get(whereClause="STATECD IN (55, 27)")
> [272018, 552018]
# All evalGrps for New York
client.evalgrp.get(whereClause="STATECD IN (26)", mostRecent="N")
> [261980, 261993, 262003, 262004, 262005, 262006, 262007, 262008, 262009, 262010, 262011, 262012, 262013, 262014, 262015, 262016, 262017, 262018, 262019]
# State codes within 100mi of Minneapolis, MN
client.statecdlonlatrad.get(lat=45, lon=93, rad=100)
> [55, 27]
# List all unique entries with "walnut" in the common name
walnuts = client.reftable.get(
tableName="REF_SPECIES",
colList="common_name, genus, species",
whereStr="upper(common_name) LIKE '%WALNUT%'\r\n"
)
"\r\n".join(["%s | *%s %s*" % (e['COMMON_NAME'], e['GENUS'], e['SPECIES']) for e in walnuts])
Common Name | Species |
---|---|
West Indian walnut | Juglans jamaicensis |
English walnut | Juglans regia |
Indian walnut | Aleurites moluccana |
walnut spp. | Juglans spp. |
black walnut | Juglans nigra |
northern California black walnut | Juglans hindsii |
southern California black walnut | Juglans californica |
Texas walnut | Juglans microcarpa |
Arizona walnut | Juglans major |
County-level choropleths (region-shaded maps) are easy to create using a utility like plotly (which has a Python implementation) or Leaflet.
> pip install plotly
> pip install psutil requests ipywidgets
# Optionally install orca for exporting static images