fied.ghgrp package

Submodules

fied.ghgrp.calc_GHGRP_AA module

Created on Wed Aug 30 09:52:53 2017

@author: cmcmilla

class subpartAA(aa_ff, aa_sl, std_efs)[source]

Bases: object

calc_energy_ff()[source]

Calculate MMBtu value based on reported CO2 emissions. Does not capture emissions and energy from facilities using Tier 4 calculation methodology.

calc_energy_sl()[source]

Calculate MMBtu value of spent liquor combustion based on CH4 emissions reported under Tier 4.

energy_calc()[source]

Merge resuts of Subpart AA energy calculations into a single dataframe.

fied.ghgrp.calc_GHGRP_energy module

fied.ghgrp.get_GHGRP_data module

requests_retry_session(retries=3, backoff_factor=0.7, status_forcelist=[500, 502, 504], session=None)[source]
Parameters:
  • retries (int) – Number of retries to allow.

  • backoff_factor (float) – Backoff factor to apply between attempts.

  • status_forcelist (list) – List of HTTP status codes to force a retry on.

  • session (None)

Return type:

session

get_count(table_url)[source]

Get the number of rows for a specified GHGRP table (via url) from EPA Envirofacts.

Parameters:

table_url (str) – URL for Envirofacts API

Returns:

row_count – Count of table rows.

Return type:

int

get_records(table_url, start_end)[source]

Get specified rows for a specified GHGRP table (via url) from EPA Envirofacts.

Parameters:
  • table_url (str) – URL for Envirofacts API

  • start_end (list of integers) – List indicating the starting and ending row to get

  • (e.g.

  • [0

  • 1000])

Returns:

records_df – DataFrame of records from Envirofacts API.

Return type:

pandas.DataFrame

get_GHGRP_records(reporting_year, table, rows=None, api_row_max=1000)[source]

Return GHGRP data using EPA RESTful API based on specified reporting year and table. Tables of interest are C_FUEL_LEVEL_INFORMATION, D_FUEL_LEVEL_INFORMATION, c_configuration_level_info, and V_GHG_EMITTER_FACILITIES. Optional argument to specify number of table rows.

Parameters:
  • reporting_year (int) – Reporting year of GHGRP data

  • table (str) – Name of GHGRP Envirofacts table to retrieve records from

  • rows (int; default=None) – Number of table rows to retrieve, beginning at row 0.

  • api_row_max (int; default={1000}) – Maximum number of table rows to return at a time. Envirofacts API for the GHGRP seems to be overwhelmed by > 1000 rows.

Returns:

ghgrp – DataFrame of GHGRP Envirofacts data.

Return type:

pandas.DataFrame

fied.ghgrp.ghg_tiers module

fied.ghgrp.ghgrp_fac_unit module

class GHGRP_unit_char(ghgrp_energy_file, reporting_year)[source]

Bases: object

load_fueltype_dict()[source]

Opens and loads a yaml that specifies the mapping of GHGRP fuel types to standard fuel types that have aready been applied to NEI data.

Returns:

fuel_dict – Dictionary of mappings between GHGRP fuel types and generic fuel types that have been applied to NEI data.

Return type:

dictionary

harmonize_fuel_type(ghgrp_unit_data, fuel_type_column)[source]

Applies fuel type mapping to fuel types reported under GHGRP.

Parameters:
  • ghgrp_unit_data (pandas.DataFrame)

  • fuel_type_column (str) – Name of column containing fuel types.

Returns:

ghgrp_unit_data

Return type:

pandas.DataFrame

download_unit_data()[source]

Download and unzip GHGRP unit data.

Returns:

file_path – File path of unit data spreadsheet.

Return type:

str

get_unit_capacity(ghgrp_df)[source]

Retrieve unit capacity data from EPA GHGRP data file.

Parameters:

ghgrp_df (pandas.DataFrame) – Dataframe from GHGRP energy calculations with UNIT_TYPE column updated from OCS to a specific unit type.

Returns:

unit_capacity – Dataframe with unit capacity information by Facility ID and unit name.

Return type:

pandas.DataFrame

format_ghgrp_df(ghgrp_df)[source]

Formatting (e.g., dropping columns, aggregating fuel types) for GHGRP energy estimates, which now include unit capacity data.

get_unit_type()[source]

Use unit name to deterimine unit type for unit types that are defined as OCS (Other combustion source).

Returns:

ghgrp_df – Dataframe from GHGRP energy calculations with UNIT_TYPE column updated from OCS to a specific unit type.

Return type:

pandas.DataFrame

main()[source]

fied.ghgrp.heat_rate_uncertainty module

fied.ghgrp.onsite_food module

fied.ghgrp.run_GHGRP module

Module contents