Skip to content

Docstrings

Ben Young edited this page Sep 22, 2021 · 4 revisions

Documentation of the primary functions from the four modules

stewi

Functions to return inventory data for a single inventory in standard formats

Functions

getInventory(inventory_acronym, year, stewiformat='flowbyfacility', filter_for_LCI=False, US_States_Only=False) : Returns an inventory in a standard output format :param inventory_acronym: like 'TRI' :param year: year as number like 2010 :param stewiformat: standard output format for returning..'flowbyfacility' is only current :param filter_for_LCI: whether or not to filter inventory for life cycle inventory creation :param US_States_Only: includes only US states :return: dataframe with standard fields depending on output format

getInventoryFacilities(inventory_acronym, year) : Returns flows for an inventory :param inventory_acronym: e.g. 'TRI' :param year: e.g. 2014 :return: dataframe with standard flows format

getInventoryFlows(inventory_acronym, year) : Returns flows for an inventory :param inventory_acronym: e.g. 'TRI' :param year: e.g. 2014 :return: dataframe with standard flows format

seeAvailableInventoriesandYears(stewiformat='flowbyfacility')

chemicalmatcher

Functions to allow retrieval of chemical and substance matches from precompiled chemical match lists or the EPA SRS web service

Functions

get_matches_for_StEWI() : Retrieves all precompiled chemical matches :return: dataframe in ChemicalMatches standard output format

get_program_synomyms_for_CAS_list(cas_list, inventories_of_interest) : Gets program synonym names for chemicals by CAS using SRS web service :param cas_list: a list of CAS numbers as strings, e.g. ['124-38-9', '74-82-8'] :param inventories_of_interest: inventory acronym, e.g. ['TRI']. Valid for 'TRI','NEI', or 'DMR' :return: dataframe with columns 'CAS' and inventory acronym with program names

facilitymatcher

Functions to match facilities across inventories

Functions

get_FRS_NAICSInfo_for_facility_list(frs_id_list, inventories_of_interest_list=None) : Returns the FRS NAICS codes for the facilities of interest. Optionally it will also filter that FRS info by inventories of interest :param frs_id_list: list of FRS IDs  e.g. ['110000491735', '110000491744'] :param inventories_of_interest_list: list of inventories to filter NAICS info by,  using StEWI inventory names e.g. ['NEI'] :return: dataframe with columns 'FRS_ID', 'Source', 'NAICS', 'PRIMARY_INDICATOR'

get_matches_for_id_list(base_inventory, id_list, inventory_list=['NEI', 'TRI', 'eGRID', 'RCRAInfo']) : Returns facility matches given a list of inventories of interest,  a base inventory and list of ids from that inventory.   :param base_inventory: str base inventory corresponding to id_list (e.g. 'NEI) :param id_list: list of inventory ids (note not FRS_IDs)  e.g. ['661411', '677611'] :param inventory_list: list of inventories for desired matches  using StEWI inventory names. defaults to all stewi inventories.  e.g. ['NEI','TRI'] :return: dataframe in FacilityMatches standard output format

get_matches_for_inventories(inventory_list=['NEI', 'TRI', 'eGRID', 'RCRAInfo']) : Returns all facility matches for given inventories   :param inventory_list: list of inventories for desired matches using StEWI inventory names  e.g. ['NEI','TRI'] :return: dataframe in FacilityMatches standard output format

stewicombo

Functions to combine inventory data

Functions

combineFullInventories(inventory_dict, filter_for_LCI=True, remove_overlap=True) : Combines full stewi inventories   :param inventory_dict: dictionary of inventories and years,  e.g. {"TRI":"2014","NEI":"2014","RCRAInfo":"2015"} :param filter_for_LCI: boolean. Passes through to stewi to filter_for_LCI. See stewi. :param remove_overlap: boolean. Removes overlap across inventories based on preferences  defined in globals :return: Flow-By-Facility Combined Format

combineInventoriesforFacilitiesinOneInventory(base_inventory, inventory_dict, filter_for_LCI=True, remove_overlap=True) : Combines stewi inventories for all facilities present in a given base_inventory inventory   The base_inventory must be in the inventory_dict :param base_inventory: reference inventory e.g. "TRI" :param inventory_dict: dictionary of inventories and years,  e.g. {"TRI":"2014","NEI":"2014","RCRAInfo":"2015"} :param filter_for_LCI: boolean. Passes through to stewi to filter_for_LCI. See stewi. :param remove_overlap: boolean.  Removes overlap across inventories based on preferences defined in globals :return: Flow-By-Facility Combined Format

combineInventoriesforFacilityList(base_inventory, inventory_dict, facility_id_list, filter_for_LCI=True, remove_overlap=True) : Combines stewi inventories for all facilities present in a given facility id list   The base_inventory must be in the inventory_dict :param base_inventory: reference inventory e.g. "TRI" :param inventory_dict: dictionary of inventories and years,  e.g. {"TRI":"2014","NEI":"2014","RCRAInfo":"2015"} :param facility_id_list: list of facility ids from base_inventory  e.g. ['99501MPCLS1076O', '99501NCHRG459WB', '99515VNWTR590E1'] :param filter_for_LCI: boolean. Passes through to stewi to filter_for_LCI. See stewi. :param remove_overlap: boolean.  Removes overlap across inventories based on preferences defined in globals :return: Flow-By-Facility Combined Format

pivotCombinedInventories(combinedinventory_df) : Creates a pivot table of combined emissions   :param combinedinventory_df: pandas dataframe returned from a 'combineInventories..' function :return: pandas pivot_table