fied.analysis package

Submodules

fied.analysis.analysis_figures module

class FIED_analysis(year, file_path=None, pio_engine=None, df=None, fig_format='png')[source]

Bases: object

get_cbp_data()[source]

Get establishment counts from Census County Business Patterns for reporting year.

Returns:

cbp_data – DataFrame of CBP establishment counts by NAICS code for U.S. for specified year.

Return type:

pandas.DataFrame

create_core_analysis(**kwargs)[source]

Create summary figures and table.

summary_unit_table(eis_or_ghgrp_only=False)[source]

Creates a table that summarizes by industrial sector (i.e., 2-digit NAICS) various aspects of the dataset. Saves table to analysis directory and returns table.

Parameters:

final_data (pandas.DataFrame or parquet)

Returns:

summary_table

Return type:

pandas.DataFrame

plot_facility_count(write_fig=True)[source]

” Plots the count of facilities from foundational data and the count of establishments from the corresponding year of Census Business Patterns (CBP) data.

Parameters:

write_fig (bool; default=True) – Write resulting figure to analysis figures directory.

static plot_difference_nei(nei, data)[source]

Plot difference between max and min energy or throughput quanitites for units when there are multiple emissions per unit.

Parameters:
  • nei (pandas.DataFrame) – Unformatted NEI, prior to estimating quartile values for throughput and energy.

  • data (str; 'energy' or 'throughput')

id_sectors(df)[source]

Make a new sector column for NAICS 2-digit

Returns:

df – FIED with 2-digit NAICS code column

Return type:

pandas.DataFrame

summary_unit_bar(summary_table, write_fig=True)[source]

Make stacked bar chart showing units by Sector and total number of facilities reporting units

Paramters

summary_tablepandas.DataFrame

Output of summary_unit_table method.

write_figbool; default=True

Write figure to analysis figures directory

set_mecs_data(year=2018)[source]

” MECS format is not machine-friendly. This is a manual input of MECS combustion energy estimates from MECS Table 3.2: https://www.eia.gov/consumption/manufacturing/about.php

Returns:

mecs – Dictionary of combustion energy estimates from MECS (converted from TBtu to MJ), on a national and census region basis.

Return type:

dict

get_eia_seds(year=2017)[source]

Get EIA State Energy Data System (SEDS) data

Parameters:

year (int; default=2017) – Year of SEDS data to return.

Returns:

seds

Return type:

pandas.DataFrame

get_state_region()[source]

Download state to region file

plot_eia_comparison_maps(dataset, year=2017, write_fig=True)[source]

Plots a relative comparison of FIED vs. EIA on a geographic basis (combustion energy only). For MECS, this is census region; for SEDS, states.

Parameters:
  • dataset (str; {'mecs', 'seds'}) – EIA dataset to compare FIED against.

  • year (int; default=2017)

  • write_fig (bool; default=True) – Write figure to analysis figures directory

plot_eia_comparison(eia_mecs=15680000000000.0, eia_mer=23160000000000.0)[source]

Plot bar chart depicting FIED energy estimates relative to EIA estimates.

Parameters:
  • eia_mecs (float; default=1.568E13) – Combustion energy use (in MJ) from EIA Manufacturing Consumption survey. Default represents 2018 value.

  • eia_mer (float; default=2.316E13) – Combustion energy use (in MJ) for industry from EIA Monthly Energy Review (MER). Default represents 2017 value.

plot_unit_bubble_map(unit_type, measure, max_size=66, write_fig=True)[source]

Plot locations of a single standard unit type by either energy (MJ) or design capacity.

Parameters:
  • unit_type (str) – Standard unit type: ‘other combustion’, ‘kiln’, ‘dryer’, ‘boiler’, ‘heater’, ‘turbine’, ‘oven’, ‘engine’, ‘furnace’, ‘thermal oxidizer’, ‘incinerator’, ‘other’, ‘generator’, ‘flare’, ‘stove’, ‘compressor’, ‘pump’, ‘building heat’, ‘distillation’

  • measure (str; {'energy', 'power', 'ghgs'}) – Either ‘energy’ (results in MJ), ‘power’ (results in MW), or ‘ghgs’ (results in MTCO2e)

  • max_size (int) – Max size of bubbles on map

  • write_fig (bool; default=True) – Write figure to analysis figures directory

plot_rel_bar_missing(write_fig=True)[source]

Creates a simple stacked bar showing relative amount (percentage) of GHGRP and NEI facilities with and without unit-level data.

Parameters:

write_fig (bool; default=True) – Write figure to analysis figures directory

plot_stacked_bar_missing(naics_level=2, data_subset=None, write_fig=True)[source]

” Creates stacked bar showing counts of facilities with and without unit-level data.

Parameters:
  • naics_level (int; default=2) – Specific level of NAICS aggregation to display data. NAICS is a range of integers from 2 to 6.

  • data_subset (str; {None, 'ghgrp', 'nei'}) – Plot subset of data, either facilities that are GHGRP or NEI reporters

  • rel_total (bool; default=False) – Plot the relative total of NEI and GHGRP facilities that have unit-level characterization. Renders naics_level and data_subset obsolete.

  • write_fig (bool; default=True) – Write figure to analysis figures directory

plot_ut_by_naics(naics_level=None, variable='count', write_fig=True)[source]

Creates a table that summarizes by industrial sector (i.e., 2-digit NAICS) various aspects of the dataset

Parameters:
  • naics_level (int; default=None) – Specified NAICS level (None or 2 - 6)

  • variable (str; {'count', 'energy', 'capacity'})

  • write_fig (bool; default=True) – Write figure to analysis figures directory

make_consistent_naics_column(final_data, n)[source]

Creates a column of consisently aggregated NAICS codes (i.e., same number of digits) when a column of NAICS codes contains different levels of aggregation. Will only include

Parameters:
  • final_data (pandas.DataFrame or parquet)

  • n (int; 2 to 6) – Specified NAICS level

Returns:

analysis_data – Returns original DataFrame with new column named f’n{n}’.

Return type:

pandas.DataFrame

plot_best_characterized()[source]

Identify which NAICS codes have the highest portion of facilities that have some unit-level characterization associated with them.

summary_table_intensive()[source]

Summary description of unit coverage for intensive and non-intensive industries.

fied.analysis.boiler_inventory_comparison module

fix_fips(fips)[source]

Correct float formatting for county FIPS.

Parameters:

fips (str) – County FIPS in original formatting.

Returns:

fips – County FIPS, corrected and re-formatted

Return type:

str

convert_units(x, unit)[source]

Convert energy units from MMBtu to MJ and power units from MMBtu/hr to MW.

Parameters:
  • x (float) – Value to be converted

  • unit ({'power', 'energy'}) – Type of unit to convert.

Returns:

y – Converted unit, or None

Return type:

float

get_boiler_data(boiler_url)[source]

Download Northwestern boiler inventory and return it as a dataframe.

Parameters:

boiler_url (str) – URL for Northwestern boiler inventory

Returns:

bdb – Boiler inventory as a pandas DataFrame

Return type:

pandas.DataFrame

get_fied_boiler(fied_path)[source]

Load FIED and return information only on boilers.

Parameters:

fied_path (str)

Returns:

fied_boiler

Return type:

pandas.DataFrame

compare_boilers_aggregate(bdb, fied_boiler, compare_type=None)[source]

Compare either county or NAICS (3-digit) sums of design capacity and energy estimates.

Parameters:
  • bdb (pandas.DataFrame)

  • fied_boiler (pandas.DataFrame)

  • type (str, {'county', 'naics'}) – Aggregate data sets at either county- or naics-level.

Returns:

comparison

Return type:

pandas.DataFrame

compare_boilers_units(bdb, fied_boiler)[source]

Compare boiler inventory and FIED boilers on an individual unit level. Includes only

Parameters:
  • bdb (pandas.DataFrame)

  • fied_boiler (pandas.DataFrame)

Returns:

  • units (pandas.DataFrame)

  • units_summary (pandas.DataFrame)

plot_scatter_comparison(comparison, compare_type=None, write_fig=True)[source]

Creates two subplots that compare county sums of design capacity (MW) and energy (MJ) for the boiler inventory and the foundational dataset.

Parameters:
  • comparison (pandas.DataFrame)

  • write_fig (Bool, default=True)

  • compare_type (str; {'county', 'naics'})

Return type:

None

fied.analysis.ghgrp_unit_analysis module

fied.analysis.nei_emissions_calc_methods module

fied.analysis.nei_industrial_sector module

fied.analysis.nei_unit_analysis module

Module contents