# FLOWSA: A Python Package Attributing Resource Use, Waste, Emissions, and Other Flows to Industries
## 2 Materials and Methods
### Data Visualization Functions  
One of the objectives of FLOWSA is to provide a modeling platform where model methodology can be easily modified and compared to other methods. FLOWSA includes a function for model results visualization to (1) assist in determining the impact of methodological variation or (2) understand the direct flows attributed to sectors. The function below produces both plots flowsa.generate FBSplot (method_dict, plottype, sector_length_display = None, sectors_to_include = None, plot_title = None).  
Where method_dict is a dictionary of data to include in the plot, the dictionary key is the data title, and the dictionary value is the FBS method. The plottype is either \"facet_graph\", which compares multiple flow types for a subset of sectors, or \"method_comparison\", which plots model results for different flow methodologies on the same plot. Users can specify the NAICS sector length to display, a subset of sectors to include in the plot, and a graph title.
is USGS Water Data for the Nation, which contains national, state, and county water withdrawal information for nine broad water use categories or activities, including \"Irrigation Golf Course\", \"Livestock\", and \"Mining\" [14]. The USGS data are imported to FLOWSA and output as a formatted FBA for sector attribution modeling. The activity-to-sector mappings is created using NAICS definitions [22] and a concordance file provided by the USGS. The objective of the water FBS is to attribute the USGS data to national-level 6-digit sectors, requiring multiple allocation methods and FBAs. The \"Irrigation Golf Course\" activity can be directly assigned to the 6-digit NAICS \"713910\", Golf Courses and Country Clubs. In contrast, the activity \"Livestock\" can only be directly mapped to the 3-digit NAICS \"112\", Animal Production and Aquaculture, and requires additional data sources to allocate to 6-digit NAICS. The Livestock water withdrawal cannot be directly allocated to 6-digit NAICS with the USGS data alone because it is unclear how much water is used by Beef Cattle Ranching and Farming (112111) versus any other animal. A proportional allocation method is required to allocate \"Livestock\" water withdrawal accurately to different animal types. The first step is to use data on the number of animals in each animal type category [13] and multiply that by estimates of drinking water requirements by animal type [23]. The result is a value of total annual drinking water by animal type. The USGS 3-digit NAICS \"Livestock\" water withdrawal is proportionally allocated to 6-digits using the calculated water use by animal type. The calculated water use by animal types is not used directly because the water FBS represents water for all NAICS. Using the USGS as the sole primary data source ensures that the water allocation method accounts cumulatively for all published water withdrawals in the US. Other USGS water data activity subsets, such as \"Mining\", require different allocation data sources and methods to allocate water withdrawal to 6-digit NAICS. Users can modify each water withdrawal category's data sources and allocation method within the FBS method YAML.