# FLOWSA: A Python Package Attributing Resource Use, Waste, Emissions, and Other Flows to Industries
## 2 Materials and Methods
### Mapping Flow-by-Activity Datasets to Sectors  
The next step of the sector attribution process is determining which sectors relate to each activity in the FBA datasets. Generating an FBS requires each FBA to have a unique concordance file containing the source activity names, such as \"Irrigation Crop\", matched to one or more related sectors. Sectors are generally 2012 NAICS codes but also include the BEA codes for household and government sectors, as no NAICS codes represent these sectors. The only data sources that do not require a mapping file are those with activities that are already published as NAICS. Activities are mapped to the most aggregate, appropriate NAICS level. NAICS codes are published in a two- to six-digit hierarchy, where the economic sector becomes more specific as the digits increase. The \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Code** & **Dataset** & **Class** & **Geographic Scale** & **Description** & **Years** \\ \hline USGS\_MYB & \begin{tabular}{c} USGS Mineral \\ Yearbook \\ \end{tabular} & Geological & National & \begin{tabular}{c} Imports, Exports, \\ Production, \\ Consumption \\ \end{tabular} & 2012–2018 \\ \hline USGS\_NWIS\_WU & \begin{tabular}{c} US Geological \\ Survey Water Use \\ in the US \\ \end{tabular} & Water & County & \begin{tabular}{c} Annual \\ national-level \\ water use by \\ various activities \\ \end{tabular} & 2010, 2015 \\ \hline USGS\_SPARROW & \begin{tabular}{c} USGS SPARROW \\ MAPPERS \\ \end{tabular} & Chemicals & HUC & \begin{tabular}{c} Phosphorus and \\ nitrogen in streams \\ and coastal waters \\ \end{tabular} & 2012 \\ \hline USGS\_WU\_Coef & \
\begin{tabular}{c} USDA Water Use \\ Coefficients \\ \end{tabular} & Water & National &
\begin{tabular}{c} Method for \\ estimating water \\ withdrawals for \\ livestock \\ \end{tabular} & 2005 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: _Cont._activity-to-sector mapping or \"crosswalk\" files capture which sectors are related to an activity but do not specify how activities are attributed to sectors. Rather, the FBS method dictates the attribution methodology. Sector assignments in FLOWSA v1.2.1 were created by conversing with data publishers and using source-provided concordance files, activity definitions in publications, and NAICS definitions [12]. As crosswalks are manually created for each data source, users can include customized sector codes to disaggregate an economic activity beyond the standard categorization. In FLOWSA v1.2.1, many of the activities from the US Department of Agriculture (USDA) Census of Agriculture (CoA) [13] are assigned to 7-digit NAICS codes. For example, NAICS defines sector code 112130 as \"Dual-Purpose Cattle Ranching and Farming\" [12], but the relevant data available from the USDA CoA is for (a) \"Cattle, (Excl Cows)\" and (b) \"Cattle, Cows\". As the USDA data are more specific than the definition of the 6-digit NAICS code and because the two values combined equal the 6-digit NAICS, \"Cattle, (Excl Cows)\" is assigned a sector code of \"112130A\" and \"Cattle, Cows\" a sector code of \"112130B\". This flexibility in sector assignments allows the flow activity to be imported without modification while accurately attributing the data to sectors. A subset of the USGS National Water Information System (NWIS) Water Use (WU) [14] crosswalk is shown in Table 3, with the standard mapping table headers. The \"ActivitySourceName\" column is the acronym of the data source name used throughout FLOWSA and is unique to each data source. The \"Activity\" column contains original activity names from a source mapped to sectors. The \"SectorSourceName\" specifies the year of the NAICS codes used. In FLOWSA v1.2.1, all FBA mapping files use 2012 codes. The \"Sector\" column contains the most aggregate applicable NAICS for each source activity. The column \"SectorDescription\" is added here to clarify the sector codes but is not included in the FLOWSA code.