-
Notifications
You must be signed in to change notification settings - Fork 20
Install & Run
- Python 3.9 or greater, 64-bit version - https://www.python.org/downloads/
- The latest version of pip. Included as a default option with Python installation.
From command line, run:
pip install git+https://github.com/USEPA/flowsa#egg=flowsa
Or to install a specific version, run
pip install git+https://github.com/USEPA/[email protected]#egg=flowsa
where 'vX.X.X' is the version you wish to use under Releases.
You can test the installation by opening a Python console and entering
import flowsa
If no error is returned, the libraries are installed.
Example code is found in the examples folder.
See model.earth for example code loading, subsetting, and saving Bureau of Labor Statistics County Industry Data.
FlowByActivity.py and FlowBySector.py generate parquet files. In python, use pandas to read the parquet file and save in another format.
Example to save as a csv:
import pandas
# load the parquet
df = pd.read_parquet(file_name)
# maintain leading 0s in location col
df.Location = df.Location.apply('="{}"'.format)
# save output to csv with a user defined output_path
df.to_csv(output_path + '_' + file_name + ".csv", index=False)
See this stackoverflow post for a discussion on GUI tools for viewing parquets.
FLOWSA is developed using PyCharm on Windows, and instructions are provided for working with it in that environment.
- Python 3.7 or greater, 64-bit version
- PyCharm
- git
- The latest version of pip, included as a default option with Python installation.
- The packages specified in setup.py
- Fork the repository
- Open PyCharm, close all existing projects
- Select 'Check out from Version Control'.
- Copy and paste the git URL from the repository homepage for your forked repository into the 'URL' field. It is available by clicking on 'Clone' on that page and copying the URL. Putting in the URL should auto-populate the 'Directory' field. Click 'Clone'.
- Open the project. You will be warned if missing any dependencies. Install those and restart.
- Once back in, you should be able to open any .py file and run code line by line with
Shift+Ctrl+E
flowsa is developed and maintained by Office of Research & Development (ORD), Center for Environmental Solutions & Emergency Response (CESER), Land Remediation & Technology Division (LRTD), Environmental Decision Analytics Branch (EDAB), U.S. Environmental Protection Agency, Cincinnati, OH 45268. See OMB Memorandum M-16-21 Section 4 & Releasing Open Source Code.
Objectives
Projects Using FLOWSA Output
Install & Run
Example Code
Reading Parquet Files
Using FLOWSA
Loading External FBS Method YAMLs
API Keys
Troubleshooting
Contributing
Creating a Flow-By-Activity Dataset
Creating a Flow-By-Activity Crosswalk
Creating a Flow-By-Sector Dataset
FBA and FBS Naming Convention
NAICS Crosswalk
Available Data
Flow Classes
Flow-By-Activity Datasets
Flow-By-Sector Datasets
Data Storage
EPA's Tools for Industrial Ecology
Suggested Citations for FLOWSA and FBS Data
Publications and Presentations
Acknowledgements