Function Repository Resource:

UnitedStatesCoalProduction

Source Notebook

Retrieve coal production data for regions in the United States

Contributed by: Arnoud Buzing

ResourceFunction["UnitedStatesCoalProduction"][region,key]

gives a time series for coal production in region, using the API key from the U.S. Energy Information Administration.

Details and Options

An API key can be obtained by completing the registration form on the U.S. Energy Information Administration website.
Regions are specified with codes documented by the API. For "series_id" values of the form "COAL.PRODUCTION.TOT-XXXX-TOT.A", the "XXXX" defines the region code for ResourceFunction["UnitedStatesCoalProduction"].
A region can be a state, in which case the code is the two-letter state abbreviation.
Coal production quantities are reported in short tons.

Examples

Basic Examples (3) 

Coal production in the United States for 2001—2018:

In[1]:=
ts = ResourceFunction["UnitedStatesCoalProduction"]["US", key]
Out[1]=

Average coal production over the time series:

In[2]:=
Mean[ts]
Out[2]=

Minimum and maximum coal production over the time series:

In[3]:=
MinMax[ts]
Out[3]=

Time series plot for the coal production:

In[4]:=
DateListPlot[ts]
Out[4]=

Coal production for the northern and southern Appalachian regions:

In[5]:=
DateListPlot[
 ResourceFunction["UnitedStatesCoalProduction"][#, key] & /@ {"APN", "APS"}, PlotLegends -> {"Northern Appalachia", "Southern Appalachia"}]
Out[5]=

Coal production for Texas, Kentucky, and Illinois:

In[6]:=
DateListPlot[
 ResourceFunction["UnitedStatesCoalProduction"][#, key] & /@ {"TX", "KY", "IL"}, PlotLegends -> {"Texas", "Kentucky", "Illinois"}]
Out[6]=

Publisher

Arnoud Buzing

Version History

  • 1.0.0 – 15 October 2020

Related Resources

License Information