fied.tools package

Submodules

fied.tools.misc_tools module

class FRS_API(huc_only=True)[source]

Bases: object

find_huc(registryID, huc='HUC_8')[source]

Calls EPA API for finding USGS Watershed Boundary Dataset information for a passed FRS ID. See https://www.epa.gov/frs/frs-rest-services#get_facilities_wbd

Parameters:

registryID (int) – Facility Registry Service ID

Returns:

hucCode – Hydrolic unit code. Can be [f’HUC_{n}’ for n in range(2, 14, 2)]

Return type:

str

parallelize_api(method, data)[source]

Method for parallelizing API call methods

Parameters:
  • method – API call method

  • data – Data to pass to mthod

Returns:

results – List of results from API calls

Return type:

list

find_huc_parallelized(final_data)[source]

Parallelized API call to get HUC codes based on FRS Registry IDs

Parameters:

final_data (pandas.DataFrame)

Returns:

results – List of dictionaries with registryID, HUC as key, value pairs

Return type:

list

find_facility_program_data(registryID)[source]

” Get basic facility program data from EPA’s Facility Registry Service (FRS) API.

Parameters:

registryID (int) – Facility ID

Returns:

data

Return type:

json

query_program_facility(registryID)[source]

Use EPA FRS Query API (requires registration for user ID and password)

Parameters:

registryID (int) – FRS Registry ID

Returns:

program_data

Return type:

dict

query_emissions_unit(acroynm, id)[source]
Parameters:
Returns:

emissions_data

Return type:

dict

find_unit_data(registryID)[source]

Calls methods for finding program data and then associated emissions unit data for a given Registry ID

Parameters:

registryID (int) – FRS Registry ID

Returns:

unit_data

Return type:

dict

find_unit_data_parallelized(final_data)[source]

Makes API calls to find program data and then emissions unit data for Registry IDs.

Parameters:

final_data (pandas.DataFrame)

Returns:

results – list of dictionaries.

Return type:

list

class Tools[source]

Bases: object

unit_regex(unitType)[source]

Use regex to standardize unit types, where appropriate. See unit_types variable for included types.

Parameters:

unitType (str) – Detailed unit type

Returns:

unitTypeStd – Standardized unit type

Return type:

str;

fied.tools.naics_matcher module

naics_matcher(naics_column, naics_vintage=2017)[source]

Method for matching aggregated NAICS codes (i.e., <6 digit) with 6-digit NAICS codes.

Parameters:
  • naics_column (pandas.Series) – Series of NAICS codes to match to 6-digit NAICS.

  • naics_vintage (int; 2007, 2012, 2017, or 2022) – Year of NAICS codes

Returns:

ncmatch – Original NAICS matched to 6-digit versions.

Return type:

pandas.DataFrame

Module contents